Want live help from a dedicated Tech Agent?

How to install Ethereum in your server

A
Amal 7 years ago - Created

If you are using AWS you have to enable following ports.
Ports: 18222, 8545, 8546, 8080, 30303

1. Login to the Droplet

We will connect to the server with the SSH key we added to the server in Step 1.

Copy your IP address we created in Step 1. We will use the same bitcoin-cash server we created for Bitcoin Cash. You’ll find your IP address here:


Enter the command below in your Terminal, substituting the your_server_ip with the IP address of your Droplet for and {path_to_serverkey} with the file path of the private SSH key we created earlier:

ssh root@your_server_ip -i {path_to_serverkey}

Hit Enter. You will be prompted to enter the passphrase we created while creating this private key. Enter the password and press Enter again.

If you are on a Mac, you might be prompted to type your keychain password.

2. Install Apache

Our next step is to install Apache. Type the following commands in the terminal:

sudo apt-get update
sudo apt-get install apache2
You will be prompted with a (Y/n). Type y and press Enter.

You have now installed Apache web server successfully.


3. Install PHP

PHP is the component of our setup that will process code to display dynamic content. It can run scripts, connect to our MySQL databases to get information and hand the processed content over to our web server to display.

Step 1: Install PHP to server Type the following commands into the terminal:

sudo apt-get install php7.0 libapache2-mod-php php-mcrypt php-mysql php-gd php-bcmath
You will be prompted with a (Y/n). Type y and press Enter.

This should install PHP without any problems.

Change the location of index.php

To do this, type this command to open the dir.conf file in a text editor with root privileges:

sudo nano /etc/apache2/mods-enabled/dir.conf

Inside of the file will look like this:

DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm

We want to move the index.php file above to the first position after the DirectoryIndex, like this:

DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm

When you are finished, Press Control + O to save.

And press Enter.

Then press Control + X to exit.

You have now installed PHP successfully.


4. Install CLI and CURL

To do this, type the following command into your Terminal:

sudo apt-get install php-cli php-curl curl
You will be prompted with a (Y/n). Type y and press Enter.

You have now installed CLI and CURL successfully.


5. Install Node using NVM

Next, we install Node.js on the server to run cron.

Type the following commands in the Terminal one by one:

sudo apt-get update
sudo apt-get install build-essential libssl-dev
You will be prompted with a (Y/n). Type 'y' and press Enter.
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh -o install_nvm.sh
bash install_nvm.sh
source ~/.profile
nvm install 8

You have now installed Node successfully.


6. Install Ethereum Blockchain

Run the following commands one by one to install Ethereum Daemon.

sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum -y 
You will be prompted with a (y/n). Enter 'y' to continue.

7. Configure the Ethereum installation 

1. Run Ethereum using the following command:

geth

2. Create a folder .ethereum with the following command:

mkdir .ethereum

3. Go to the directory with name .ethereum with the following command:

cd .ethereum

4. Create and open the toml file named config inside the above directory with the below command:

sudo nano /root/.ethereum/config.toml

5. Add the following lines:

Replace your_exchange_IP_address with the IP address of your main exchange .
[Eth]  
NetworkId = 3  
SyncMode = "fast"  
LightPeers = 100  
DatabaseCache = 768  
GasPrice = 18000000000  
EnablePreimageRecording = false 
   
[Eth.Ethash]  
CacheDir = "ethash"  
CachesInMem = 2  
CachesOnDisk = 3  
DatasetDir = "/root/.ethash"  
DatasetsInMem = 1  
DatasetsOnDisk = 2  
PowMode = 0    
[Eth.TxPool]  
NoLocals = false  
Journal = 
"transactions.rlp"  
Rejournal = 3600000000000  
PriceLimit = 1  
PriceBump = 10  
AccountSlots = 16  
GlobalSlots = 4096  
AccountQueue = 64  
GlobalQueue = 1024  
Lifetime = 10800000000000    

[Eth.GPO]  
Blocks = 20  
Percentile = 60    

[Shh]  
MaxMessageSize = 1048576  
MinimumAcceptedPOW = 2e-01    

[Node]  
DataDir = "/root/.ethereum/testnet"  
IPCPath = "geth.ipc"  
HTTPHost = "0.0.0.0"  
HTTPPort = 18222  
HTTPCors = ["*"]  
HTTPVirtualHosts = ["your_exchange_IP_address"]  
HTTPModules = ["net", "web3", "eth", "shh", "personal"]  
WSHost = "127.0.0.1"  
WSPort = 8546  
WSOrigins = ["*"] 
WSModules = ["net", "web3", "eth", "shh", "personal"]    

[Node.P2P]  
MaxPeers = 25  
NoDiscovery = false  
BootstrapNodes = ["enode://30b7ab30a01c124a6cceca36863ece12c4f5fa68e3ba9b0b51407ccc002eeed3b3102d20a88f1c1d3c3154e2449317b8ef95090e77b312d5cc39354f86d5d606@52.176.7.10:30303", "enode://865a63255b3bb68023b6bffd5095118fcc13e79dcf014fe4e47e065c350c7cc72af2e53eff895f11ba1bbb6a2b33271c1116ee870f266618eadfc2e78aa7349c@52.176.100.77:30303", "enode://6332792c4a00e3e4ee0926ed89e0d27ef985424d97b6a45bf0f23e51f0dcb5e66b875777506458aea7af6f9e4ffb69f43f3778ee73c81ed9d34c51c4b16b0b0f@52.232.243.152:30303", "enode://94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09@192.81.208.223:30303"]  
BootstrapNodesV5 = ["enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303", "enode://343149e4feefa15d882d9fe4ac7d88f885bd05ebb735e547f12e12080a9fa07c8014ca6fd7f373123488102fe5e34111f8509cf0b7de3f5b44339c9f25e87cb8@52.3.158.184:30303", "enode://b6b28890b006743680c52e64e0d16db57f28124885595fa03a562be1d2bf0f3a1da297d56b13da25fb992888fd556d4c1a27b1f39d531bde7de1921c90061cc6@159.89.28.211:30303"]  
StaticNodes = []  
TrustedNodes = []  
ListenAddr = ":30303"  
EnableMsgEvents = false    

[Dashboard]  
Host = "localhost"  
Port = 8080  
Refresh = 5000000000

Now, save the file by pressing Control + O.

Then press Enter.

Finally, press Control + O to exit.

6. Open the rpc port we have given above:

ufw allow 18222
ufw allow 8546
ufw enable

7. Next let’s install screen to run geth in the background:

sudo apt-get install screen

8. Open a new screen with the below command:

screen -S ethereum 

9. A new screen will be created. Enter the following lines in the screen:

geth -config=root/.ethereum/config.toml

And click ENTER. Geth will start to run. 

10.  Detach (minimize) the screen by pressing - CTRL+A and CTRL+D.

11. To re-open the screen to verify at any point if geth is running:

Screen -r ethereum 

10. Now, connect to your server using Filezilla using the IP address of the Ethereum droplet. Drag and drop the eth_changes.zip you have downloaded to the /var/www/html/ folder in your Ethereum droplet using Filezilla:

11. Now go to your Terminal and install Unzip by running the following command:

sudo apt-get install unzip

12. Navigate to the html folder:

cd /var/www/html

13. And type the unzip command in your Terminal and press Enter.

unzip eth_changes.zip

14. Navigate to the Ethereum_Notify folder.

cd /var/www/html/eth_changes/Ethereum_Notify 


Update the dbname and dbpass values like we did in Step 6. Save and close the file.



8. Configure admin panel to receive updates

1. Login to your admin panel by visiting admin.yourexchangedomain.com. If you haven't changed the password, the default credential is 

Username: admin

Password: DminaDminaDmina


2. Go to Currencies>Cryptocurrency Wallets.

3. We are configuring Ethereum, hence go ETH column and press Edit icon.


4. Update the connection to Daemon fields with the values you have given in your config.toml file and press Save.



9. Configure Cron to run in the background

1. For running wallet notify script in background we will have to install web3, mysql and forever. Run the below commands one by one :

npm install web3
npm install mysql 
npm -g install forever 

2. Run wallet notify script:

forever start eth_wallet_notify.js 

3. To check forever logs:

forever logs
tail -f /root/.forever/xxxx.log

(xxx will be a random alphanumeric value. You will see the name when you check with forever logs command)

4. Now goto your exchange and Under “Crypto Address” create a wallet address for ethereum. If you are able to generate a wallet address successfully, then the output in the forever logs will be like below with the wallet address:

[ '0xC3Bead1754f6aB174A4A1132CdfdEb213AB0e516' ] 

You have now installed Ethereum blockchain on your server.

Was this article helpful?

2 out of 8 found this helpful

Articles in this section