Ubuntu 下開始準備編譯比特幣

Ubuntu 下開始準備編譯比特幣


Ubuntu 16.04.我是裝在了虛擬機上,參考菜菜子的文章來配置的

聊聊比特幣(Bitcoin)客戶端源碼編譯那些事

一、安裝第三方

首先繞過前人遇見的坑

sudo vi /etc/resolv.conf

然后把 nameserver 這修改如下

nameserver=8.8.8.8

然后再開始第一步

sudo apt-get update

一開始就出了個問題 虛擬機我配置的橋接 ?剛執(zhí)行第一個命令就提示各種域名無法解析?

ubuntu linux裝后為什么不能上網(wǎng)????÷

用了下萬能的收索引擎 才知道需要配置網(wǎng)卡 第一次使用Ubuntu 這種linux/unix 操作系統(tǒng) 慢慢爬坑吧 ?因為我用ifconfig已經(jīng)檢查了網(wǎng)卡配置顯示是正常的 同時能夠ping通網(wǎng)關 于是我只是把DNS加了114.114.114.114進去就可以上網(wǎng)了

再次執(zhí)行第一步 沒問題

然后繼續(xù)

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


三、安裝比特幣客戶端

創(chuàng)建目錄

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沒有l(wèi)ibdb,只能手動安裝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

兩條命令 均會返回一個具體路徑 我就不貼了


區(qū)塊鏈研習社比特幣源碼研讀班 ?孤少

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • 了解底層的技術,能夠更好的理解區(qū)塊鏈。因此,決定跟隨菜菜子的腳步,從代碼的角度,看看比特幣的實現(xiàn)原理。 比特幣客戶...
    electroman閱讀 2,500評論 0 9
  • 身為一個程序猿,面對用高手編程實現(xiàn)的比特幣,不研究下源碼實在說不過去。廢話少說,直奔主題。第一節(jié)是關于比特幣源碼的...
    Jacky_2c9f閱讀 1,784評論 0 2
  • 最近想研究下比特幣源碼,首先得安裝下編譯環(huán)境,我首先按源碼中build-osx.md文檔中在mac中設置了下環(huán)境。...
    ttblack閱讀 3,183評論 3 5
  • 小時候 我家門前是座果園 枇杷,石榴,楊梅…… 唇留齒香在回憶 年少時 菜園只剩下一角 奶奶忙碌的身影少了 菜籃也...
    十二月的雪飄閱讀 447評論 7 8
  • 01 幅員遼闊的大草原上,有漫山遍野的綠油油的草地,草地上有許多野花,紅的,白的,黃的,粉的,競相點綴著漫漫曠野。...
    筆尖兒愛寫作閱讀 1,138評論 0 6