Post List

2016년 11월 4일 금요일

CentOS7 에 Node.js 설치하기.

1. yum 저장소에 epel-release 를 설치한다.

[binrang@binrang-db ~]$ sudo yum install epel-release
[sudo] password for binrang: 
Loaded plugins: fastestmirror, langpacks
base                                                                                                 | 3.6 kB  00:00:00     
extras                                                                                               | 3.4 kB  00:00:00     
mariadb                                                                                              | 2.9 kB  00:00:00     
updates                                                                                              | 3.4 kB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: mirror.oasis.onnetcorp.com
 * extras: mirror.oasis.onnetcorp.com
 * updates: mirror.oasis.onnetcorp.com
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================================
 Package                           Arch                        Version                    Repository                   Size
============================================================================================================================
Installing:
 epel-release                      noarch                      7-6                        extras                       14 k
Transaction Summary
============================================================================================================================
Install  1 Package
Total download size: 14 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-6.noarch.rpm                                                                          |  14 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-6.noarch                                                                                  1/1 
  Verifying  : epel-release-7-6.noarch                                                                                  1/1 
Installed:
  epel-release.noarch 0:7-6                                                                                                 
Complete!
[binrang@binrang-db ~]$ 




2. yum을 이용하여 nodejs를 설치한다.

[binrang@binrang-db ~]$ sudo yum install nodejs
Loaded plugins: fastestmirror, langpacks
epel/x86_64/metalink                                                                                 | 5.0 kB  00:00:00     
epel                                                                                                 | 4.3 kB  00:00:00     
(1/3): epel/x86_64/group_gz                                                                          | 170 kB  00:00:00     
(2/3): epel/x86_64/updateinfo                                                                        | 671 kB  00:00:01     
(3/3): epel/x86_64/primary_db                                                                        | 4.3 MB  00:00:03     
......
Dependencies Resolved
============================================================================================================================
 Package                    Arch                       Version                               Repository                Size
============================================================================================================================
Installing:
 nodejs                     x86_64                     1:6.7.0-107.el7                       epel                     4.6 M
Installing for dependencies:
 libuv                      x86_64                     1:1.9.1-1.el7                         epel                      79 k
 npm                        x86_64                     1:3.10.3-107.el7                      epel                     2.5 M
Transaction Summary
============================================================================================================================
Install  1 Package (+2 Dependent packages)
Total download size: 7.1 M
Installed size: 26 M
Is this ok [y/d/N]:  y
Downloading packages:
경고: /var/cache/yum/x86_64/7/epel/packages/libuv-1.9.1-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Public key for libuv-1.9.1-1.el7.x86_64.rpm is not installed
(1/3): libuv-1.9.1-1.el7.x86_64.rpm                                                                  |  79 kB  00:00:01     
(2/3): nodejs-6.7.0-107.el7.x86_64.rpm                                                               | 4.6 MB  00:00:02     
(3/3): npm-3.10.3-107.el7.x86_64.rpm                                                                 | 2.5 MB  00:00:01     
----------------------------------------------------------------------------------------------------------------------------
......
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]:  y
.......
Installed:
  nodejs.x86_64 1:6.7.0-107.el7                                                                                             
Dependency Installed:
  libuv.x86_64 1:1.9.1-1.el7                                   npm.x86_64 1:3.10.3-107.el7                                  
Complete!
[binrang@binrang-db ~]$ 

3. version 을 확인해보자.

[binrang@binrang-db ~]$ node --version
v6.7.0
[binrang@binrang-db ~]$ 

4. npm 을 설치한다. (만약 설치가 안되었을 경우.. 기본적으로 위 순서대로 진행하였을 경우 의존성 체크하여 npm을 설치하였을 것이다. 그런데, 설치가 안되었을 경우는 아래와 같이 진행한다.)

[binrang@binrang-db ~]$ sudo yum install npm

npm 은 Node Packaged Modules 의 약자로 Node.js에서 사용되는 모듈을 패키지로 모아 놓은 곳이다.

여기까지 진행하면 Node.js 설치를 완료 하였다.