This article will help you understand the steps to install NodeJS on Amazon EC2 Instance in under 20 minutes.
Prerequisite:
- Amazon Account
- Knowledge in creating EC2 Instances (If you are not aware of it then read this tutorial to get started on creating Ec2 Instances)
Okay! In the ec2 home page click “launch instance” and select Quicklaunch->Amazon Linux 64 bit and complete the steps in providing the security credentials and connect to it.
In the SSH client type below
sudo su
sudo yum update
This will update all the repositories in the system to the latest version.
Install GIT
Node JS cannot be downloaded directly instead you need git to download the node JS package.
sudo yum install git core
after installation of git repository start downloading the nodejs
git clone git://github.com/joyent/node.git
before proceeding to install the node server we need to make sure all the necessary compilers are available.
sudo yum groupinstall "Development Tools"
This will install development components that make the installation smooth.
The git clone of node js is available in the home path under “node” folder
cd node ./configure make sudo make install
This will start the installation of Node server and will take 10 to 15 minutes to complete.
Testing the installation
PATH=$PATH:/home/ec2-user/node node -v
You need to change the path environment variable to test the installation. the command node-v will return the version of installation
If you are getting “node: command not found” error then your installation is not complete.
NPM
curl https://npmjs.org/install.sh | sh
This completes the installation of NodeJs on Amazon Ec2 Instance.If you have any questions you can comment in the section below.