본문 바로가기

Programming/NodeJS

[NodeJS] Linux ( CentOS, Ubuntu, AWS Linux 등 ) 에 NodeJS 설치하기

작성자 : Deok

NodeJS 관련 포스팅 전에 간단히 Linux ( 많이 쓰는 Ubuntu 와 CentOS)에 NodeJS를 설치하는 방법을 설명드리겠습니다.

만약 좀 더 상세히 영문으로 읽고 싶으신 분은 아래의 영문 문서를 참고하시기 바랍니다.


Linux 배포판에 NodeJS 설치법 ( 영문 ) : https://github.com/nodesource/distributions/blob/master/README.md


* 버전 확인


NodeJS는 다양한 버전이 있는데요. 이는 개발 후 변경이 힘듭니다. 설치하시기 전에 LTS 와 Latest 버전을 아래의 페이지에서 한번 확인하고 설치하시기 바랍니다.


NodeJS LTS & Latest 확인하기 : https://nodejs.org/ko/about/releases/


2016.09.03 기준으로 LTS는 v10 버전이고 2020년 4월까지 LTS로 지정된 것을 의미합니다.




1. Ubuntu 에 NodeJS 설치하기 ( Ubuntu, Debian )


NodeJS v12.x

# Ubuntu 에서 설치하기
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs

# Debian 에서 Root 로 설치하기
curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt-get install -y nodejs


NodeJS v11.x

# Ubuntu 에서 설치하기
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
sudo apt-get install -y nodejs

# Debian 에서 Root 로 설치하기
curl -sL https://deb.nodesource.com/setup_11.x | bash -
apt-get install -y nodejs


NodeJS v10.x ( 20190603 기준 LTS )

# Ubuntu 에서 설치하기
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs

# Debian 에서 Root 로 설치하기
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt-get install -y nodejs


NodeJS v8.x

# Ubuntu 에서 설치하기
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

# Debian 에서 Root 로 설치하기
curl -sL https://deb.nodesource.com/setup_8.x | bash -
apt-get install -y nodejs


NodeJS v6.x

# Ubuntu 에서 설치하기
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

# Debian 에서 Root 로 설치하기
curl -sL https://deb.nodesource.com/setup_6.x | bash -
apt-get install -y nodejs




2. CentOS 에 NodeJS 설치하기 ( CentOS, RHEL, CentOS, Amazon Linux, Fedora, CloudLinux )


CentOS에서 설치 시에는 Root를 이용하여 설치하셔야 합니다. 


* 필요에 따라 아래와 같이 빌드 툴을 설치해야 할 수도 있습니다.


yum install gcc-c++ make
# 또는: yum groupinstall 'Development Tools'



NodeJS v12.x

$ curl -sL https://rpm.nodesource.com/setup_12.x | bash -


NodeJS v11.x

$ curl -sL https://rpm.nodesource.com/setup_11.x | bash -


NodeJS v10.x

$ curl -sL https://rpm.nodesource.com/setup_10.x | bash -


NodeJS v8.x

$ curl -sL https://rpm.nodesource.com/setup_8.x | bash -


NodeJS v6.x

$ curl -sL https://rpm.nodesource.com/setup_6.x | bash -