How to Install Forge on CentOS Linux

This guide will show you how to install Forge on a machine running CentOS Linux.

Note: Do not run Forge on CentOS Linux 6 (or earlier).

Step 1: Set Up Your Users

Notes:

  • You can skip this step if you are already a sudo user.
  • If you are using a cloud-hosted version of CentOS Linux, your installation may already come with a root user. If so, you'll need to disable it.

To create a sudo user called arcblock (or the name of your choice) and add it to the wheel group of the sudoers file, run:

Next, run visudo to allow the wheel group to run sudo commands without having to prompt the user for their password:

At this point, switch to this sudo user.

If you've previously created an SSH connection to the host using the root account, you can switch the user over to your sudo user arcblock using:

Step 2: Install Common Dependencies

The standard installation of CentOS Linux is missing several dependencies on which Forge relies. The following command will install all of the dependencies that are typically missing:

Step 3: Install Node.js

Force CLI requires Node.js, which is available in the NodeSource Node.js Binary Distributions repository. In short, the command to run is as follows (be sure to update the version number indicated):

Once the process is complete, check the Node.js version installed:

While Node.js ships with the npm package manager, we recommend that you install the yarn package manager as well:

Step 4: Install the Forge CLI

Using Yarn, install the Forge CLI:

Step 5: Add a Non-Privileged User

We don't recommend running Forge using a sudo user, so create a new non-privileged user (in this case, we'll call it forge) and add a proper path so that it is accessible:

Use the sudo user arcblock SSH to the host and install assets whenever necessary. Otherwise, use the non-privileged forge user to run the CLI.

Switch to the forge user with sudo su forge and check if Forge CLI is installed successfully with forge -h:

🎉 Forge CLI has been installed successfully! Checkout Quickstart to launch your chain!