如何在ubuntu上部署開發區塊鏈數字貨幣

來源:互聯網
上載者:User
區塊鏈愛好者(QQ:53016353)
github代碼地址:setupOnUbuntu
部署區塊鏈的OBC及hyperledger/fabric項目程式比較複雜,首先先啟動vagrant下載一個virtualbox的鏡像,之後在該box中安裝docker,通過docker來編譯項目。
這樣會導致兩個問題:
1、由於項目需要下載很多外面的依賴,國內牆略高,部署困難
2、使用virtualbox無法在Iass供應商如阿里雲上直接部署。


為瞭解決上面兩個問題,自己將官方部署翻譯為ubuntu上的部署,代碼如下:


#! /bin/bash  
# Development on Ubuntu is done on the native OS, not in Vagrant. This script can be  
# used to set up on Ubuntu, similar to devenv/setup.sh which does the  
# same for Vagrant.  
# See
#  
  
  
if [ xroot != x$(whoami) ]  
then  
   echo "You must run as root (Hint: sudo su)"  
   exit  
fi  
  
apt-get update  
apt-get install git curl gcc g++ yum  wget libc6-dev -y  
apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev llvm  
apt-get upgrade gcc g++ -y  
  
#Set the maximum number of open files to 10000 or greater for your OS  
ulimit -n 65535  
  
#TODO: should really just open a few ports..  
iptables -I INPUT 1 -j ACCEPT  
sysctl vm.overcommit_memory=1  
  
  
##################  
# Install Docker  
mkdir $HOME/tmp  
cd /tmp  
  
wget -qO- 
  
#TODO: Install on boot  
nohup docker daemon -g /data/docker -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock&  
  
##################  
# Install Golang  
curl -O https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz  
tar -C /usr/local -xzf go1.6.2.linux-amd64.tar.gz  
  
mkdir -p ~/go; echo "" >> ~/.bashrc  
cat >> ~/.bashrc <
      export GOPATH=$HOME/go  
      export PATH=$PATH:$HOME/go/bin:/usr/local/go/bin  
EOF  
  
source ~/.bashrc  
echo `go version`  
  
rm go1.6.2.linux-amd64.tar.gz  
  
################  
#ROCKSDB BUILD  
  
apt-get install -y libsnappy-dev zlib1g-dev libbz2-dev  
cd /tmp  
git clone https://github.com/facebook/rocksdb.git  
cd rocksdb  
git checkout v4.1  
  
PORTABLE=1 make shared_lib  
INSTALL_PATH=/usr make install-shared && ldconfig  
  
################  
#Install Pyenv Python  
cd /tmp  
sudo apt-get install libc6-dev gcc git -y     
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev llvm   
  
git clone git://github.com/yyuu/pyenv.git ~/.pyenv             
  
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc            
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc             
echo 'eval "$(pyenv init -)"' >> ~/.bashrc        
  
source ~/.bashrc  
    
pyenv install 3.5.1 -v   
pyenv rehash  
pyenv global 3.5.1  
  
pip install --upgrade pip  
pip install behave nose docker-compose  
pip install -I flask==0.10.1 python-dateutil==2.2 pytz==2014.3 pyyaml==3.10 couchdb==1.0 flask-cors==2.0.1 requests==2.4.3  
  
##################  
# clone project  
mkdir -p $HOME/go/src/github.com/hyperledger  
cd $HOME/go/src/github.com/hyperledger  
git clone https://github.com/hyperledger/fabric.git  
  
  
cd fabric/  
make peer unit-test  


在上面的指令碼中,主要做了下面幾件事情:


Git client   
Go - 1.6 or later   
RocksDB version 4.1 and its dependencies   
Docker   
Pip   
Set the maximum number of open files to 65535  


pip的安裝是先使用pyenv安裝python,再安裝pip。
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.