Linux install the latest version of Node.js
As a direct yum install nodejs version is too low, so this article, we show you how to install the latest version of Node.js on Linux.
- Installation Environment
- This system: CentOS Linux release 7.5
Node.js:v10.16.0
- Get Node.js installation package
- Node.js installation package and source code download address is: https: //nodejs.org/en/download/, you can choose what you need Node.js installation package depending on the platform systems, where choice is Linux Binaries (x64).
On Linux installation Node.js
wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz // 下载
tar xf node-v10.16.0-linux-x64.tar.xz // 解压
cd node-v10.16.0-linux-x64 // 进入解压目录
bin directory under extracting file contains the node, npm commands, we can modify the linux system environment variables (profile) to set up a direct run the command:
The old rules back up, to form good habits before modifying important files to back up.
cp /etc/profile /etc/profile.bak
Then vim / etc / profile, in the bottom added export PATH = $ PATH: the path back to keep the bin directory node
export PATH=$PATH:/root/node-v10.16.0-linux-x64/bin
Effective immediately
source /etc/profile
[root@localhost ~]# node -v
v10.16.0
OK! Successful installation!