Environmental CENTOS7.2 x64
In order to maintain the operation, the operation path is unified in/data/eth.
Ethereum Construction (environment construction is very important, pre-fill many of the deep pits behind the exploration process!) )
# After installing the virtual machine, update the CentOS server and download the git, wget, vim, gcc-c++, NTP components, Nodejs, and add epel third-party installation sources. This step is very important to save you time when you are constantly making mistakes while installing ethereum and open frames. A brief description of each tool is presented below:
# git, wget: Install related components, download and install all kinds of open source code and tools;
# Vim: Text Editing tool, replace VI;
# gcc-c++:c/c++ Compilation tool for compiling Golang and truffle components under the C library
# NTP: Network clock synchronization component; Ethereum RPC network needs time synchronization;
# Nodejs:ethereum Front-end development JavaScript package management software
# Epel: Network third-party Linux installation package source
Yum update-y && yum install git wget bzip2 vim gcc-c++ NTP epel-release Nodejs cmake-y
# download Golang (1.9.1 and 1.92 both compile failed, re-download 1.10 to compile successfully)
Domestic Mirror: HTTPS://STUDYGOLANG.COM/DL
#cd/usr
#wget https://studygolang.com/dl/golang/go1.10.1.linux-amd64.tar.gz
# tar-c/root-xzf go1.10.1.linux-amd64.tar.gz
# Unzip the Golang and move the working directory to/usr/local/go
Tar zxvf go1.10.1.linux-amd64.tar.gz
mvgo/usr/local/
# Configure Goroot and path
echo "Export Goroot=/usr/local/go" >>/etc/profile
echo "Export path= $PATH:/usr/local/go/bin" >>/etc/profile
Source/etc/profile
# Clone and Compile Go-ethereum
git clone https://github.com/ethereum/go-ethereum.git
CD Go-ethereum
Make all
#创建完毕后在path中入geth路径
echo "Export path= $PATH:/root/go-ethereum/build/bin" >>/etc/profile
Source/etc/profile
# Install CMake: Smart contract compilation SOLC need CMake compilation
# Originally to install cmake with Yum, but Yum and Epel source only 2.8.x version of the CMake, and the smart contract compiler SOLC installation requires more than 3.0.x CMake version. Therefore only to the official website installs independently.
# download CMake Latest version, login to https://cmake.org/download/, find the latest version download address
CD && wget https://cmake.org/files/v3.9/cmake-3.9.2.tar.gz
# Unzip and compile and install
TAR-XZVF cmake-3.9.2.tar.gz
CD cmaker-3.9.2
./bootstrap && make && make install
# Start Network time synchronization
Systemctl Enable NTPD
Systemctl Start NTPD
# Another geth will use 8078 and 30303 ports, let go of firewall ports 8078 and 30303
Turn off the firewall
Systemctl Stop Firewalld
# config Geth private Genesis configuration file: Genesis.json, which describes how to initialize a private gethereum
Cd
Vim Genesis.json
# Enter the following and save to exit
{
"Nonce": "0x0000000000000042",
"Timestamp": "0x00",
"Parenthash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Extradata": "0x00",
"Gaslimit": "0x80000000",
"Difficulty": "0x400",
"Mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"Coinbase": "0x2d356ee3f5b8718d8690afcd31fe2cb5e602677e",
"Alloc": {},
"Config": {
"Chainid": 15,
"Homesteadblock": 0,
"Eip155block": 0,
"Eip158block": 0
}
}
# Create a private network Gethereum
Geth--datadir "/data/eth/ethbase/chain" Init/data/eth/genesis.json
The environment is now complete.
Deployment results
# more commonly used in the development environment of the test, you can directly start the default Geth development environment, note: Double minus, 2 and >> no space between
Geth--dev Console 2>> Geth_dev_log
# into the console actually into the Ethereum JavaScript environment, I think this is probably the great EVM (Ethereum virtual machine).
# If you want to focus on the log during the operation, you can use another SSH to observe the tail
Tail-f Geth_dev_log
#启用私有链
Geth--datadir "/data/eth/ethbase/chain"--nodiscover console 2>>eth_output.log
You can see the output log by executing tail-f eth_output.log in the current directory.