CentOS7安装nodeJs
1、进入NodeJs官网,获取到nodeJs的安装地址(在linux下的安装地址)
附上地址:https://npm.taobao.org/mirrors/node/v15.5.0/
我这里安装的是15.5版本的。
2、然后将下载下来的tar文件拷贝到centos服务器上
- 建议使用XFTP上传,如果直接拖动的服务器上,可能导致解压缩的时候会失败
3、在linux下进行安装NodeJs
- 解压文件
[root@localhost node]# tar -zxvf node-v15.5.0-linux-x64.tar.gz
node-v15.5.0-linux-x64/include/node/openssl/archs/VC-WIN64-ARM/no-asm/
node-v15.5.0-linux-x64/include/node/openssl/archs/VC-WIN64-ARM/no-asm/crypto/
node-v15.5.0-linux-x64/include/node/openssl/archs/VC-WIN64-ARM/no-asm/crypto/include/
node-v15.5.0-linux-x64/include/node/openssl/archs/VC-WIN64-ARM/no-asm/crypto/include/internal/
node-v15.5.0-linux-x64/include/node/openssl/archs/VC-WIN64-ARM/no-asm/crypto/include/internal/bn_conf.h
node-v15.5.0-linux-x64/include/node/openssl/archs/VC-WIN64-ARM/no-asm/crypto/include/internal/dso_conf.h
node-v15.5.0-linux-x64/include/node/openssl/archs/VC-WIN64-ARM/no-asm/crypto/buildinf.h
node-v15.5.0-linux-x64/include/node/openssl/archs/VC-WIN64-ARM/no-asm/include/
node-v15.5.0-linux-x64/include/node/openssl/archs/VC-WIN64-ARM/no-asm/include/openssl/
node-v15.5.0-linux-x64/include/node/openssl/archs/VC-WIN64-ARM/no-asm/include/openssl/opensslconf.h
node-v15.5.0-linux-x64/include/node/openssl/archs/VC-WIN64-ARM/no-asm/include/progs.h
node-v15.5.0-linux-x64/include/node/openssl/bn_conf.h
node-v15.5.0-linux-x64/include/node/openssl/dso_conf.h
node-v15.5.0-linux-x64/include/node/openssl/opensslconf.h
node-v15.5.0-linux-x64/include/node/openssl/bn_conf_asm.h
node-v15.5.0-linux-x64/include/node/openssl/bn_conf_no-asm.h
node-v15.5.0-linux-x64/include/node/openssl/dso_conf_asm.h
node-v15.5.0-linux-x64/include/node/openssl/dso_conf_no-asm.h
node-v15.5.0-linux-x64/include/node/openssl/opensslconf_asm.h
node-v15.5.0-linux-x64/include/node/openssl/opensslconf_no-asm.h
node-v15.5.0-linux-x64/include/node/zconf.h
node-v15.5.0-linux-x64/include/node/zlib.h
node-v15.5.0-linux-x64/README.md
node-v15.5.0-linux-x64/LICENSE
node-v15.5.0-linux-x64/CHANGELOG.md
- 配置系统环境变量
[root@localhost bin]# vim /etc/profile
在profile文件中末尾,添加node的环境变量
# setting nodejs path
export NODE_HOME=/opt/node/node-v15.5.0-linux-x64
export PATH=$NODE_HOME/bin:$PATH
然后保存退出
- 使环境变量生效
[root@localhost bin]# source /etc/profile
4、验证是否安装成功
[root@localhost /]# node -v
v15.5.0
[root@localhost /]# npm -v
7.3.0
出现上述结果证明安装成功!
努力有用的话,还要天才做什么呢?