Created
April 24, 2015 23:02
-
-
Save jwrb/8f7192553c9f2128275f to your computer and use it in GitHub Desktop.
paycoind_ubuntu_install.sh
This file contains 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 | |
# 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