EOS Build Guide on Ubuntu (Updated)

in #eoskorea7 years ago (edited)

eos.jpeg

Update: Added GMP installation

This is a brief guide of building EOS on Ubuntu 16.04 LTS (Google Compute Engine). I haven't tested on other versions yet. If you verify this instruction works in other versions, please comment. Reporting missing parts and wrong commands is really appreciated too.

우분투 16.04 LTS 버전에서 EOS를 빌드하는 법을 정리해봤습니다. 구글 컴퓨트 엔진 기반으로 테스트했는데, 혹시 다른 버전에서도 동작하는 것을 확인하시면 댓글로 남겨주시면 감사하겠습니다.

Preparation

screen -S compile # Optional
sudo -i # Enter root

Install Dependencies

DEBIAN_FRONTEND=noninteractive apt-get install -y sudo wget net-tools ca-certificates unzip
echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main" >> /etc/apt/sources.list.d/llvm.list
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y git-core automake autoconf libtool build-essential pkg-config libtool \
    mpi-default-dev libicu-dev python-dev python3-dev libbz2-dev zlib1g-dev libssl-dev \
    clang-4.0 lldb-4.0 lld-4.0
rm -rf /var/lib/apt/lists/*
update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-4.0/bin/clang 400
update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-4.0/bin/clang++ 400

Install cmake 3.9

cd /tmp
wget https://cmake.org/files/v3.9/cmake-3.9.0-Linux-x86_64.sh
mkdir /opt/cmake && chmod +x /tmp/cmake-3.9.0-Linux-x86_64.sh
sh /tmp/cmake-3.9.0-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake

Install boost 1.64

cd /tmp && wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz
tar zxf boost_1_64_0.tar.gz
cd boost_1_64_0
./bootstrap.sh --with-toolset=clang
./b2 -a -j$(nproc) stage release -sHAVE_ICU=1 --sICU_PATH=/usr
./b2 install --prefix=/usr
rm -rf /tmp/boost_1_64_0*

Install secp256k1-zkp from cryptonomex repo

cd /tmp
git clone https://github.com/cryptonomex/secp256k1-zkp.git
cd secp256k1-zkp
./autogen.sh
./configure
make
make install
ldconfig
rm -rf /tmp/secp256k1-zkp*

Install WASM compiler

cd /tmp && mkdir wasm-compiler && cd wasm-compiler
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git
cd llvm/tools && git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git
cd .. && mkdir build && cd build
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/opt/wasm -DLLVM_TARGETS_TO_BUILD= \-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_BUILD_TYPE=Release ../
make -j$(nproc) install
rm -rf /tmp/wasm-compiler

Install GMP

cd /tmp
wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2
tar -xvf gmp-6.1.2.tar.bz2 && cd gmp-6.1.2
./configure && make && sudo make install
make check
rm -rf /tmp/gmp-6.1.2

Exit root

exit

Install EOS software

cd ~/
git clone https://github.com/EOSIO/eos.git --recursive
cd eos && mkdir build && cd build
WASM_LLVM_CONFIG=/opt/wasm/bin/llvm-config cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/opt/eos ..
make -j$(nproc)
sudo make install
sudo cp ./programs/eosd/eosd /usr/bin/eosd    # Optional
sudo cp ./programs/eosc/eosc /usr/bin/eosc    # Optional
cp ../genesis.json ~/    # Move genesis.json to your home directory

Modify config.ini

cd ~/
eosd    # Ctrl+C after run to create config file
nano ./data-dir/config.ini

The following elements should be modified or added

# Modify
genesis-json = "/home/YOURACC/genesis.json"    # Uncomment and make sure your home directory is correct
enable-stale-production = true    # From false to true

# Add
producer-name = inita
producer-name = initb
producer-name = initc
producer-name = initd
producer-name = inite
producer-name = initf
producer-name = initg
producer-name = inith
producer-name = initi
producer-name = initj
producer-name = initk
producer-name = initl
producer-name = initm
producer-name = initn
producer-name = inito
producer-name = initp
producer-name = initq
producer-name = initr
producer-name = inits
producer-name = initt
producer-name = initu
plugin = eos::producer_plugin
plugin = eos::chain_api_plugin    # To run eosc

Run eosd

screen -S eosd
eosd

Run eosc

eosc info

See these documents for details of eosc

https://eosio.github.io/eos/group__eosc.html
https://github.com/EOSIO/eos/issues/97

Note: Example contracts are located in ~/eos/contracts, for instance,

eosc setcode currency ./eos/contracts/currency/currency.wast ./eos/contracts/currency/currency.abi

You can see my yesterday's post about executing example contracts Here

Sort:  

not sure quite what happened in my case, but I tried copy/pasting that first part into root bash shell and it literally wiped out most of my /etc directory, including passwd files, /apt dir, etc - I think some of this was designed more specifically for the docker build (via the Dockerfile template), which is how I've been trying to rebuild EOS after recreating the VM. So far that's been working well. Probably safer though to execute one line at a time, and make sure each one does what it's supposed to...

https://github.com/EOSIO/eos/blob/master/Docker/Dockerfile

hello @clayop,

I am building it on amazon linux machine. I can run easily upto below command
DEBIAN_FRONTEND=noninteractive yum install -y sudo wget net-tools ca-certificates unzip
(and note I have to use yum)

but next command - echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main" >> /etc/apt/sources.list.d/llvm.list

gives following error

-bash: /etc/apt/sources.list.d/llvm.list: No such file or directory

what to do?? yr help is much appreciated.

If Amazon/EC2 is still based on CentOS/Fedora, maybe you could try something like this:

$ echo 'HOME_DIR=/home/$(whoami)' >> .bashrc; source .bashrc ; curl -O http://releases.llvm.org/4.0.1/clang+llvm-4.0.1-x86_64-linux-gnu-Fedora-25.tar.xz; tar xvf clang+llvm-4.0.1-x86_64-linux-gnu-Fedora-25.tar.xz; echo 'export PATH=$HOME_DIR/clang+llvm-4.0.1-x86_64-linux-gnu-Fedora-25:$PATH' >> .bashrc; source .bashrc; cd ~

OR

$ echo 'HOME_DIR=/home/$(whoami)' >> .bashrc
$ source .bashrc
$ curl -O http://releases.llvm.org/4.0.1/clang+llvm-4.0.1-x86_64-linux-gnu-Fedora-25.tar.xz
$ tar xvf clang+llvm-4.0.1-x86_64-linux-gnu-Fedora-25.tar.xz
$ echo 'export PATH=$HOME_DIR/clang+llvm-4.0.1-x86_64-linux-gnu-Fedora-25:$PATH' >> .bashrc
$ source .bashrc
$ cd ~

Très bon article. Merci j'apprends des choses avec vous j'adore votre style d'écriture.

Cordialement

So what all can you do with EOS in its current state?

i believe fuck all lol someone tell me im wrong

Just posted this article that talks about EOS as the 4th generation blockchain challenge for Steem.

Analysis of Steem's Economy - A Social Scientist's First Impressions - Part 3/4 in the series.

https://steemit.com/steemit/@cyberspace/analysis-of-steem-s-economy-a-social-scientist-s-first-impressions-part-3-4

Really need a way to save posts, as this comment is purely so I can find it later

Haha manual bookmark... cool :)

I may have to spin up a Linux box to play with this!!!

You should! It's really lot of fun!

love me linux box :)

Good guide bro.

All of this makes no sense to me but i am no expert.. however since i passed here i found this kinda interating
Which is why i am going to try to understand it 🤔

that's a nice post, you have discussed things in details

Hope I can test it oneday, but now it seems complicated to me!

Thanks for the guide. Is there any hardware requirements for the ubuntu server to install EOS? like memery, and cpu? Much appreciated if you can share this as well :)

It seems dual core + 12G memory is enough for now but it may grow very fast in the real testnet.

Thanks for sharing Clayop. Your instructions are easy to follow.

thanks a lot! installation in progress ....

thank you so much..for information..eos i chek it fastaly.....

Great guide. I will give it a go.

Great ~ Thanks
I will try it later on Ubuntu

Preparation 에서 부터 한단락씩 진행되는건가요???? 위 →아래로 내려오면서 따라하면되는거죠??

그렇습니다

실행을 하니 다음과 같은 문구가 뜨네요. 한줄씩 실행 했습니다.
VMWARE 12 프리버전을 통해서 설치하였습니다.
eos결과.jpg

아 그리고 ..Modify config.ini 부분은 무슨 말인지 이해가 잘안되서요.
한글로설명좀 부탁드릴게요...ㅜㅜ

컨피그 파일을 수정하셔서 eosc 관련 플러그인을 추가하셔야합니다

Hi, the same instructions are here https://github.com/EOSIO/eos/blob/master/Docker/Dockerfile

could you optimize this, why we need packages from apt.llvm.org and
https://github.com/llvm-mirror/llvm.git and https://github.com/llvm-mirror/clang.git at the same time why not just from github?