+ echo 'deb https://deb.nodesource.com/node_11.x yakkety main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src https://deb.nodesource.com/node_6.11 yakkety main' >> /etc/apt/sources.list.d/nodesource.list
## Running `apt-get update` for you...
+ apt-get update
Get:1 yakkety-security InRelease [102 kB]
Get:2 yakkety InRelease [247 kB]
Get:3 yakkety-updates InRelease [102 kB]
Get:4 https://deb.nodesource.com/node_11.x yakkety InRelease [3,915 B]
Get:5 yakkety-backports InRelease [102 kB]
Get:6 https://deb.nodesource.com/node_11.x yakkety/main Sources [765 B]
Get:7 https://deb.nodesource.com/node_11.x yakkety/main i386 Packages [961 B]
Get:8 https://deb.nodesource.com/node_11.x yakkety/main amd64 Packages [964 B]
Fetched 560 kB in 2s (215 kB/s)
Reading package lists... Done
## Run `apt-get install nodejs` (as root) to install Node.js v11.x and npm
第2步: 安装最新的Nodejs和NPM
接下来,您现在可以使用以下命令在系统上安装Nodejs和NPM:
在RHEL,CentOS和Fedora上
# yum -y install nodejs
# dnf -y install nodejs [On Fedora 22+ versions]
示例输出
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.vbctv.in
* elrepo: mirrors.coreix.net
* epel: repos.del.extreme-ix.org
* extras: mirror.vbctv.in
* updates: mirror.vbctv.in
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 2:11.3.0-1nodesource will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
nodejs x86_64 2:11.3.0-1nodesource nodesource 18 M
Transaction Summary
===============================================================================================================================================================================================
Install 1 Package
Total download size: 18 M
Installed size: 54 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/nodesource/packages/nodejs-11.3.0-1nodesource.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 34fa74dd: NOKEY===========-] 2.8 MB/s | 18 MB 00:00:00 ETA
Public key for nodejs-11.3.0-1nodesource.x86_64.rpm is not installed
nodejs-11.3.0-1nodesource.x86_64.rpm | 18 MB 00:00:05
Retrieving key from file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
Importing GPG key 0x34FA74DD:
Userid : "NodeSource "
Fingerprint: 2e55 207a 95d9 944b 0cc9 3261 5ddb e8d4 34fa 74dd
Package : nodesource-release-el7-1.noarch (installed)
From : /etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : 2:nodejs-11.3.0-1nodesource.x86_64 1/1
Verifying : 2:nodejs-11.3.0-1nodesource.x86_64 1/1