Environment: CentOS6.8_X64 system
$>cd /usr/local/src #Locate this directory, the downloaded file will be in this directory
# Download using wget (this built-in command)
$>wget https://nodejs.org/dist/v8.11.3/node-v8.11.3-linux-x64.tar.xz
$>cd /usr/local/src #Navigate to this directory
$>tar xvf node-v6.9.4-linux-x64.tar.gz #Unzip the downloaded file to the current directory
$>mv node-v6.9.4-linux-x64 /usr/local/node #Move the decompression purpose to the upper directory and rename it to node
Three, NODE environment configuration
If you want to use /usr/local/node in the global directory, you need to configure the global environment. The steps are as follows:
vi /etc/profile
# Add at the bottom
# node config
export NODE_HOME=/usr/local/node
export PATH=$PATH:$NODE_HOME/bin
export NODE_PATH=$NODE_HOME/lib/node_modules
: wq (save and exit)
source /etc/profile #Make the configuration file effective
Fourth, verify the installation.
Use node -v to check the installation. The node installation package comes with npm installation, so you can also use npm -v to see the installed version of npm
[ root@VM_118_34_centos ~]# node -v
v6.9.4[root@VM_118_34_centos ~]# npm -v
3.10.10
Recommended Posts