How I compiled Bitcoin Classic - step by step.
EDIT - Changed this to reflect Bitcoin Classic v.0.11.2.cl1 (was: the beta 2 version of this).
This is for a background service, not GUI
This is for Ubuntu (and compatible) linux distributions. This works on the raspberry pi, too. I am sure you would need to do all sorts of other things to compile this on windows.
My installation runs cr.yp.to daemontools as a process monitoring and restarting tool. I create a bitcoind usergroup and bitcoind user account, and store the blockchain in /data.
Step 1. Installing dependencies
apt-get -y update
apt-get -y install nano less build-essential libtool autotools-dev autoconf pkg-config libssl-dev libboost-all-dev git bsdmainutils libcurl4-openssl-dev
Step 2. Installing cr.yp.to daemontools
This opens a text editor of error.h. In order to compile daemontools on Ubuntu, a single line needs to be changed. Change "extern int errno;" into "#include <errno.h>". Leave everything else. Exit with Control-X and choose Y to save.
package/install
nano -w /etc/init.d/svscanboot
Paste the following, and save:
Code: Select all
#!/bin/bash
#chkconfig: 2345 80 05
#description: daemontools starter
DESC="daemontools"
NAME=svscanboot
DAEMON=/command/svscanboot
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
#. /etc/init.d/functions
PATH=/command:${PATH}
export PATH
d_start() {
[ -x $DAEMON ] || exit 5
echo $"Starting service scan from daemontools: "
$DAEMON&
#$DAEMON
return $?
}
d_stop() {
echo $"Shut down not implemented"
#killproc $NAME
/command/svc -d /service/*
pkill svscanboot
pkill svscan
pkill supervise
return 0
}
d_restart() {
echo $"Restart not implemented "
d_stop
d_start
return 0
}
case "$1" in
"start")
d_start
;;
"stop")
d_stop
;;
"restart")
d_restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 2
esac
chmod 755 /etc/init.d/svscanboot
update-rc.d svscanboot defaults
mkdir /var/service
reboot
Once it has been rebooted, type "ps aux --forest" to see if you have something like this:
Code: Select all
root 445 0.0 0.0 1896 60 ? S 06:37 0:00 /bin/sh /command/svscanboot
root 447 0.0 0.0 1832 324 ? S 06:37 0:02 \_ svscan /service
root 448 0.0 0.0 1660 56 ? S 06:37 0:00 \_ readproctitle service errors: ............................................................................................................................................................................
Step 3. Installing Bitcoin Classic v.0.11.2.cl1
cd ~
git clone
https://github.com/bitcoinclassic/bitcoinclassic
cd bitcoinclassic/
git checkout v0.11.2.cl1
./autogen.sh
./configure --disable-wallet
make
make install
mkdir /data
addgroup bitcoind
adduser --no-create-home --ingroup bitcoind --disabled-password --disabled-login bitcoind
mkdir /data/bitcoind
chown bitcoind:bitcoind /data/bitcoind/
Step 4. Configuring bitcoin launch script
mkdir /var/service/bitcoind
nano -w /var/service/bitcoind/run
Paste the following, and save:
Code: Select all
#!/bin/sh
BTC_EXE=/usr/local/bin/bitcoind
BTC_CONF=/etc/bitcoind.conf
BTC_USER=bitcoind
BTC_DATA=/data/bitcoind
nice -n 5 setuidgid $BTC_USER $BTC_EXE -conf=$BTC_CONF -datadir=$BTC_DATA
exec nice -n 5 setuidgid $BTC_USER $BTC_EXE -conf=$BTC_CONF -datadir=$BTC_DATA -reindex
chmod 755 /var/service/bitcoind/run
Now run bitcoind once, manually, and copy the rpcuser and rpcpassword lines it generates.
/var/service/bitcoind/run
nano -w /etc/bitcoind.conf
Paste the following, and save:
server=1
rpcuser=<enter from previous step>
rpcpassword=<enter from previous step>
ln -s /var/service/bitcoind /service
Bitcoin should now be launched. In "ps aux --forest" you will see something like this:
Code: Select all
root 445 0.0 0.0 1896 60 ? S 06:37 0:00 /bin/sh /command/svscanboot
root 447 0.0 0.0 1832 324 ? S 06:37 0:02 \_ svscan /service
root 781 0.0 0.0 1672 336 ? S 06:42 0:00 | \_ supervise bitcoind
bitcoind 782 137 24.0 355584 228312 ? R<l 06:42 1279:30 | \_ /usr/local/bin/bitcoind -conf=/etc/bitcoind.conf -datadir=/data/bitcoind
root 448 0.0 0.0 1660 56 ? S 06:37 0:00 \_ readproctitle service errors: ............................................................................................................................................................................
Step 5. Making sure bitcoin-cli command works
mkdir ~/.bitcoin
ln -s /etc/bitcoind.conf ~/.bitcoin/bitcoin.conf
Step 6. Verify you are running Bitcoin Classic 0.11.2
bitcoin-cli getnetworkinfo
This should return:
Code: Select all
{
"version" : 110200,
"subversion" : "/Classic:0.11.2/",
... <snip>
}
Step 7. Making sure your node can be reached from the Internet
Visit bitnodes.21.co, and in the part that says "Join the network", click Check Node. It should already display your IP address, but you can change it if it is different. If it complains that "yourIP:8333 is unreachable" then you need to configure your router to forward port 8333 to your computer. This is different for every router, but just google your router make and model, and port forwarding, and you should find instructions.