Amazon EC2 provides a free tier program for you to experiment and create your own projects. Recently I wanted to install Node.js in Amazon EC2 with Ubuntu 14.04 as the operating system. I was surprised to find that there was no article with clear instructions on how to install Node.js version 4, so I wrote this tutorial.
Steps:
- Login to your AWS Console
- Select EC2 under Services
- Click on Launch Instance
- Select Ubuntu 14.04
- Click on Edit Security Groups and add HTTP on port 80 and HTTPS on port 443
- Download your key pair
- Once it is running, right-click and select Connect
Connecting via SSH:
chmod 400 your-key.pem
ssh -i "your-key.pem" ubuntu@your-public-dns.compute.amazonaws.com
Installing Node.js via nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc
nvm install 4
nvm use 4
node --version
This will install Node.js v4 on your EC2 instance. You can then install your application dependencies and start your server.