AWS EC2에서 리눅스를 사용시, yum list npm 이라고 하면.. 아래처럼 그런 패키지는 없다고 나올때가 있다.
# yum install npm
Loaded plugins: priorities, update-motd, upgrade-helper
No package npm available.
Error: Nothing to do
그럴때는 아래와 같이 해주면 된다
# curl -sL https://rpm.nodesource.com/setup_8.x | sudo -E bash -
#yum install nodejs --enablerepo=nodesource
아래는 실제로 위 명령어를 실행시켰을 때의 모습이다.
[root@home]#
[root@home]# curl -sL https://rpm.nodesource.com/setup_8.x | sudo -E bash -
## Installing the NodeSource Node.js 8.x repo...
## Inspecting system...
+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m
## Confirming "el7-x86_64" is supported...
+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_8.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Downloading release setup RPM...
+ mktemp
+ curl -sL -o '/tmp/tmp.nZGRb9eZk0' 'https://rpm.nodesource.com/pub_8.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Installing release setup RPM...
+ rpm -i --nosignature --force '/tmp/tmp.nZGRb9eZk0'
## Cleaning up...
+ rm -f '/tmp/tmp.nZGRb9eZk0'
## Checking for existing installations...
+ rpm -qa 'node|npm' | grep -v nodesource
## Run `yum install -y nodejs` (as root) to install Node.js 8.x and npm.
## You may also need development tools to build native addons:
## `yum install -y gcc-c++ make`
[root@home]
[root@home]
[root@home]# yum install nodejs --enablerepo=nodesource
Loaded plugins: priorities, update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 2:8.2.1-1nodesource.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================================================================================================
Package Arch Version Repository Size
===================================================================================================================================================================================
Installing:
nodejs x86_64 2:8.2.1-1nodesource.el7.centos nodesource 12 M
Transaction Summary
===================================================================================================================================================================================
Install 1 Package
Total download size: 12 M
Installed size: 42 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/latest/nodesource/packages/nodejs-8.2.1-1nodesource.el7.centos.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 34fa74dd: NOKEY 0 B --:--:-- ETA
Public key for nodejs-8.2.1-1nodesource.el7.centos.x86_64.rpm is not installed
nodejs-8.2.1-1nodesource.el7.centos.x86_64.rpm | 12 MB 00:00:00
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
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : 2:nodejs-8.2.1-1nodesource.el7.centos.x86_64 1/1
Verifying : 2:nodejs-8.2.1-1nodesource.el7.centos.x86_64 1/1
Installed:
nodejs.x86_64 2:8.2.1-1nodesource.el7.centos
Complete!
[root@home]
[root@home]# node --version
v8.2.1
[root@home]
문제 없이 잘 설치된다.