Ensure that your systems are up to date and fully patched
Debian & Ubuntu
sudo apt update -y && sudo apt upgrade -y
CentOS & Amazon Linux
sudo yum update && sudo yum upgrade -y
Take note of the IP addresses for each machine (run ifconfig
), since the instructions can't assume what they will be.
Fill in with the actual IP when required. These will be noted by:
GETH_NODE_IP
for the machine running GethPOSTGRES_IP
for the machine running PostgreSQLCHAINLINK_IP
for the machine running the ChainLink node
Debian
sudo apt -y install git build-essential net-tools vim curl ntp screen
Ubuntu
sudo apt -y install ntp screen software-properties-common
CentOS & Amazon Linux
sudo yum -y install git gcc gcc-c++ make openssl-devel net-tools vim curl ntp screen yum-utils
Start the ntp service
Debian & Ubuntu
sudo /etc/init.d/ntp start
sudo systemctl enable ntp
CentOS
sudo systemctl start ntpd
sudo update-rc.d ntpd enable
Amazon Linux
sudo /etc/init.d/ntpd start
sudo chkconfig ntpd on
Set up swap file
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo su
echo '/swapfile none swap sw 0 0' >> /etc/fstab
exit
sudo /sbin/shutdown -r now
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
Download and install Go:
curl -O https://storage.googleapis.com/golang/go1.9.2.linux-amd64.tar.gz
tar -xvf go1.9.2.linux-amd64.tar.gz
sudo mv go /usr/local
Set the Go paths:
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.profile
source ~/.profile
Replace GETH_NODE_IP
with the IP of the machine running the Geth node
git clone https://github.com/ethereum/go-ethereum.git && cd go-ethereum
make geth
Also try running --syncmode "light"
if storage usage is too high.
Ubuntu
geth --fast --cache=16 --rpc --rpcaddr GETH_NODE_IP --ipcdisable
All others
./build/bin/geth --fast --cache=16 --rpc --rpcaddr GETH_NODE_IP --ipcdisable
Debian & Ubuntu
sudo apt -y install net-tools vim screen postgresql
CentOS
sudo yum -y install net-tools vim screen postgresql-server postgresql-contrib yum-utils
Amazon Linux
sudo yum -y install net-tools vim screen postgresql96-server yum-utils
Replace 9.6 with your version number. You can find this with "ls /etc/postgresql"
cd /etc/postgresql/9.6/main/
If you're setting up the node with different IPs, change them here. Replace CHAINLINK_IP
and CHAINLINK_IP/##
with the IP of the machine running the ChainLink node. The /##
should be the prefix for the subnet mask.
sudo sh -c "echo \"listen_addresses = 'CHAINLINK_IP'\" >> postgresql.conf"
sudo sh -c "echo \"host all all CHAINLINK_IP/## trust\" >> pg_hba.conf"
Start PostgreSQL
sudo /etc/init.d/postgresql restart
sudo update-rc.d postgresql enable
Init the database
sudo postgresql-setup initdb
If you're setting up the node with different IPs, change them here. Replace CHAINLINK_IP
and CHAINLINK_IP/##
with the IP of the machine running the ChainLink node. The /##
should be the prefix for the subnet mask.
sudo su postgres
cd /var/lib/pgsql/data
sh -c "echo \"listen_addresses = 'CHAINLINK_IP'\" >> postgresql.conf"
sh -c "echo \"host all all CHAINLINK_IP/## trust\" >> pg_hba.conf"
exit
Start PostgreSQL
sudo systemctl start postgresql
sudo systemctl enable postgresql
Init the database
sudo service postgresql initdb
If you're setting up the node with different IPs, change them here
sudo su postgres
cd /var/lib/pgsql9/data
sh -c "echo \"listen_addresses = '172.17.0.1'\" >> postgresql.conf"
sh -c "echo \"host all all 172.17.0.0/16 trust\" >> pg_hba.conf"
exit
Start PostgreSQL
sudo /etc/init.d/postgresql restart
sudo chkconfig docker on
Debian & Ubuntu
sudo apt -y install net-tools vim apt-transport-https ca-certificates curl gnupg2 software-properties-common screen
CentOS
sudo yum -y install net-tools vim ca-certificates curl gnupg2 screen yum-utils
Amazon Linux
sudo yum -y install net-tools vim ca-certificates curl gnupg2 screen yum-utils
Debian
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
sudo add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable"
sudo apt -y update
sudo apt -y install docker-ce
Ubuntu (17.04+, Artful doesn't have its own release yet, Zesty works fine)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable"
sudo apt -y update
sudo apt -y install docker-ce
CentOS
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum -y install docker-ce
sudo systemctl start docker
Amazon Linux
sudo yum -y install docker
sudo /etc/init.d/docker start
sudo chkconfig docker on
Allow use of Docker commands without sudo
sudo gpasswd -a $USER docker
su $USER
docker pull smartcontract/chainlink
touch .env
You can also use POSTGRES_USER and POSTGRES_PASSWORD environment variables in the .env file if you set up a different user in PostgreSQL. Replace POSTGRES_IP
with the IP of the server running PostgreSQL and GETH_NODE_IP
with the IP of the machine running the Geth node
echo "DATABASE_URL=postgresql://postgres@POSTGRES_IP:5432/nayru_development?encoding=utf8&pool=5&timeout=5000" >> .env
echo "ETHEREUM_URL=http://GETH_NODE_IP:8545" >> .env
echo "ETHEREUM_EXPLORER_URL=https://etherscan.io" >> .env
Before running the next line, please change the password to something that you prefer
echo "PRIVATE_KEY_PASSWORD=passwordchangeme" >> .env
Run this to initialize the database:
docker run -it --env-file=.env smartcontract/chainlink rake oracle:initialize
It will ask if you're ready to print coordinator credentials to the screen. You need to actually type "Y" for it to print out the coordinators. Copy them into a text file.
And finally run this to actually start the node:
docker run -t --env-file=.env smartcontract/chainlink