# Example Prod Setup ( Ubuntu )

```
apt-get update && apt-get upgrade
apt-get install git python3-dev

```

follow <https://zcash.readthedocs.io/en/latest/rtd_pages/install_debian_bin_packages.html> for a detailed guide.

```
apt-get install apt-transport-https wget gnupg2
echo "deb [arch=amd64] https://apt.z.cash/ stretch main" | sudo tee /etc/apt/sources.list.d/zcash.list
apt-get update
wget -qO - https://apt.z.cash/zcash.asc | gpg --import
gpg --export 3FE63B67F85EA808DE9B880E6DEF3BAF272766C0 | sudo apt-key add -
sudo apt-get update && sudo apt-get install zcash
ZCASHD_USER=zcashd
ZCASHD_UID=2001
useradd --home-dir /srv/$ZCASHD_USER --shell /bin/bash --create-home --uid $ZCASHD_UID $ZCASHD_USER
## as zcashd user
zcash-fetch-params
```

#### TOR

```
sudo apt install tor
```

#### Erlang & Elixir

```
wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && sudo dpkg -i erlang-solutions_2.0_all.deb
apt-get update
apt install esl-erlang
apt-get install elixir
```

#### Nginx

```
apt-get install nginx
```

#### Node

```
curl -fsSL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
```

#### Certbot ( for HTTPS )

```
snap install core; snap refresh core
snap install --classic certbot
```

Example config for `zcashd`

```
addnode=mainnet.z.cash
txindex=1
insightexplorer=1
experimentalfeatures=1
rpcuser=user
mainnet=1
rpcpassword=CHANGEMEASAP
proxy=127.0.0.1:9050
addnode=zcmaintvsivr7pcn.onion
addnode=zcashiqykswlzpsu.onion
addnode=zcashqhrmju6zfhn.onion
addnode=zcashgmvxwrmjsut.onion
addnode=zcashz3uma65ix7b.onion
addnode=zcashiyf4kxluf3x.onion
addnode=zcashwfe4x3jkz2b.onion
addnode=zcashvkeki52iqpc.onion
addnode=zcasha3cmfrpy7b7.onion
addnode=zcashz7ed3nvbdxm.onion
addnode=zcash5adwfpxfuvf.onion
addnode=zcashixg5ol2ndo4.onion
addnode=zcashuzwa365oh3n.onion
addnode=zcashskbeoiwtym3.onion
addnode=zcashuyvk5e7qfzy.onion
addnode=fhsxfrwpyrtoxeal.onion
addnode=zcash2iihed2wdux.onion
addnode=w3dxku36wbp3lowx.onion
addnode=zcashuhmzycmlwld.onion
paymentdisclosure=1
maxconnections=500
```

Example systemd file for managing zcashd

`zcashd.service`

```
[Unit]
Description=Zcashd
After=network.target

[Service]
Type=simple
Restart=always
User=zcashd
ExecStart=/usr/bin/zcashd
ExecStop=/usr/bin/zcash-cli stop
PIDFile=/home/zcash/.zcash/zcashd.pid

[Install]
WantedBy=multi-user.target
```

Create zcash-explorer user

```
EXPLORER_USER=zcash-explorer
EXPLORER_UID=2002
useradd --home-dir /srv/$EXPLORER_USER --shell /bin/bash --create-home --uid $EXPLORER_UID $EXPLORER_USER
```

as `zcash-explorer` user

```
cd 
git clone https://github.com/nighthawk-apps/zcash-explorer.git
cd zcash-explorer
## Create .env ( check ENV varsiable doc )
source .env
mix deps.get
cd assets/
npm i
npm run deploy
cd ..
MIX_ENV=prod mix phx.digest
MIX_ENV=prod mix release
## if everything went fine, you should be able to run the release as 
_build/prod/rel/zcash_explorer/bin/zcash_explorer  start
```

{% hint style="info" %}
feel free to create a systemd entry for managing the explorer
{% endhint %}

Example nginx config ( just he location part ) - if this is not configured correctly, real time features won't work.

```
    location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_http_version 1.1;
    proxy_set_header Origin '';
    proxy_redirect off;
    proxy_pass http://localhost:4000;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }
```

{% hint style="info" %}
examples commands / config given above gives you a   bare-bones setup.

Enabling HTTPS / TOR ( Onion ) is not in the scope of this documentation.
{% endhint %}
