Mainnet
Osmosis
- Chain ID
- Version
- Go
For Ubuntu 22.04 or later. The node listens on ports starting with your port prefix (e.g. 26657 becomes 33657), so several nodes can share a server.
01Install tools
sudo apt update && sudo apt upgrade -y sudo apt install -y curl git wget jq make gcc build-essential lz4 zstd tmux htop unzip02Install Go
cd $HOME VER="<go-version>" wget "https://golang.org/dl/go$VER.linux-amd64.tar.gz" sudo rm -rf /usr/local/go sudo tar -C /usr/local -xzf "go$VER.linux-amd64.tar.gz" rm "go$VER.linux-amd64.tar.gz" [ ! -f $HOME/.bash_profile ] && touch $HOME/.bash_profile echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bash_profile source $HOME/.bash_profile mkdir -p $HOME/go/bin go version03Build the binary
cd $HOME rm -rf osmosis git clone https://github.com/osmosis-labs/osmosis.git osmosis cd osmosis git checkout <version> make install osmosisd version --long | grep -E '^(version|commit):'04Install Cosmovisor
go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest DAEMON_HOME=$HOME/.osmosisd DAEMON_NAME=osmosisd cosmovisor init $HOME/go/bin/osmosisd05Create the service
sudo tee /etc/systemd/system/osmosisd.service > /dev/null << EOF [Unit] Description=Osmosis node After=network-online.target [Service] User=$USER ExecStart=$(which cosmovisor) run start WorkingDirectory=$HOME/.osmosisd Restart=on-failure RestartSec=10 LimitNOFILE=65535 Environment="DAEMON_HOME=$HOME/.osmosisd" Environment="DAEMON_NAME=osmosisd" Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true" Environment="DAEMON_RESTART_AFTER_UPGRADE=true" Environment="UNSAFE_SKIP_BACKUP=true" Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$HOME/.osmosisd/cosmovisor/current/bin" [Install] WantedBy=multi-user.target EOF sudo systemctl daemon-reload sudo systemctl enable osmosisd06Set variables
echo 'export WALLET="wallet"' >> $HOME/.bash_profile echo 'export MONIKER="Your-Moniker"' >> $HOME/.bash_profile echo 'export OSMO_CHAIN_ID="<chain-id>"' >> $HOME/.bash_profile echo 'export OSMO_PORT="33"' >> $HOME/.bash_profile source $HOME/.bash_profile07Initialize the node
osmosisd init "$MONIKER" --chain-id $OSMO_CHAIN_ID --home $HOME/.osmosisd osmosisd config set client chain-id $OSMO_CHAIN_ID osmosisd config set client keyring-backend os osmosisd config set client node tcp://localhost:$OSMO_PORT65708Custom ports
sed -i.bak -e "s%:1317%:$OSMO_PORT317%g; s%:8080%:$OSMO_PORT080%g; s%:9090%:$OSMO_PORT090%g; s%:9091%:$OSMO_PORT091%g; s%:8545%:$OSMO_PORT545%g; s%:8546%:$OSMO_PORT546%g" $HOME/.osmosisd/config/app.toml sed -i.bak -e "s%:26658%:$OSMO_PORT658%g; s%:26657%:$OSMO_PORT657%g; s%:6060%:$OSMO_PORT060%g; s%:26656%:$OSMO_PORT656%g; s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):$OSMO_PORT656\"%; s%:26660%:$OSMO_PORT660%g" $HOME/.osmosisd/config/config.toml09Minimum gas price
sed -i -e "s|^minimum-gas-prices *=.*|minimum-gas-prices = \"0.03uosmo\"|" $HOME/.osmosisd/config/app.toml10Pruning
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.osmosisd/config/app.toml sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.osmosisd/config/app.toml sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"19\"/" $HOME/.osmosisd/config/app.toml11Disable the indexer
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.osmosisd/config/config.toml12Download the snapshot
curl -L https://snapshots.luckystar.asia/osmosis/osmosis_data.tar.zst | zstd -d | tar -xf - -C $HOME/.osmosisd13Start the node
sudo systemctl restart osmosisd && sudo journalctl -fu osmosisd -o cat14Check sync
curl -s localhost:$OSMO_PORT657/status | jq .result.sync_info