Installing Node.js on Amazon Linux EC2 instance

Here is an easy way to install Node.js on an AWS EC2 instance running Amazon Linux.

Run as root on RHEL, CentOS or Fedora, for Node.js v6 LTS:

curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -

Alternatively for Node.js 8:

curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -

Alternatively for Node.js 0.10:

curl --silent --location https://rpm.nodesource.com/setup | bash -

Then install, as root:

yum -y install nodejs

Test: Run node -v. The version should be higher than v0.10.32.

Node comes with npm installed so you should have a version of npm. However, npm gets updated more frequently than Node does, so you’ll want to make sure it’s the latest version.

npm install npm@latest -g

Test: Run npm -v. The version should be higher than 2.1.8.

References:

https://nodejs.org/en/download/package-manager/
https://docs.npmjs.com/getting-started/installing-node

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s