How To Deploy A Neo Node on Linux

How To Deploy A Neo Node on Linux
How to Deploy a Neo Node

Neo nodes are the backbone of the Neo network. Through this guide, we'll explore how to deploy a Neo node (Neo-CLI) on Linux and thus contribute to the network's performance and security.

What is a Neo Node?

A Neo node, commonly known as a full node, is a computer that runs the Neo software and stores all the blockchain. All the nodes on Neo can play both client and server roles.

The Neo network has two full-node programs:

Neo-CLI (Command-Line Interface):

  • Capabilities: Command-line interface, wallet features, contract features, and advanced functions.
  • Incapabilities: Import mnemonics into the wallet, query blocks/transactions/assets, custom transaction construction, and data conversion.
  • Consensus participation: Yes

Neo-GUI (Graphical User Interface)

  • Capabilities: Graphic interface, wallet features, contract features, and advanced functions.
  • Incapabilities: Generate multiple addresses and JSON-RPC.
  • Consensus participation: No

For further details, check out Neo Node Introduction.

Run a Neo Node
Run a Neo Node

Neo Node Requirements

Minimum:

  • Operating system: Windows 10, Ubuntu 16.04/18.04, or CentOS 7.4/7.6
  • CPU: Dual-core
  • Memory: 8GB
  • Hard disk: 50GB SSD hard drive

Recommended:

  • Operating system: Windows 10, Ubuntu 16.04/18.04, or CentOS 7.4/7.6
  • CPU: Quad core
  • Memory: 16GB
  • Hard disk: 100GB SSD hard drive

Optimum:

  • Operating system: Windows 10, Ubuntu 16.04/18.04, or CentOS 7.4/7.6
  • CPU: Eight core
  • Memory: 32GB
  • Hard disk: 500GB SSD hard drive

Additional tips:

  • Make sure that your computer has enough free disk space.
  • Keep your computer's operating system and software up to date.

If you are experiencing problems running Neo-CLI, you can try the following:

  • Restart your computer.
  • Update your computer's drivers.
  • Reinstall Neo-CLI.
  • Contact the Neo support team for help.

How To Deploy A Neo Node on Linux

Step 1: Install NEO-CLI Package

  • Download the latest Neo-CLI package for your operating system from the official GitHub repository and unzip it.
  • Install LevelDB and SQLite3 development packages. Use the appropriate commands based on your Linux distribution.

For Ubuntu:

sudo apt-get install libleveldb-dev sqlite3 libsqlite3-dev libunwind8-dev

For CentOS:

sudo wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm sudo yum -y install epel-release-latest-7.noarch.rpm sudo yum -y install leveldb-devel libunwind-devel libsqlite3x-devel sqlite3*

If you're using RocksDB as the storage engine, modify your config.json file as shown below:

"Storage": {   "Engine": "RocksDBStore"}

For Ubuntu 18.04 and RocksDB:

sudo apt-get install librocksdb-dev

Step 2: Publish from Source

  • Downloading and compiling the Neo-CLI source code from GitHub:

git clone https://github.com/neo-project/neo-node.git

  • Download LevelDB and unzip the package for later use.
  • Install the latest version of .NET Core Runtime on your system.
  • Use the .NET Core CLI to publish the project:

cd neo-node\neo-cli

dotnet restore

dotnet publish -c release -r <RUNTIME_IDENTIFIER>

  • Replace <RUNTIME_IDENTIFIER> with the appropriate platform RID, in this guide, linux-x64.
  • Copy the libleveldb.dll (downloaded earlier) to the output directory.

With these steps completed, you'll have Neo-CLI set up and ready for use. You can explore and interact with the NEO blockchain using the Neo-CLI command-line interface.

Step 3: Configure NEO-CLI

After successfully installing Neo-CLI, you'll need to configure it before running the node.

Modifying Configuration Files

Neo-CLI uses the config.json file for its configurations. Before you start Neo-CLI, you must customize this file based on your needs.

Configuring a Wallet

If you want Neo-CLI to automatically open a wallet when it starts, you can preconfigure the wallet details in the config.json file.

Save the Changes

Make sure to save the changes you made to the config.json file after modifying the configurations.

Starting Neo-CLI

To start Neo-CLI, follow these steps:

  • Open your terminal or command prompt.
  • Navigate to the directory where Neo-CLI is installed.
  • Run the appropriate command based on your operating system:./neo-cli

Neo-CLI will start using the configurations you've set in the config.json file.

Connecting to Networks

Apart from connecting to the N3 MainNet, you can connect to the TestNet by replacing config.json with config.testnet.json.

With the correct configurations, Neo-CLI will be ready to run with your specified settings. Always ensure that your config.json file is correctly structured and contains valid settings before starting Neo-CLI.

Step 4: Run NEO-CLI

  • To start your NEO node, first, you launch your command line interface on your operating system.
  • Use the cd command to navigate to the directory where Neo-CLI is located.
  • Run either of the following commands to start the Neo node:

./neo-cliordotnet neo-cli.dll

Note: Ensure that you have already installed .NET Core using the dotnet command before using the dotnet options.

Firewall Configuration:

If you wish to allow external programs to access the node API, you'll need to configure your firewall settings. Specifically, open the following ports: 10331-10334 and 20331-20334.

This step is crucial for enabling communication with your NEO node from external applications.

API and Wallet Security:

When you open the API service and wallet in Neo-CLI, it's essential to enhance your security by configuring your firewall policy. For instance, consider setting up a firewall whitelist that only permits access to the specified ports from trusted IP addresses.

It's advised to maintain caution when exposing your services to the external network, as unrestricted access could potentially lead to unauthorized extraction of private keys or unauthorized asset transfers via the API.

If you prefer to set up a Neo node on other operating systems, such as Windows, please navigate Neo-CLI Installation. This is also the destination to get the latest information about node setup.

Read more