ssh root@<ip_address>
apt-get -y update
apt-get -y install curl git-core python-software-properties
apt-get -y install software-properties-common # ubuntu >= 12.10
# nginx
add-apt-repository ppa:nginx/stable
apt-get -y update
apt-get -y install nginx
service nginx start
# Node.js
add-apt-repository ppa:chris-lea/node.js
apt-get -y update
apt-get -y install nodejs
adduser deployer
# Add the user to the administer the system (admin) group
# if ubuntu > 12.04
usermod -a -G sudo deployer
# else
usermod -a -G admin deployer
logout
ssh deployer@<ip_address>
##Using SSH Key Pair Authentication
# if homebrew or ssh-copy-id is installed
ssh-copy-id deployer@<ip_address>
# else
scp ~/.ssh/id_rsa.pub deployer@<ip_address>:
ssh deployer@<ip_address>
mkdir .ssh
mv id_rsa.pub .ssh/authorized_keys
chown -R deployer:deployer .ssh
chmod 700 .ssh
chmod 600 .ssh/authorized_keys
##Disabling Root Login
sudo vi /etc/ssh/sshd_config
/PermitRootLogin no/
sudo service ssh restart
##Creating a Firewall
sudo vi /etc/iptables.firewall.rules #See File below
sudo iptables-restore < /etc/iptables.firewall.rules
File: /etc/iptables.firewall.rules
*filter
# Allow all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT -d 127.0.0.0/8 -j REJECT
# Accept all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow all outbound traffic - you can modify this to only allow certain traffic
-A OUTPUT -j ACCEPT
# Allow HTTP and HTTPS connections from anywhere (the normal ports for websites and SSL).
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 443 -j ACCEPT
# Allow SSH connections
#
# The -dport number should be the same port number you set in sshd_config
#
-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT
# Allow ping
-A INPUT -p icmp -j ACCEPT
# Log iptables denied calls
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
# Drop all other inbound - default deny unless explicitly allowed policy
-A INPUT -j DROP
-A FORWARD -j DROP
COMMIT
sudo vi /etc/network/if-pre-up.d/firewall #See File below
sudo chmod +x /etc/network/if-pre-up.d/firewall
File: /etc/network/if-pre-up.d/firewall
#!/bin/sh
/sbin/iptables-restore < /etc/iptables.firewall.rules
sudo apt-get install fail2ban
curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable
source ~/.profile
rvm autolibs enable
rvm install X.X.X #ruby version