How centos7 install node.js installed Nodejs CentOS7.5 installation nodejs in CentOS7

Installation version: node-v10.15.3

 First, install the necessary software packages compiled

# yum install gcc gcc-c++ -y

Second, download the source code from Nodejs

Enter the official website select the version they need

https://nodejs.org/en/download/releases/

# wget https://nodejs.org/download/release/v10.15.3/node-v10.15.3-linux-x64.tar.gz

[root@localhost ~]# wget https://nodejs.org/download/release/v10.15.3/node-v10.15.3-linux-x64.tar.gz
--2019-08-02 16:37:28--  https://nodejs.org/download/release/v10.15.3/node-v10.15.3-linux-x64.tar.gz
Resolving nodejs.org (nodejs.org)... 104.20.22.46, 104.20.23.46, 2606:4700:10::6814:172e, ...
Connecting to nodejs.org (nodejs.org)|104.20.22.46|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18638507 (18M) [application/gzip]
Saving to: ‘node-v10.15.3-linux-x64.tar.gz’

100%[============================================================================================================================================================================>] 18,638,507  71.7KB/s   in 76s

2019-08-02 16:38:47 (240 KB/s) - ‘node-v10.15.3-linux-x64.tar.gz’ saved [18638507/18638507]

 View Download

[root@localhost ~]# ls
anaconda-ks.cfg  node-v10.15.3-linux-x64.tar.gz
[root@localhost ~]#
[root@localhost ~]# du -sh node-v10.15.3-linux-x64.tar.gz
18M     node-v10.15.3-linux-x64.tar.gz

 Third, the installation package decompression nodejs

# tar zxvf node-v10.15.3-linux-x64.tar.gz

[root@localhost ~]# ls
anaconda-ks.cfg  node-v10.15.3-linux-x64  node-v10.15.3-linux-x64.tar.gz
[root@localhost ~]# mv node-v10.15.3-linux-x64 /usr/local

Fourth, the node into the decompression folder, create soft link

Check bin file

[root@localhost ~]# cd /usr/local/
[root@localhost local]#
[root@localhost local]# ls
apache-maven-3.6.1  bin  etc  games  include  lib  lib64  libexec  node-v10.15.3-linux-x64  sbin  share  src  VMOptimizationTools  VMOptimizationTools_2.24.0  VMOptimizationToolsLinuxTemp
[root@localhost local]#
[root@localhost local]#
[root@localhost local]# cd node-v10.15.3-linux-x64/
[root@localhost node-v10.15.3-linux-x64]#
[root@localhost node-v10.15.3-linux-x64]# ls
bin  CHANGELOG.md  include  lib  LICENSE  README.md  share
[root@localhost node-v10.15.3-linux-x64]#
[root@localhost node-v10.15.3-linux-x64]# cd bin/
[root@localhost bin]#
[root@localhost bin]# ls
node  npm  npx
[root@localhost bin]#

To establish a flexible connection/usr/bin/

# ln -s /usr/local/node-v10.15.3-linux-x64/bin/node /usr/bin/node

/Usr/local/node-v10.15.3-linux-x64/bin/npm # ln -s / usr / bin / above sea level

[root@localhost bin]# ln -s /usr/local/node-v10.15.3-linux-x64/bin/node /usr/bin/node
[root@localhost bin]#
[root@localhost bin]# ln -s /usr/local/node-v10.15.3-linux-x64/bin/npm /usr/bin/npm

Five test

# Node -v

# Altitude -v

[root@localhost ~]# node -v
v10.15.3
[root@localhost ~]#
[root@localhost ~]# npm -v
6.4.1

Reference blog:

How to install Nodejs in the CentOS7

CentOS7.5 installation nodejs

Guess you like

Origin www.cnblogs.com/djlsunshine/p/11289847.html