Node.js installation configuration

In this chapter we will show you how to install Node.js on Windows and Linux.

This installation tutorial uses Node.js v16.9.0 LTS (Long Term Support Version) version as an example.

The Node.js installation package and source code download address is: 

You can choose the Node.js installation package you need according to different platform systems.

Node.js historical version download address:

Note: Python 2.6 or 2.7 is required to install Node.js on Linux. It is not recommended to install Python 3.0 or above.

Install Node.js on Windows

You can install it in the following two ways.

1. Windows installation package (.msi)

The example in this article takes version v0.10.26 as an example. Other versions are similar. Installation steps:

Step 1: Double-click the downloaded installation package v0.10.26 , as shown below:

Step 2 : Click Run above, the following interface will appear:

Step 3 : Tick the option to accept the agreement and click the next button :

Step 4: The default installation directory of Node.js is “C:\Program Files\nodejs\”, you can modify the directory and click next:

Step 5 : Click the tree icon to select the installation mode you need, then click next (next)

Step 6: Click Install to start installing Node.js. You can also click Back to modify the previous configuration. Then and click next.

Step 7: Click the Finish button to exit the installation wizard

Check whether the PATH environment variable is configured with Node.js, click Start = “Run = “Enter “cmd” => Enter the command “path”.

Install Node.js on Linux

Use the compiled package directly

Node official website has changed the linux download version to the compiled version, we can directly download and decompress it and use it:

# wget // download
# tar xf node-v10.9.0-linux-x64.tar.xz // decompress
# cd node-v10.9.0-linux-x64/ // Enter the decompression directory
# ./bin/node -v // Execute the node command to view the version

The bin directory of the decompressed file contains commands such as node and npm. We can use the ln command to set up a soft connection:

ln -s /usr/software/nodejs/bin/npm /usr/local/bin/ 
ln -s /usr/software/nodejs/bin/node /usr/local/bin/

Install Node.js from Ubuntu Source

In the following sections we will introduce installing Node.js from source under Ubuntu Linux. Other Linux systems, such as Centos, are similar to the following installation steps.

Get the Node.js source code on Github:

$ sudo git clone
Cloning into 'node'...

Modify directory permissions:

$ sudo chmod -R 755 node

Use ./configure to create the build file and follow:

$ cd node
$ sudo ./configure
$ sudo make
$ sudo make install

Check node version:

$ node --version

Ubuntu apt-get command installation

The command format is as follows:

sudo apt-get install nodejs
sudo apt-get install npm

Install Node.js from source under CentOS

1. To download the source code, you need to download the latest Nodejs version at . This article takes v0.10.24 as an example:

cd /usr/local/src/

2. Unzip the source code

tar zxvf node-v0.10.24.tar.gz

3. Compile and install

cd node-v0.10.24
./configure --prefix=/usr/local/node/0.10.24
make install

4. Configure NODE_HOME, enter profile to edit environment variables

vim /etc/profile

Set the nodejs environment variable and add the following above the export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL line:

#set for nodejs
export NODE_HOME=/usr/local/node/0.10.24
export PATH=$NODE_HOME/bin:$PATH

:wq save and exit, compile /etc/profile to make the configuration take effect

source /etc/profile

Verify that the installation configuration is successful

node -v

The output v0.10.24 indicates that the configuration is successful

npm module installation path


Note: Nodejs official website provides compiled Linux binary package, you can also download it and apply it directly.

Install on Mac OS

You can install node on Mac OS in two ways:

  • 1. Download the pkg installation package from the official download website and click to install it directly.
  • 2. Use the brew command to install:brew install node