Install NodeJS in Amazon EC2 with Ubuntu 14.04

Amazon EC2 provides a free tier program for you to experiment and create your own projects. Recently I wanted to install NodeJS in Amazon EC2 with Ubuntu 14.04 as the operating system of the server. I was surprised to find that there was no article with instructions on how to install NodeJS version 4 so I thought I’d write a tutorial that explains how to do this with package manager in Ubuntu 14.04.

  1. Login to your AWS Console
  2. Select EC2 under servicesEC2
  3. Click on Launch InstanceLaunch Instance
  4. Select Ubuntu 14.04
  5. Click on Edit Security Groups and add HTTP on port 80 and HTTPS on port 443Security Group
  6. Download your key pairing
  7. Once it is running right click and select Connect
  8. To access your instance:
    1. Open an SSH client. (find out how to connect using PuTTY)
    2. Locate your private key file (MandarinTreehouse.pem). The wizard automatically detects the key you used to launch the instance.
    3. Your key must not be publicly viewable for SSH to work.
    4. Connect to your instance using its Public DNS
  9. If you’re connecting using PUTTY you can find more information here on Amazon’s AWS documentation on how to connect via the key pair that you downloaded when creating the instance. You will need to use PuttyGen to convert the key pairing that you downloaded in step 6 into the format that Putty understands.
  10. To install NodeJS version 4 you will need to run the following command in the terminal
    wget -qO- https://deb.nodesource.com/setup_4.x | sudo bash - and then:sudo apt-get install --yes nodejs
  11. To verify that node is installed corrected run
    node --version

You just created an Amazon EC2 instance that had Ubuntu 14.04 installed as the operating system. You installed version 4 of NodeJS by using the version 4 source instead of the default 0.10 source in Ubuntu 14.04’s package manager. It wasn’t too bad was it? Please feel free to leave a comment, some feedback or ask a question below!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top