XMR/USD
$XMR
XMR 1 HR
24HR Change
XMR
Price
$XMR
Market Cap
$XMR

How to use Monero using Linux – Installing and setting up a full Monero node on Linux

> Tutorial > How to use Monero using Linux – Installing and setting up a full Monero node on Linux

Introduction

Setting up a full node from source is not as hard as it seems if you have the necessary knowledge of the Linux command line.

It’s also worth mentioning again that running a full node is not anonymous, and it’s not even supposed to be. You are part of a network, and you have to be “discoverable,” so your IP address (and only this) will be visible to the network.

Here are the necessary steps required to use Monero on Linux, meaning installing and setting up a full Monero node.

 

Updating the operating system

First, you will have to update the system packages:

sudo apt update && sudo apt-get upgrade

 

Installing dependencies

Now, you will have to make sure that you have git installed. If you don’t have it installed, now it’s the time to do it.

sudo apt install git

After that, you will have to install the rest of dependencies:

sudo apt install build-essential cmake doxygen graphviz miniupnpc pkg-config libboost-all-dev libcurl4-openssl-dev libgtest-dev libminiupnpc-dev libreadline-dev libssl-dev libunbound-dev libunwind8-dev libzmq3-dev

It’s important to note that libgtest-dev doesn’t come as binary on Ubuntu, so you’ll have to compile it yourself:

cd /usr/src/gtest

sudo cmake .

sudo make -j2

sudo mv libg* /usr/lib/

 

Downloading and building Monero

First of all, create a source directory if you have not already created one.

mkdir ~/source

cd ~/source

After that, clone the repository and its submodules. This may take a while to compile, depending on the system that you currently own.

git clone --recursive https://github.com/monero-project/monero

cd monero

make -j2 release # -j4 for 4 threads etc

When you’re finished, copy all the binaries to /usr/local/bin.

sudo cp ./build/release/bin/* /usr/local/bin/

 

Setting up the service

Make sure that you edit the file to match the environment. You will have to raise block-sync-size to a higher number if you own a decent system. You can also omit this entirely and let the daemon decide automatically.

Next, create a config file:

mkdir ~/.bitmonero

cd ~/.bitmonero

touch monerod.conf

and add these lines:

echo "data-dir=/home/satoshi/.bitmonero" >> monerod.conf

echo "log-file=/home/satoshi/.bitmonero/monero.log" >> monerod.conf

echo "log-level=0" >> monerod.conf

You will also have to decide if you want to be able to connect your wallet from a different machine, because if you do, you will have to add the following:

echo "rpc-bind-ip=0.0.0.0" >> monerod.conf

echo "rpc-bind-port=18081" >> monerod.conf

echo "rpc-login=veryLongAndRandomUsername:veryLongAndRandomPassword" >> monerod.conf

 

Running the service

Now, you will have to enable the system config and start the daemon.

sudo systemctl enable monerod

sudo service monerod start

It’s important to understand that the sync may take a few hours and even a few days, depending on the hardware that you own. You will have to be patient.

 

Allowing incoming connections

You will be able to allow two types of incoming connections to your node: P2P and RPC. The first incoming connection will let other nodes download the chain for you and the second one will allow a wallet to connect to your node and retrieve info about the balance, transactions and more.

For the P2P connection you will have to run the following command:

sudo iptables -I INPUT -p tcp --dport 18080 -j ACCEPT

For the RPC connection, please run this command:

sudo iptables -I INPUT -p tcp --dport 18081 -j ACCEPT

You will have to save the rules permanently:

sudo iptables-save

If you’re behind a router, you will have to forward the ports to your system, and for this, we recommend that you refer to your router’s manual.

 

Connecting to the node with your wallet

Now, it’s time to test your connection from your wallet. If you use the GUI wallet, you will have to head over to Settings and fill out Address and Port.

Under Manage Daemon click Show Advanced and type in the RPC login that you have previously set in ~/.bitmonero/monerod.conf earlier.

If you are using the command line wallet you will be able to start it with the following command:

monero-wallet-cli --wallet-file /path/to/your/wallet --trusted-daemon --daemon-address ip.of.your.node:18081 --daemon-login veryLongAndRandomUsername:veryLongAndRandomPassword

It’s important to note that the command line wallet is much cleaner and all that you will need will be only three or four commands.

Here are the ones that you will probably have to use the most:

  • show_transfers to view the list of all transactions
  • integrated_address to get a receiving address containing a payment ID
  • balance to view locked and unlocked balance
  • transfer <address> <amount> to make a payment

Type help to access the list of all commands.

 

Closing words

You can make your node more secure and anonymous, and for this, you will have to run it behind torify or torsocks.


Leave a Reply

Your email address will not be published. Required fields are marked *