It’s fairly simple to run a full bitcoin node on CentOS 7, if you want to compile one from source. Alternatively, you can run the bitcoind
daemon in a Docker container too. These steps will get your server ready to compile Bitcoin from source.
Prepare your build environment to compile Bitcoin Core
The next steps will install a compiler and all development libraries needed to compile Bitcoin Core.
$ yum -y install epel-release
Once EPEL is installed (which adds additional repositories), you can install all needed dependencies.
$ yum install -y autoconf automake boost-devel gcc-c++ git libdb4-cxx libdb4-cxx-devel libevent-devel libtool openssl-devel wget
Next, compile Bitcoin Core.
Compile Bitcoin Core from source
With all dependencies in place, it’s time to compile Bitcoin Core. I’ll start by creating a custom user that will run the daemon.
$ useradd bitcoin $ su - bitcoin
Now, while running as the new bitcoin user, clone & compile the project.
$ git clone https://github.com/bitcoin/bitcoin.git $ cd bitcoin $ git checkout v0.17.1
These steps prepare version 0.17.1 on your system. For an up-to-date list of which versions have been tagged, look at the Github releases of Bitcoin Core.
Now with the correct code in place, time to compile.
$ ./autogen.sh $ ./configure $ make -j $(nproc)
This’ll take a couple of minutes to fully compile.
Running Bitcoin Core
With these steps completed, you now have a couple of binaries in place to help you run Bitcoin Core.
$ ls -alh src/ ... -rwxrwxr-x. 1 bitcoin bitcoin 8.3M Feb 20 16:45 bitcoin-cli -rwxrwxr-x. 1 bitcoin bitcoin 114M Feb 20 16:45 bitcoind ...
You can run them from the compiled src
directory, or move them over to a location where you prefer to keep your binaries.
If you followed these steps, you’ll find the CLI tool at /home/bitcoin/bitcoin/src/bitcoin-cli
$ /home/bitcoin/bitcoin/src/bitcoin-cli --version Bitcoin Core RPC client version v0.17.1
And the Bitcoin Core daemon at /home/bitcoin/bitcoin/src/bitcoind
.
$ /home/bitcoin/bitcoin/src/bitcoind --version Bitcoin Core Daemon version v0.17.1 Copyright (C) 2009-2018 The Bitcoin Core developers
Have fun!