Ubuntu 下开始准备编译比特币

Ubuntu 下开始准备编译比特币


Ubuntu 16.04.我是装在了虚拟机上,参考菜菜子的文章来配置的

聊聊比特币(Bitcoin)客户端源码编译那些事

一、安装第三方

首先绕过前人遇见的坑

sudo vi /etc/resolv.conf

然后把 nameserver 这修改如下

nameserver=8.8.8.8

然后再开始第一步

sudo apt-get update

一开始就出了个问题 虚拟机我配置的桥接  刚执行第一个命令就提示各种域名无法解析 

ubuntu linux装后为什么不能上网啊??÷

用了下万能的收索引擎 才知道需要配置网卡 第一次使用Ubuntu 这种linux/unix 操作系统 慢慢爬坑吧 �因为我用ifconfig已经检查了网卡配置显示是正常的 同时能够ping通网关 于是我只是把DNS加了114.114.114.114进去就可以上网了

再次执行第一步 没问题

然后继续

sudo apt-get upgrade


sudo apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev

sudo apt-get install libboost-all-dev

sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler

sudo apt-get install libqrencode-dev

sudo apt-get install libminiupnpc-dev

二、下载源码

先安装git

cd ~

sudo apt install git

然后用 git 下载

git clone https://github.com/bitcoin/bitcoin.git


三、安装比特币客户端

创建目录

cd bitcoin

mkdir db4/

下载berkeley-db安装包,我按下面的命令 是能下载成功的 

wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz


tar -xzvf db-4.8.30.NC.tar.gz

cd db-4.8.30.NC/build_unix/

../dist/configure --enable-cxx --disable-shared --with-pic --prefix=/home/theusername/bitcoin/db4/

make

sudo make install

比特币(Bitcoin)客户端的安装

cd ~/bitcoin/

./autogen.sh

./configure LDFLAGS="-L/home/theusername/bitcoin/db4/lib/" CPPFLAGS="-I/home/theusername/bitcoin/db4/include/"

configure:error: libdb_cxx headers missing, Bitcoin Corerequiresthis libraryforwallet functionality (--disable-wallet todisablewallet functionality)

查了下 参考 blog.csdn.net/terminatorsong/article/details/74089911 

看了下文档,提示需要libdb5.1。查查问题的时候都是关于bitcoin的,提到的都是要使用BerkeleyDb4.8NC。CentOS没有libdb,只能手动安装BerkeleyDb5.1。在doc/build-unix.md文档里有详细的说明,按说明操作安装即可

cd ~

wget http://download.oracle.com/berkeley-db/db-5.1.29.NC.tar.gz

echo '08238e59736d1aacdd47cfb8e68684c695516c37f4fbe1b8267dde58dc3a576c db-5.1.29.NC.tar.gz' | sha256 sum -c

tar -xzvf db-5.1.29.NC.tar.gz

cd db-5.1.29.NC/build_unix/

../dist/configure --enable-cxx --disable-shared --with-pic --prefix=/usr/local

sudo make install

重新再来

cd bitcoin

./configure LDFLAGS="-L/home/theusername/bitcoin/db4/lib/" CPPFLAGS="-I/home/theusername/bitcoin/db4/include/"

error: Found Berkeley DB other than 4.8, required for portable wallets (–with-incompatible-bdb to ignore), run the following command instead. You can always send your bitcoins to another wallet.

提示安装的DB不是4.8的版本,使用下边的命令跳过DB的版本检测

./configure --with-incompatible-bdb LDFLAGS="-L/home/theusername/bitcoin/db4/lib/" CPPFLAGS="-I/home/theusername/bitcoin/db4/include/"

error:libevent not found 

缺少库 没啥好说的 安装

cd ~

sudo apt-get install libevent-dev

再次重来

cd bitcoin

./configure --with-incompatible-bdbLDFLAGS="-L/home/theusername/bitcoin/db4/lib/" CPPFLAGS="-I/home/theusername/bitcoin/db4/include/"

make

sudo make install


四、安装完成了验证下

 which bitcoind

 which bitcoin-cli

两条命令 均会返回一个具体路径 我就不贴了


区块链研习社比特币源码研读班  孤少

你可能感兴趣的:(Ubuntu 下开始准备编译比特币)