Created
July 26, 2014 02:32
-
-
Save gevans/cf7e7e141f66a3ff4991 to your computer and use it in GitHub Desktop.
Provision a bitcoin 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
#!/usr/bin/env bash | |
# JSON-RPC user (see bitcoind -rpcuser) | |
RCP_USER='changeme' | |
# JSON-RPC password (see bitcoind -rpcpassword) | |
RPC_PASSWORD='changeme' | |
# JSON-RPC IP whitelist (see bitcoind -rpcallowip) | |
RPC_ALLOWED_IPS='127.0.0.1' | |
# Directory to store bitcoind database | |
DATA_DIR=/data/bitcoin | |
mkdir -p "$DATA_DIR" | |
# Update the system | |
apt-get update && apt-get dist-upgrade -y | |
# Install bitcoind | |
apt-add-repository -y ppa:bitcoin/bitcoin | |
apt-get update && apt-get install -y bitcoind | |
# Create bitcoind system user | |
adduser --system --home /data/bitcoin --shell /bin/sh --gecos Bitcoin bitcoin | |
# Create initial configuration | |
cat >/etc/bitcoind.conf <<EOF | |
rpcuser=$RPC_USER | |
rpcpassword=$RPC_PASSWORD | |
rpcallowip=$RPC_ALLOWED_IPS | |
datadir=$DATA_DIR | |
server=1 | |
txindex=1 | |
EOF | |
# Create upstart job | |
cat >/etc/init/bitcoind.conf <<'EOF' | |
description "bitcoind" | |
start on startup | |
stop on shutdown | |
respawn | |
respawn limit 15 5 | |
exec start-stop-daemon --start --make-pidfile --pidfile /var/run/bitcoind.pid --chuid bitcoin --exec /usr/bin/bitcoind -- -conf=/etc/bitcoind.conf | |
EOF | |
# Reload upstart config | |
initctl reload-configuration | |
# Get this shiz started! | |
start bitcoind |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment