Skip to content

Instantly share code, notes, and snippets.

@jwrb
Created April 24, 2015 23:02
Show Gist options
  • Save jwrb/8f7192553c9f2128275f to your computer and use it in GitHub Desktop.
Save jwrb/8f7192553c9f2128275f to your computer and use it in GitHub Desktop.
paycoind_ubuntu_install.sh
#!/bin/bash
# Change to a temporary directory to download source
${SOURCE_DIR=`mktemp -d`}
cd "$SOURCE_DIR"
# Update and install dependency packages
sudo apt-get update && apt-get upgrade
sudo apt-get install ntp git libssl-dev libboost-all-dev libdb5.1-dev libdb5.1++-dev
# Download and build the packageless miniupnpc dependency
curl http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.8.tar.gz |tar -xz
cd miniupnpc-1.8/
make
sudo make install
cd ..
# Download the paycoind source
git clone https://github.com/PaycoinFoundation/paycoin
# Enter the source directory and build paycoind
cd paycoin/src
make -f makefile.unix
strip paycoind
# Make the user for paycoind and install the binary for the new user
sudo useradd -mN paycoin
sudo chmod 0700 /home/paycoin
sudo mkdir /home/paycoin/bin
sudo cp paycoind /home/paycoin/bin/paycoind
sudo chown -R paycoin:users /home/paycoin/bin
# Delete the (no longer needed) source files
cd && rm -rf "$SOURCE_DIR"
# As the daemon user:
sudo -u paycoin bash <<END_SUDO
# Run the command once without a config to get a suggested username/password
cd && bin/paycoind
read -p "Enter RPC username for config: " username
read -p "Enter RPC password for config: " password
# Write an initial config
cat >~/.paycoin/paycoin.conf <<EOF
daemon=1
rpcuser=$username
rpcpassword=$password
rpcthreads=100
irc=0
dnsseed=1
EOF
# Set the config file to owner-rw only
chmod 0600 ~/.paycoin/paycoin.conf
# Start the daemon downloading the blockchain with the new conf
paycoind &
# Exit daemon user context
END_SUDO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment