Skip to content

Instantly share code, notes, and snippets.

@jpitts
Last active September 28, 2019 16:29
Show Gist options
  • Save jpitts/b4984fff70bdfba54282 to your computer and use it in GitHub Desktop.
Save jpitts/b4984fff70bdfba54282 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Build and Run Ethereum on CentOS using Terminal.com
# For geth 1.0.0 "frontier", relevant around late July, 2015
#
# These instructions are for building geth and dependencies from scratch
# (should the normal ways of getting it going fail you)
#
# The following are installed:
# - go
# - python
# - python-pip
# - bitcoin
# - mk_genesis_block.py
# - go-ethereum
#
#
# IMPORTANT NOTE: this is documentation and each command should be run by hand
echo "This is documentation; try running the commands one at a time in your terminal."
exit 0
# Step 1: Set Up Terminal
# ------------------------------------------------------------------------------
# - SEE: https://terminal.com/
# Create an account on terminal.com if you don't have one
# Go to "Public Snaps"
# on "Official CentOS 6" click "Try It"
# all commands from now on to be run in your terminal
# your ethereum workspace will be /opt
mkdir -p /opt
cd /opt
# Step 2: Install Ethereum
# ------------------------------------------------------------------------------
# install: go
# - install go dependencies
yum install gcc
# - SEE: https://golang.org/doc/install
cd /opt
wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz
tar -zxvf go1.4.2.linux-amd64.tar.gz
ls go
cd go/src
./all.bash
# - add the following to your ~/.bashrc:
export GOROOT=/opt/go
export PATH=$PATH:$GOROOT/bin
# - load go into your path (it will be there every time you log in as well)
source ~/.bashrc
echo $GOROOT
go
# next install: go-ethereum
# - SEE: https://github.com/ethereum/go-ethereum
# - SEE: https://github.com/ethereum/go-ethereum/wiki/Installation-Instructions-for-Ubuntu
# - install go-ethereum dependencies
yum install gmp-devel
yum install git
# - download and make go-ethereum
cd /opt
git clone https://github.com/ethereum/go-ethereum
cd go-ethereum
make geth
# Step 3: Set Up Genesis Block
# ------------------------------------------------------------------------------
# NOTE: genesis-block seems to be having issues with the version of python in this centos
cd /opt
# first install: the latest python
python --version
yum --showduplicates list python | expand
# - will have to build a newer python
# - install important dependencies for python (later used in building pip)
yum install zlib-devel
yum install openssl-dev
mkdir python
wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
tar -zxvf Python-2.7.10.tgz
cd Python-2.7.10
./configure
make
# make test
make altinstall prefix=/opt/python exec-prefix=/opt/python
/opt/python/bin/python2.7 --version
# should now be 2.7.10
# next install: python pip
# NOTE: this is python's package manager
wget https://bootstrap.pypa.io/get-pip.py
/opt/python/bin/python2.7 ./get-pip.py
# next install: bitcoin
/opt/python/bin/pip install bitcoin
# finally install: genesis-block
# SEE: https://blog.ethereum.org/2015/07/27/final-steps/
cd /opt
mkdir genesis-block
cd genesis-block
wget https://raw.githubusercontent.com/ethereum/genesis_block_generator/master/mk_genesis_block.py
/opt/python/bin/python2.7 mk_genesis_block.py > genesis_block.json
ls genesis_block.json
# Step 4: Run Ethereum
# ------------------------------------------------------------------------------
cd /opt
# run: geth w/ the genesis block
cd go-ethereum
./build/bin/geth --genesis ../genesis-block/genesis_block.json console
# geth should be running now
# SEE: https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console
# SCROLL DOWN TO: https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console#personal
# some commands to try:
# > admin.nodeInfo
# > admin.peers
# > admin.chainSyncStatus
# > personal.listAccounts
# run the server w/o console:
# ./build/bin/geth --genesis ../genesis-block/genesis_block.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment