How to Install Bitcoin full node on Ubuntu Server?

How to Install Bitcoin full node on Ubuntu Server?

In this how to tutorial, Let’s see how to install Bitcoin daemon full node wallet on a Ubuntu server.

Basic Requirements for bitcoin installation on ubuntu server:

  1. Minimum OS required – Ubuntu 16.04 OS
  2. Space required – minimum 400 GB. SSD hard disk recommended.
  3. RAM – Minimum 4GB ram server is required.

1. Install Apache

Make sure you have installed Apache or nginx on your server before starting with the installation. Type the below commands to install Apache on ubuntu server:

sudo apt-get update
sudo apt-get install apache2

You will be requested to enter Y/N. Type Y to proceed with the installation

install apache2 ubuntu

2. Installing Bitcoin Blockchain

Download PPA repository by running the below command from home/root directory (Type cd ~ )

sudo add-apt-repository ppa:luke-jr/bitcoincore

When prompted, click ENTER key to proceed with the installation.

bitcoincore ppa
sudo apt-get update
sudo apt-get install bitcoind

When prompted, type Y to proceed with the installation.

install bitcoin full node blockchain

3. Setting up Bitcoin Configuration

A. Creating .bitcoin folder in root directory.

Run the following command to check if you are in the root directory:

cd ~

Then run the following command to create the .bitcoin directory. For starters: mkdir stands for make directory. And and dot folder means it is a hidden folder. You can not view the folder normally with ls command and you need to use ls-a command to view the hidden folder.

mkdir .bitcoin

change or move into the newly created directory using the below command:

cd .bitcoin

B. Setting config file

Creating the config file. In this tutorial i am using nano editor in ubuntu. You can also use vi editor if you wish. Run the below command to create the file:

sudo nano bitcoin.conf

You will see an editor like in the below screenshot:

Copy the below configuration and paste it in the text editor:


and click ctrl+X. Prompt will ask you to save and exit. Type Y and hit enter. Your configuration file is saved now.

bitcoin configuration

Let’s see about these configurations now.

  1. Server = 1 or 0 means -> Bitcoin server to accept JSON-RPC command or Not. 1 Stands for accepting.
  2. rpcport -> This is the tcp port which we setup for allowing rpc connections
  3. rpcuser -> An username will be required to setup for accessing the JSON-RPC Apis.
  4. rpcpassword -> Similarly a password will be required to setup for accessing the JSON-RPC Apis. The RPC Password can be any random alphanumeric number. 32 character is recommend for security purposes. You can generate one from HERE.
  5. testnet=1 -> If enabled as 1, the bitcoin network will access the bitcoin testnet network. If entered as 0 or if the config is removed, by default the bitcoind will connect to the mainnet. Connecting to bitcoin testnet will be helpful for testing purposes.

There are more configurations which you can do. Lets see more in detail about it in upcoming articles.

C. Setting up Firewall

Run the below commands to open the required ports and to turn on ubuntu default firewall.

Enabling SSH port with Firewall –

sudo ufw allow 22

Enabling HTTP port with Firewall –

sudo ufw allow 80

Enabling HTTPS port with Firewall –

sudo ufw allow 443

Enabling our RPC port with Firewall. make sure you give the same port number as you have given in conf file.

sudo ufw allow 18523

Finally enable Firewall –

sudo ufw enable
setting up firewall for bitcoin blockchain

D. Configuring Cron

Run the below command to make sure bitcoind continues to run when server is restarted:

sudo crontab -e

Type 1 and hit enter. Next in the editor goto the last and paste it in a new line.

@reboot bitcoind -daemon
sudo crontab -e

Finally the setup is now done. Lets start the bitcoin server and access the wallets.

4. Starting Bitcoin Blockchain

Run the below daemon command to initialize bitcoin blockchain in background:

bitcoind -daemon
bitcoind daemon

We will have to wait for the blockchain to complete downloading and sync with the current block to send and receive transactions. The blocks and headers number will be equal in numbers when the blockchain is downloaded and in sync.

Use the below JSON-RPC commands to interact with the bitcoin blockchain:

  1. bitcoin-cli getblockchaininfo -> Gives complete detail of the blockchain status
  2. bitcoin-cli getwalletinfo -> Gives complete detail of the wallet – balance etc.
  3. bitcoin-cli getnewaddress -> Creates a new address.

Complete of bitcoin-cli commands can be found from HERE

bitcoin-cli getblockchaininfo

Note that when you do getblockchaininfo, you see that the blocks and headers are not in sync initially

bitcoin-cli getbwalletinfo

Alright! You are all ready now. You have successfully completed bitcoin installation on ubuntu server successfully. Let me know in comments if you face any issue in the above steps.

Written by
Yokesh Sankar
Join the discussion

Yokesh Sankar

Technical Consultant - Blockchain Advisor - Project Manager

Project Consulting

Are you looking to kickstart your new software project? Get in touch with me for technical consulting.

1. We will discuss your project scope
2. Project roadmap
3. Prepare Project Scope Document
4. UI/UX Design and Prototype consulting
5. Tech Stack Planning

Reach to know more.

Get In Touch