Want live help from a dedicated Tech Agent?

How to install Litecoin in your server

Amal 7 months ago - Created

If you are using AWS you have to enable following port. 
Port: 16321

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-litecoin server we created for Bitcoin. 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.

Do not follow step 2 - 5 if you have installed Bitcoin. Because we are putting both coins in the same instance.

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 Litecoin Blockchain

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

sudo apt-get update
sudo apt-get upgrade 
sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils 
sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev 
sudo apt-get install libminiupnpc-dev
sudo apt-get install libzmq3-dev
git clone https://github.com/litecoin-project/litecoin.git
cd litecoin/ 
mkdir -p $BDB_PREFIX 
wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz' 
echo '12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef  db-4.8.30.NC.tar.gz' | sha256sum -c 
tar -xzvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix/
../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX 
make install 
./configure LDFLAGS="-L${BDB_PREFIX}/lib/" CPPFLAGS="-I${BDB_PREFIX}/include/" CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768" --enable-upnp-default --without-gui
sudo make install
cd src
strip litecoind
sudo nano /etc/sudoers

Go to the last line of the file and add the following line:

litecoin ALL=(ALL) ALL

Save the file by pressing Control + O. Press Enter. Exit by pressing Control + X.

sudo adduser litecoin
sudo usermod -g users litecoin
sudo delgroup litecoin
sudo chmod 0701 /home/litecoin
sudo mkdir /home/litecoin/bin
sudo cp ~/litecoin/src/litecoind /home/litecoin/bin/litecoind
sudo chown -R litecoin:users /home/litecoin/bin
su litecoin

6. Configure the Litecoin installation

1. Create a directory name .litecoin in the root directory with the following command:

mkdir .litecoin

2. Create a conf file named litecoin inside the above directory with the below command:

cd .litecoin
sudo nano litecoin.conf

3. Enter the following lines into the new files to configure this blockchain to work with our exchange script, substituting ip_address_of_bitexchange with the IP address of the server we have hosted the crypto exchange script and 32_character_alphanumeric_string with a 32 character alphanumeric password. You can use a random password generator site to generate a password if you like.

walletnotify=/var/www/html/cron/receive.sh %s

Now, save the file by pressing Control + O.

Then press Enter.

Finally, press Control + O to exit.

4. Open the rpc port we have given above:

ufw allow 22
ufw allow 80
ufw allow 443
ufw allow 16321
ufw enable
You can skip 5 - 10 if you have already installed Bitcoin.

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

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

sudo apt-get install unzip

7. Navigate to the html folder:

cd /var/www/html

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

unzip cron.zip

9. Navigate to the cfg file inside cron folder.

cd /var/www/html/cron/

10. Open the cfg.php file inside this location with the following command:

sudo nano cfg.php

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

11. Change permissions using this command:

cd .litecoin
sudo chmod 0600 litecoin.conf


7. 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 Litecoin, hence go LTC column and press Edit icon.

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

8. Configure Cron

Configure Cron to start the Litecoin daemon when the server restarts using the following commands:

sudo crontab -e

Go to the end of the file and add the following line:

*/1 * * * * /var/www/html/cron/process_bitcoin.sh

@reboot litecoind -daemon

Save by pressing Control + O.

Press Enter.

Press Control + X to exit.

9. Run Litecoin daemon 

run the Litecoin daemon using the command:

cd bin
litecoind -daemon

Then, check installation using this command:

litecoin-cli getblockchaininfo 

You have now installed Litecoin blockchain on your server.

Was this article helpful?

2 out of 2 found this helpful

Articles in this section