[AWS] EC2 인스턴스에서 node, npm 설치 방법
2019. 12. 3. 02:31ㆍCloud/AWS
AWS EC2에서 Node.js 설치 방법

AWS EC2 인스턴스에서 nvm을 이용한 Node.js 설치 방법은 AWS 문서에 잘 설명되어 있습니다.
자습서: Amazon EC2 인스턴스에서 Node.js 설정 - JavaScript용 AWS SDK
자습서: Amazon EC2 인스턴스에서 Node.js 설정 JavaScript용 SDK와 함께 Node.js를 사용하는 일반적인 시나리오는 Amazon Elastic Compute Cloud(Amazon EC2) 인스턴스에서 Node.js 웹 애플리케이션을 설정하고 실행하는 것입니다. 이 자습서에서는 Linux 인스턴스를 생성하고, SSH를 사용하여 해당 인스턴스에 연결한 다음, 해당 인스턴스에서 실행할 Node.js를 설치합니다. 사전 조건 이 자습서
docs.aws.amazon.com
간혹 버전을 특정 버전의 node를 설치해야 할 경우가 있어서 해당 방법을 포스팅합니다.
nodesource README파일을 참조하여 설치할 버전의 nodejs setup을 실행합니다.
- NodeJS 13.x 버전의 설치를 시작합니다.
curl -sL https://rpm.nodesource.com/setup_13.x | bash -
## Installing the NodeSource Node.js 13.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_13.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Downloading release setup RPM...
+ mktemp
+ curl -sL -o '/tmp/tmp.FZ9dFBDuc1' 'https://rpm.nodesource.com/pub_13.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Installing release setup RPM...
+ rpm -i --nosignature --force '/tmp/tmp.FZ9dFBDuc1'
## Cleaning up...
+ rm -f '/tmp/tmp.FZ9dFBDuc1'
## Checking for existing installations...
+ rpm -qa 'node|npm' | grep -v nodesource
## Run `sudo yum install -y nodejs` to install Node.js 13.x and npm.
## You may also need development tools to build native addons:
sudo yum install gcc-c++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn
- 해당 버전의 npm과 Node.js를 설치하기 위하여 yum install을 수행합니다.
sudo yum install nodejs