Skip to content

Instantly share code, notes, and snippets.

@carlospliego
Created September 24, 2015 18:54
Show Gist options
  • Save carlospliego/3e9134bb64c966f46169 to your computer and use it in GitHub Desktop.
Save carlospliego/3e9134bb64c966f46169 to your computer and use it in GitHub Desktop.
Setup NODE on AMAZON EC2
#EC2 Node Setup Guide
##Install Node and NPM
* `sudo yum update`
* `sudo yum install gcc-c++ make`
* `sudo yum install openssl-devel`
* `sudo yum install git`
* `git clone git://github.com/joyent/node.git`
* `cd node`
* `git pull origin master`
* `git checkout v0.6.8` // LATEST VERSION
* `./configure`
* `make`
* `sudo make install`
* `sudo su`
* `vi /etc/sudoers` Add this ( :/usr/local/bin ) to the end of this line ( Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin )
* `git clone https://github.com/isaacs/npm.git`
* `cd npm`
* `sudo make install`
##Setup node to run on port 80
Redirect 1337 requests to port 80
* `cat /proc/sys/net/ipv4/ip_forward` if this returns 0 it means forwarding is disabled
* `sudo vi /etc/sysctl.conf` change net.ipv4.ip_forward = 0 to net.ipv4.ip_forward = 1
* `sudo sysctl -p /etc/sysctl.conf`
* `cat /proc/sys/net/ipv4/ip_forward` should now return 1
* `sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 1337`
* `sudo iptables -A INPUT -p tcp -m tcp --sport 80 -j ACCEPT`
* `sudo iptables -A OUTPUT -p tcp -m tcp --dport 80 -j ACCEPT`
* `sudo /sbin/service iptables save`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment