Skip to content

Instantly share code, notes, and snippets.

@cdljsj
Forked from hunanboy/install_bitcoin.sh
Last active September 17, 2021 07:37
Show Gist options
  • Save cdljsj/180e705fad8647590ee0ecc1f6182f43 to your computer and use it in GitHub Desktop.
Save cdljsj/180e705fad8647590ee0ecc1f6182f43 to your computer and use it in GitHub Desktop.
Install Bitcoin Node (CentOS 7)
#!/bin/bash
# WARNING: 1G size ram won't work! Bitcoin "make" consumes lots of ram. Add swap first: https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-centos-7
# Adapted from: https://www.ndchost.com/wiki/how-to-install-bitcoin-on-centos-7
BITCOIN_TAG="v0.18.0"
# Install the EPEL repository
sudo yum install -y epel-release
# Install requirements/dependencies
sudo yum install -y \
autoconf \
automake \
boost-devel \
gcc-c++ \
git \
libdb4-cxx \
libdb4-cxx-devel \
libevent-devel \
libtool \
openssl-devel \
libdb-devel.x86_64 \
libdb \
libdb-cxx.x86_64 \
libdb-cxx-devel.x86_64 \
patch \
wget
# From https://www.ndchost.com/wiki/how-to-install-bitcoin-on-centos-7
#
# Compile and install OpenSSL (Unfortunately the openssl thats provided with
# CentOS is lacking EC Libraries so we are going to have to download, build, and
# install a separate copy of OpenSSL)
cd ~
mkdir openssl
cd openssl
wget https://www.openssl.org/source/openssl-1.0.1l.tar.gz
tar zxvf openssl-1.0.1l.tar.gz
cd openssl-1.0.1l
export CFLAGS="-fPIC"
./config --prefix=/opt/openssl shared enable-ec enable-ecdh enable-ecdsa
make all
sudo make install
# Download and compile bitcoin
cd ~
git clone https://github.com/bitcoin/bitcoin.git
cd ~/bitcoin
git checkout ${BITCOIN_TAG}
./autogen.sh
sudo ./contrib/install_db4.sh /opt
export BDB_PREFIX='/opt/db4'
./configure --without-gui --disable-wallet --prefix=/opt/bitcoin-${BITCOIN_TAG} BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include" PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig LIBS=-Wl,-rpath,/opt/openssl/lib
make
sudo make install
cd ~
rm -rf bitcoin openssl
sudo ln -s /opt/bitcoin-${BITCOIN_TAG}/bin/bitcoind /usr/bin/bitcoind
sudo ln -s /opt/bitcoin-${BITCOIN_TAG}/bin/bitcoin-cli /usr/bin/bitcoin-cli
@bg002h
Copy link

bg002h commented May 23, 2021

When I do this, I get boost 1.53…but I need boost 1.58 for my fork of core (a fork of bitcoinfibre for satellite stuff)…I have boost 169 installed but can’t get configure to find it. Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment