Server/환경 구축 - Centos

[Linux] CentOS 7 Node js 설치

sangjun-pro 2022. 4. 26. 17:43

글을 작성하는 현재 (2022.04)  최신 버전은 18 / LTS는 16 이다.

본 포스팅에서는 14 버전을 설치한다.

 

1. 패키지 업데이트

[root@localhost ~]# sudo yum -y update

 

2.  yum 저장소 추가 ( https://github.com/nodesource/distributions/blob/master/README.md )

아래 커맨드 중 원하는 버전 설치

[root@localhost ~]# curl -sL https://rpm.nodesource.com/setup_18.x | sudo bash - // 18
[root@localhost ~]# curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash - // 16
[root@localhost ~]# curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash - // 14

 

3. Node.js 설치( libuv / npm 설치 )

[root@localhost ~]# sudo yum install -y nodejs

 

4. 설치 확인

[root@localhost ~]# node --version
v14.19.1
[root@localhost ~]# npm --version
6.14.16