Created
June 27, 2019 13:19
-
-
Save kwunyeung/54ad9064dc4549d6c37aa8e82beaafa3 to your computer and use it in GitHub Desktop.
Install Kava node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Upgrade the system and install go | |
sudo apt update | |
sudo apt upgrade -y | |
sudo apt install gcc git make -y | |
sudo snap install --classic go | |
sudo mkdir -p /opt/go/bin | |
# Export environment variables | |
export GOPATH=$HOME/go | |
export PATH=$GOPATH/bin:$PATH | |
# Create a system user for running the service | |
sudo useradd -m -d /opt/kvd --system --shell /usr/sbin/nologin kvd | |
sudo -u kvd mkdir -p /opt/kvd/config | |
# Get Kava and build binaries | |
git clone https://github.com/Kava-Labs/kava.git | |
go install ./cmd/kvd ./cmd/kvcli | |
cd | |
# Copy the binaries to /opt/go/bin/ | |
sudo cp $HOME/go/bin/kv* /opt/go/bin/ | |
# Create systemd unit file | |
echo "[Unit] | |
Description=Kava Node | |
After=network-online.target | |
[Service] | |
User=kvd | |
ExecStart=/opt/go/bin/kvd start --home=/opt/kvd/ | |
Restart=always | |
RestartSec=3 | |
LimitNOFILE=4096 | |
[Install] | |
WantedBy=multi-user.target" > kvd.service | |
sudo mv kvd.service /etc/systemd/system/ | |
sudo systemctl enable kvd.service | |
# Create the config skeleton as user gaiad | |
sudo -u kvd /opt/go/bin/kvd unsafe-reset-all --home=/opt/kvd | |
echo "You can copy the genesis.json file to /opt/kvd/config and edit the /opt/kvd/config/config.toml." | |
echo "Run 'sudo service kvd start' to start the service." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment