Starting from this section, all commands need to be executed in the terminal program. If you want to learn the basic usage of the terminal, please move on Here。
Because different readers use different operating systems and users who log in to the operating system, the installation preparation and installation steps may be slightly different. Here are two options based on whether the user (that is, you) logged in to the system is an administrator (root). The installation steps are roughly the same:
- Install Node.js: get
npmThese two executable programs
- Install Forge CLI: Get
- Check if the installation was successful
The way to determine your identity on a Linux system is to execute:
whoamiIf the result is not
rootIt means you are not
For users using the Forge CLI on a cloud host. Because
root User-installed tools can usually be shared by other users in the system, so the above steps can be used
root Identity goes to completion.
Because Forge CLI is developed using Node.js, you need to ensure that you have a Node.js runtime environment on your computer before installation. The easiest way to check if a Node.js runtime environment exists is:
If both commands have normal output (no
command not found And other words and the output is not empty), it means that your computer already has the Node.js runtime environment.
After installing the Node.js environment, you can directly execute the following command to install, pay attention to the--unsafe-perm It's required.
forge --versionIf the version number of Forge CLI is output, the installation is successful.
Although you can install Forge CLI as root, you cannot execute any Forge CLI subcommands as root, and you cannot use root to create and start chain nodes. This is a security limitation of Forge. So in order to perform subsequent operations, we need to prepare a non-root identity:
Suppose the system account we want to use to execute the Forge CLI is named
arcblockCan be divided into two steps:
- Create user: execute
adduser arcblockTo add users
- Switch user: execute
su arcblockTo switch to that user
Next, you can follow the tutorial Coin Issue。
The process of installing ForgeCLI under CentOS is as follows:
For Mac systems or Linux systems with a graphical interface, the logged-in user is usually not root, and both Node.js and Forge CLI can be installed in the user's own directory.
It is recommended that such users directly use NVM to install Node.js. NVM can automatically help you choose the version corresponding to your system. Here are the basic steps to install NVM first, and then install Node.js v10.16.3 using NVM and Taobao sources:
After the Node.js environment is installed, you can directly install the Forge CLI with the following command:
After the installation is complete, there will be one more in your system.
forge Command line tool (The command generated after the Forge CLI installation is called
forge Instead of
forge-cli), Execute directly
forge, No error is reported and you get the following output, indicating that you have successfully installed:
The entire process of installing Node.js and Forge CLI as a non-root account is as follows:
The Forge CLI enables the automatic check for updates by default. When there is a new version, you will be prompted to update. If you do not pass Global configurationTurn off automatic check for updates and follow the prompts. If you need to update manually, you can override the update by executing the exact same command as installing.
- If you are using
rootFor account installation, switch to
rootIdentity and then execute:
npm install -g @arcblock/forge-cli --unsafe-perm
- If you are not using
rootFor account installation, execute directly under the corresponding account:
npm install -g @arcblock/forge-cliJust
If you use
yarn After installation, execute
forge The error is reported. The high probability is because
grpc Library is not compiled successfully locally, at this time please try to use
npm Go to install.
TODO: Need to update here
Can't wait to use the Forge CLI to send chains and coins? Continue to look down.