Before we setup Node.js on AWS, you should have AWS EC2 instance setup and you should be able to login using Putty or Terminal.
Refer to my previous blog on how to setup EC2 instance -
http://javaredhot.blogspot.com/2016/02/amazon-ec2-creating-and-setting-up.html
Now login to EC2 instance
https://gist.github.com/isaacs/579814
http://iconof.com/blog/how-to-install-setup-node-js-on-amazon-aws-ec2-complete-guide/
Refer to my previous blog on how to setup EC2 instance -
http://javaredhot.blogspot.com/2016/02/amazon-ec2-creating-and-setting-up.html
Now login to EC2 instance
Install Git
$ sudo yum install gitThis will ask for your confirmation and then install git.
Install Node.js
To install node and npm following steps need to be performed.
To compile node we need gcc, make and git to import node source code:
sudo yum install gcc-c++ make
sudo yum install openssl-devel
sudo yum install git
Cloning node.js source code:
git clone https://github.com/nodejs/node.git
Compile and install node.js
cd node
./configure
make
sudo make install
Add user´s directory to BIN Paths (node binaries location)
sudo su
nano /etc/ec2-user
Inside the editor scroll to where you see the line:
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
Append the value :
/usr/local/bin
In some cases node does not install at /usr/local/bin and there is no soft link to the actual location. So in that case you can create a soft link from actual node location to /usr/local/bin
$ cd /usr/local/bin
$ sudo ln -s /home/ec2-user/node/out/Release/node node
$ sudo ln -s /home/ec2-user/node/out/lib/node_modules/npm/bin/npm npm
$ sudo ln -s /home/ec2-user/node/out/lib/node_modules node_modules
$ sudo ln -s /home/ec2-user/node/out/lib/node_modules/npm/bin/npm npm
$ sudo ln -s /home/ec2-user/node/out/lib/node_modules node_modules
Install npm
git clone https://github.com/npm/npm.git cd npm sudo make install
Test if node is working:
node
References:https://gist.github.com/isaacs/579814
http://iconof.com/blog/how-to-install-setup-node-js-on-amazon-aws-ec2-complete-guide/