Skip to content

Instantly share code, notes, and snippets.

@chinezupwnz
Forked from kwunyeung/iris_install.sh
Created April 27, 2019 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chinezupwnz/df08c28411ce47e5057d51c70c8c12e7 to your computer and use it in GitHub Desktop.
Save chinezupwnz/df08c28411ce47e5057d51c70c8c12e7 to your computer and use it in GitHub Desktop.
Install IRIShub
#!/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/iris --system --shell /usr/sbin/nologin iris
sudo -u iris mkdir -p /opt/iris/config
# Get IRIShub and build binaries
go get github.com/irisnet/irishub
cd $HOME/go/src/github.com/irisnet/irishub
git fetch --all
git checkout -f v0.13.1
make all
cd
# Copy the binaries to /opt/go/bin/
sudo cp $HOME/go/bin/iris* /opt/go/bin/
# Create systemd unit file
echo "[Unit]
Description=IRIShub Node
After=network-online.target
[Service]
User=iris
ExecStart=/opt/go/bin/iris start --home=/opt/iris/
Restart=always
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target" > iris.service
sudo mv iris.service /etc/systemd/system/
sudo systemctl enable iris.service
# Create the config skeleton as user iris
sudo -u iris /opt/go/bin/iris unsafe-reset-all --home=/opt/iris
echo "You can copy the genesis.json file to /opt/iris/config and edit the /opt/iris/config/config.toml."
echo "Run 'sudo service iris start' to start the service."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment