Centos7安装NVM
安装
[root@localhost ~]# curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 12540 100 12540 0 0 98 0 0:02:07 0:02:07 --:--:-- 3575
=> Downloading nvm as script to '/root/.nvm'
=> Appending nvm source string to /root/.bashrc
=> Appending bash_completion source string to /root/.bashrc
=> You currently have modules installed globally with `npm`. These will no
=> longer be linked to the active version of Node when you install a new node
=> with `nvm`; and they may (depending on how you construct your `$PATH`)
=> override the binaries of modules installed with `nvm`:
/root/node-v10.13.0-linux-x64/lib
└── nvm@0.0.4
=> If you wish to uninstall them at a later point (or re-install them under your
=> `nvm` Nodes), you can remove them from the system Node as follows:
$ nvm use system
$ npm uninstall -g a_module
=> Close and reopen your terminal to start using nvm or run the following to use it now:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
[root@localhost ~]#
安装失败
- 更新nss和curl
[root@localhost ~]# sudo yum update nss curl
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.bfsu.edu.cn
* epel: mirrors.bfsu.edu.cn
* extras: mirrors.bfsu.edu.cn
* updates: mirrors.bfsu.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package curl.x86_64 0:7.29.0-35.el7.centos will be updated
---> Package curl.x86_64 0:7.29.0-59.el7_9.1 will be an update
--> Processing Dependency: libcurl = 7.29.0-59.el7_9.1 for package: curl-7.29.0-59.el7_9.1.x86_64
---> Package nss.x86_64 0:3.21.0-17.el7 will be updated
--> Processing Dependency: nss = 3.21.0-17.el7 for package: nss-sysinit-3.21.0-17.el7.x86_64
--> Processing Dependency: nss(x86-64) = 3.21.0-17.el7 for package: nss-tools-3.21.0-17.el7.x86_64
---> Package nss.x86_64 0:3.53.1-3.el7_9 will be an update
--> Processing Dependency: nss-util >= 3.53.1-1 for package: nss-3.53.1-3.el7_9.x86_64
--> Processing Dependency: nss-softokn(x86-64) >= 3.53.1-2 for package: nss-3.53.1-3.el7_9.x86_64
--> Processing Dependency: nspr >= 4.25.0 for package: nss-3.53.1-3.el7_9.x86_64
--> Processing Dependency: nss-pem(x86-64) for package: nss-3.53.1-3.el7_9.x86_64
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.39)(64bit) for package: nss-3.53.1-3.el7_9.x86_64
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.38)(64bit) for package: nss-3.53.1-3.el7_9.x86_64
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.31)(64bit) for package: nss-3.53.1-3.el7_9.x86_64
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.24)(64bit) for package: nss-3.53.1-3.el7_9.x86_64
--> Running transaction check
---> Package libcurl.x86_64 0:7.29.0-35.el7.centos will be updated
---> Package libcurl.x86_64 0:7.29.0-59.el7_9.1 will be an update
--> Processing Dependency: libssh2(x86-64) >= 1.8.0 for package: libcurl-7.29.0-59.el7_9.1.x86_64
---> Package nspr.x86_64 0:4.11.0-1.el7_2 will be updated
---> Package nspr.x86_64 0:4.25.0-2.el7_9 will be an update
---> Package nss-pem.x86_64 0:1.0.3-7.el7 will be installed
---> Package nss-softokn.x86_64 0:3.16.2.3-14.4.el7 will be updated
---> Package nss-softokn.x86_64 0:3.53.1-6.el7_9 will be an update
--> Processing Dependency: nss-softokn-freebl(x86-64) >= 3.53.1-6.el7_9 for package: nss-softokn-3.53.1-6.el7_9.x86_64
---> Package nss-sysinit.x86_64 0:3.21.0-17.el7 will be updated
---> Package nss-sysinit.x86_64 0:3.53.1-3.el7_9 will be an update
---> Package nss-tools.x86_64 0:3.21.0-17.el7 will be updated
---> Package nss-tools.x86_64 0:3.53.1-3.el7_9 will be an update
---> Package nss-util.x86_64 0:3.21.0-2.2.el7_2 will be updated
---> Package nss-util.x86_64 0:3.53.1-1.el7_9 will be an update
--> Running transaction check
---> Package libssh2.x86_64 0:1.4.3-10.el7_2.1 will be updated
---> Package libssh2.x86_64 0:1.8.0-4.el7 will be an update
---> Package nss-softokn-freebl.x86_64 0:3.16.2.3-14.4.el7 will be updated
---> Package nss-softokn-freebl.x86_64 0:3.53.1-6.el7_9 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================================
Updating:
curl x86_64 7.29.0-59.el7_9.1 updates 271 k
nss x86_64 3.53.1-3.el7_9 updates 869 k
Installing for dependencies:
nss-pem x86_64 1.0.3-7.el7 base 74 k
Updating for dependencies:
libcurl x86_64 7.29.0-59.el7_9.1 updates 223 k
libssh2 x86_64 1.8.0-4.el7 base 88 k
nspr x86_64 4.25.0-2.el7_9 updates 127 k
nss-softokn x86_64 3.53.1-6.el7_9 updates 354 k
nss-softokn-freebl x86_64 3.53.1-6.el7_9 updates 322 k
nss-sysinit x86_64 3.53.1-3.el7_9 updates 65 k
nss-tools x86_64 3.53.1-3.el7_9 updates 535 k
nss-util x86_64 3.53.1-1.el7_9 updates 79 k
Transaction Summary
=============================================================================================================================================================================================
Install ( 1 Dependent package)
Upgrade 2 Packages (+8 Dependent packages)
Total download size: 2.9 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/11): libcurl-7.29.0-59.el7_9.1.x86_64.rpm | 223 kB 00:00:00
(2/11): nspr-4.25.0-2.el7_9.x86_64.rpm | 127 kB 00:00:00
(3/11): nss-3.53.1-3.el7_9.x86_64.rpm | 869 kB 00:00:00
(4/11): nss-softokn-3.53.1-6.el7_9.x86_64.rpm | 354 kB 00:00:00
(5/11): nss-softokn-freebl-3.53.1-6.el7_9.x86_64.rpm | 322 kB 00:00:00
(6/11): curl-7.29.0-59.el7_9.1.x86_64.rpm | 271 kB 00:00:00
(7/11): nss-sysinit-3.53.1-3.el7_9.x86_64.rpm | 65 kB 00:00:00
(8/11): libssh2-1.8.0-4.el7.x86_64.rpm | 88 kB 00:00:00
(9/11): nss-util-3.53.1-1.el7_9.x86_64.rpm | 79 kB 00:00:00
(10/11): nss-tools-3.53.1-3.el7_9.x86_64.rpm | 535 kB 00:00:00
(11/11): nss-pem-1.0.3-7.el7.x86_64.rpm | 74 kB 00:00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 2.8 MB/s | 2.9 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : nspr-4.25.0-2.el7_9.x86_64 1/21
Updating : nss-util-3.53.1-1.el7_9.x86_64 2/21
Updating : nss-softokn-freebl-3.53.1-6.el7_9.x86_64 3/21
Updating : nss-softokn-3.53.1-6.el7_9.x86_64 4/21
Updating : nss-sysinit-3.53.1-3.el7_9.x86_64 5/21
Updating : nss-3.53.1-3.el7_9.x86_64 6/21
Installing : nss-pem-1.0.3-7.el7.x86_64 7/21
Updating : libssh2-1.8.0-4.el7.x86_64 8/21
Updating : libcurl-7.29.0-59.el7_9.1.x86_64 9/21
Updating : curl-7.29.0-59.el7_9.1.x86_64 10/21
Updating : nss-tools-3.53.1-3.el7_9.x86_64 11/21
Cleanup : nss-tools-3.21.0-17.el7.x86_64 12/21
Cleanup : curl-7.29.0-35.el7.centos.x86_64 13/21
Cleanup : libcurl-7.29.0-35.el7.centos.x86_64 14/21
Cleanup : nss-sysinit-3.21.0-17.el7.x86_64 15/21
Cleanup : nss-3.21.0-17.el7.x86_64 16/21
Cleanup : nss-softokn-3.16.2.3-14.4.el7.x86_64 17/21
Cleanup : nss-util-3.21.0-2.2.el7_2.x86_64 18/21
Cleanup : nspr-4.11.0-1.el7_2.x86_64 19/21
Cleanup : nss-softokn-freebl-3.16.2.3-14.4.el7.x86_64 20/21
Cleanup : libssh2-1.4.3-10.el7_2.1.x86_64 21/21
Verifying : curl-7.29.0-59.el7_9.1.x86_64 1/21
Verifying : nss-pem-1.0.3-7.el7.x86_64 2/21
Verifying : nss-sysinit-3.53.1-3.el7_9.x86_64 3/21
Verifying : nss-3.53.1-3.el7_9.x86_64 4/21
Verifying : nss-tools-3.53.1-3.el7_9.x86_64 5/21
Verifying : nss-softokn-freebl-3.53.1-6.el7_9.x86_64 6/21
Verifying : nspr-4.25.0-2.el7_9.x86_64 7/21
Verifying : libcurl-7.29.0-59.el7_9.1.x86_64 8/21
Verifying : nss-util-3.53.1-1.el7_9.x86_64 9/21
Verifying : nss-softokn-3.53.1-6.el7_9.x86_64 10/21
Verifying : libssh2-1.8.0-4.el7.x86_64 11/21
Verifying : curl-7.29.0-35.el7.centos.x86_64 12/21
Verifying : libcurl-7.29.0-35.el7.centos.x86_64 13/21
Verifying : nspr-4.11.0-1.el7_2.x86_64 14/21
Verifying : nss-softokn-freebl-3.16.2.3-14.4.el7.x86_64 15/21
Verifying : nss-3.21.0-17.el7.x86_64 16/21
Verifying : libssh2-1.4.3-10.el7_2.1.x86_64 17/21
Verifying : nss-util-3.21.0-2.2.el7_2.x86_64 18/21
Verifying : nss-sysinit-3.21.0-17.el7.x86_64 19/21
Verifying : nss-softokn-3.16.2.3-14.4.el7.x86_64 20/21
Verifying : nss-tools-3.21.0-17.el7.x86_64 21/21
Dependency Installed:
nss-pem.x86_64 0:1.0.3-7.el7
Updated:
curl.x86_64 0:7.29.0-59.el7_9.1 nss.x86_64 0:3.53.1-3.el7_9
Dependency Updated:
libcurl.x86_64 0:7.29.0-59.el7_9.1 libssh2.x86_64 0:1.8.0-4.el7 nspr.x86_64 0:4.25.0-2.el7_9 nss-softokn.x86_64 0:3.53.1-6.el7_9 nss-softokn-freebl.x86_64 0:3.53.1-6.el7_9
nss-sysinit.x86_64 0:3.53.1-3.el7_9 nss-tools.x86_64 0:3.53.1-3.el7_9 nss-util.x86_64 0:3.53.1-1.el7_9
Complete!
[root@localhost ~]#
下载完成后加入系统环境
[root@localhost ~]# source ~/.bashrc
[root@localhost ~]#
验证安装
[root@localhost ~]# nvm --version
0.33.8
[root@localhost ~]#
查看 NVM 版本list
[root@localhost ~]# nvm ls-remote
v0.1.14
v0.1.15
v0.1.16
v0.1.17
v0.1.18
v0.1.19
v0.1.20
v0.1.21
v0.1.22
v0.1.23
v0.1.24
v0.1.25
v0.1.26
v0.1.27
v0.1.28
v0.1.29
v0.1.30
v0.1.31
v0.1.32
v0.1.33
v0.1.90
v0.1.91
v0.1.92
v0.1.93
v0.1.94
v0.1.95
v0.1.96
v0.1.97
v0.1.98
v0.1.99
v0.1.100
v0.1.101
v0.1.102
v0.1.103
v0.1.104
v0.2.0
v0.2.1
v0.2.2
v0.2.3
v0.2.4
v0.2.5
v0.2.6
v0.3.0
v0.3.1
v0.3.2
v0.3.3
v0.3.4
v0.3.5
v0.3.6
v0.3.7
v0.3.8
v0.4.0
v0.4.1
v0.4.2
v0.4.3
v0.4.4
......
安装需要的node版本
[root@localhost ~]# nvm install 10.10.0
Downloading and installing node v10.10.0...
Downloading https://nodejs.org/dist/v10.10.0/node-v10.10.0-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v10.10.0 (npm v6.4.1)
[root@localhost ~]# nvm use v10.10.0
Now using node v10.10.0 (npm v6.4.1)
[root@localhost ~]# node -v
v10.10.0
[root@localhost ~]#
查看当前机器已安装版本号
[root@localhost ~]# nvm list
v10.0.0
-> v10.10.0
system
default -> v10.0.0
node -> stable (-> v10.10.0) (default)
stable -> 10.10 (-> v10.10.0) (default)
iojs -> N/A (default)
lts/* -> lts/fermium (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.0 (-> N/A)
lts/erbium -> v12.21.0 (-> N/A)
lts/fermium -> v14.16.0 (-> N/A)
[root@localhost ~]#
设置默认的node版本
[root@localhost ~]# nvm alias default v10.10.0
[root@localhost ~]#
Thinking in JackDan