Home > Archives > Centos 安装NodeJS

Centos 安装NodeJS

Publish:

操作步骤

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[root@iZ2ze8loow3hbkxeskzsucZ ~]# cd /usr/local/src
[root@iZ2ze8loow3hbkxeskzsucZ src]# wget https://nodejs.org/dist/v8.11.3/node-v8.11.3-linux-x64.tar.xz
[root@iZ2ze8loow3hbkxeskzsucZ src]# xz -d node-v8.11.3-linux-x64.tar.xz 
[root@iZ2ze8loow3hbkxeskzsucZ src]# tar -xvf node-v8.11.3-linux-x64.tar 
[root@iZ2ze8loow3hbkxeskzsucZ src]# cd node-v8.11.3-linux-x64/bin/
[root@iZ2ze8loow3hbkxeskzsucZ bin]# ./node -v
v8.11.3
[root@iZ2ze8loow3hbkxeskzsucZ bin]# pwd
/usr/local/src/node-v8.11.3-linux-x64/bin
[root@iZ2ze8loow3hbkxeskzsucZ bin]# vim /etc/profile

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
export JAVA_HOME=/usr/java/jdk1.8.0_131
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$PATH:/usr/local/src/node-v8.11.3-linux-x64/bin
export PATH=$PATH:$JAVA_HOME/bin

[root@iZ2ze8loow3hbkxeskzsucZ bin]# source /etc/profile
[root@iZ2ze8loow3hbkxeskzsucZ bin]# cd ~
[root@iZ2ze8loow3hbkxeskzsucZ ~]# node -v
v8.11.3
[root@iZ2ze8loow3hbkxeskzsucZ ~]# npm -v
5.6.0

参考

CentOS7 安装NodeJS

声明: 本文采用 BY-NC-SA 授权。转载请注明转自: Ding Bao Guo