# Osmosis Archive Node Setup
## Osmosisd
Installing the Osmosis Binary:
```
cd $HOME
git clone https://github.com/osmosis-labs/osmosis
cd osmosis
git checkout v11.0.1
make install
```
## Initialize Osmosis Node
```
#node name used : Validatus
osmosisd init Validatus
#Downloading and placing genesis in osmosis config:
wget -O ~/.osmosisd/config/genesis.json https://github.com/osmosis-labs/networks/raw/main/osmosis-1/genesis.json
```
## Install and setup Cosmovisor
```
cd $HOME
git clone https://github.com/cosmos/cosmos-sdk
cd cosmos-sdk
git checkout v0.42.5
make cosmovisor
cp cosmovisor/cosmovisor $GOPATH/bin/cosmovisor
cd $HOME
```
Now make the necessary directories:
```
mkdir -p ~/.osmosisd
mkdir -p ~/.osmosisd/cosmovisor
mkdir -p ~/.osmosisd/cosmovisor/genesis
mkdir -p ~/.osmosisd/cosmovisor/genesis/bin
mkdir -p ~/.osmosisd/cosmovisor/upgrades
```
Next, set the following Environment Variables for Cosmovisor:
```
sudo tee -a /etc/profile << END
#cosmovisor
export DAEMON_NAME=osmosisd
export DAEMON_HOME=\$HOME/.osmosisd
export PATH=\$PATH:\$DAEMON_HOME/cosmovisor/current/bin
END
source /etc/profile
```
Copy osmosisd binary into the cosmovisor/genesis folder:
```
cp $GOPATH/bin/osmosisd ~/.osmosisd/cosmovisor/genesis/bin
```
Check versions of Cosmovisor and Osmosisd:
```
cosmovisor version
osmosisd version
```
Next, add a clean address book:
```
wget -O - https://quicksync.io/addrbook.osmosis.json > $HOME/.osmosisd/config/addrbook.json
```
## Download Chain Data
Download lz4:
```
sudo dnf install lz4
```
Now download the archive node chain data:
```
URL=`curl -L https://quicksync.io/osmosis.json|jq -r '.[] |select(.file=="osmosis-1-archive")|select (.mirror=="Netherlands")|.url'`
wget -O - $URL | lz4 -d | tar -xvf -
```
## Changes in config.toml/app.toml
### app.toml
As the node will be archive node, change the necessary options in app.toml, as shown:

Set API address/port, as follows:

Set port for grpc, as shown:

### config.toml
Set proxy_app address and port, as shown:

Change the database data location to the OpenZFS drive:

Set RPC laddr to the following:

Set pprof_laddr:

Next, set P2P laddr:

Now set the max. inbound/outbound connections:

## Setup systemd service
``` python=1
echo "[Unit]
Description=cosmovisor
After=network-online.target
ConditionPathExists=/home/cosmos/go/bin/
After=network.target
[Service]
Type=simple
User=cosmos
#RuntimeMaxSec=36000
#LimitNOFILE=4096
LimitNOFILE=8192
WorkingDirectory=/home/cosmos/go/
StandardOutput=journal
SyslogIdentifier=cosmosvisor
Environment="DAEMON_NAME=osmosisd"
Environment="DAEMON_HOME=/home/cosmos/.osmosisd"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
Environment="DAEMON_LOG_BUFFER_SIZE=512"
Environment="UNSAFE_SKIP_BACKUP=true"
ExecStart=/bin/bash -c '/home/cosmos/go/bin/cosmovisor start'
ExecStop=/bin/kill -2 $MAINPID
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=3
TimeoutStopSec=1
KillMode=control-group
[Install]
WantedBy=multi-user.target
" >cosmovisor.service
```
Now move the cosmovisor.service file to:
```
sudo mv cosmovisor.service /lib/systemd/system/cosmovisor.service
```
Reload and start the service:
```
sudo systemctl daemon-reload
sudo systemctl restart systemd-journald
sudo systemctl start cosmovisor
#To check status
sudo systemctl status cosmovisor
sudo journalctl -xe
```