First 10 minutes on Ubuntu

The original post appeared on #451 of the following Slickdeals thread:  Thanks SlickFerret!

Disclaimer: I have 2 VPS instances with Chicago VPS. 

1st 10 minutes on Ubuntu

— basic iptables setup
— fail2ban
— gnome on vnc
— webmin
— pptp VPN server
— automatic upgrades

This has been tested on a fresh Ubuntu 12.04 install. It has only been run by pasting sections in 1at a time,and waiting for each section to complete before pasting in more commands, as certain commands erase the buffer. I haven’t tried running it as a script off the vps… The automatic upgrades has not really been tested yet, but hopefully it works… With the exception of automatic upgrades, this is meant to be an all or nothing guide. Install everything, in order, or things may not go as planned, if at all.

Let us know if everything works!

#section 1
#get updates/upgrades
apt-get update
apt-get upgrade
#section 2
#install pptp
apt-get install pptpd
#section 3
#setup pptp
sudo sed -i -r 's/^\s*#(net\.ipv4\.ip_forward=1.*)/\1/' /etc/sysctl.conf
# Reload the config file to have the change take effect immediately.
sudo -i sysctl -p
OUTIF=`/sbin/ip route show to exact 0/0 | sed -r 's/.*dev\s+(\S+).*/\1/'`
sudo -i iptables --table nat --append POSTROUTING --out-interface $OUTIF --jump MASQUERADE
# Enable NAT on boot from the rc.local script.
CMD="iptables --table nat --append POSTROUTING --out-interface $OUTIF --jump MASQUERADE"
sudo sed -i "\$i$CMD\n" /etc/rc.local
echo ms-dns>>/etc/ppp/pptpd-options
echo ms-dns>>/etc/ppp/pptpd-options
echo 'mru 1400'>>/etc/ppp/pptpd-options
echo 'mru 1400'>>/etc/ppp/pptpd-options
echo '/sbin/ifconfig $1 mtu 1400'>>/etc/ppp/ip-up
echo localip>>/etc/pptpd.conf
echo remoteip,>>/etc/pptpd.conf
echo vpn1 pptpd iforgotmypw *>>/etc/ppp/chap-secrets
echo vpn2 pptpd iforgotmypw *>>/etc/ppp/chap-secrets
sudo /etc/init.d/pptpd restart
#section 5
#setup iptables
iptables -I OUTPUT -o venet0 -d -j ACCEPT
iptables -I INPUT -i venet0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i ppp+ -j ACCEPT # ppp
iptables -A OUTPUT -o ppp+ -j ACCEPT # ppp
iptables -A INPUT -p tcp --dport 1723 -j ACCEPT #pptp
iptables -A INPUT -p  47 -j ACCEPT #gre
iptables -A OUTPUT -p 47 -j ACCEPT #gre
iptables -A INPUT -p tcp --dport 22 -j ACCEPT #ssh
iptables -A INPUT -p tcp --dport 80 -j ACCEPT # http
iptables -A INPUT -p tcp --dport 443 -j ACCEPT # https
iptables -A INPUT -p tcp --dport 5901 -j ACCEPT # vnc display 1
iptables -A INPUT -p tcp --dport 10000 -j ACCEPT # webmin
iptables -A INPUT -j DROP
iptables-save -c > /etc/iptables.rules
echo deb sarge contrib>>/etc/apt/sources.list
echo deb sarge contrib>>/etc/apt/sources.list
cd ~
apt-key add jcameron-key.asc
apt-get update
apt-get install  ubuntu-desktop nano vnc4server fail2ban webmin
#section 6
vncserver :1 -geometry 1024x768 -depth 16
#section 7
#setup vnc
vncserver -kill :1
echo '#!/bin/sh'>~/.vnc/xstartup
echo "[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup">>~/.vnc/xstartup
echo "[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources">>~/.vnc/xstartup
echo xsetroot -solid grey>>~/.vnc/xstartup
echo "vncconfig -iconic &">>~/.vnc/xstartup
echo "x-window-manager &">>~/.vnc/xstartup
echo "gnome-session &">>~/.vnc/xstartup
echo '#!/bin/sh'>/root/
echo "vncserver :1 -geometry 1024x768 -depth 16">>/root/
chmod 711 /root/
echo "@reboot /root/">/root/startstuff.cron
crontab /root/startstuff.cron
echo '#!/bin/sh'>/etc/network/if-pre-up.d/iptablesload
echo 'iptables-restore < /etc/iptables.rules'>>/etc/network/if-pre-up.d/iptablesload
echo 'exit 0'>>/etc/network/if-pre-up.d/iptablesload
echo '#!/bin/sh'>/etc/network/if-post-down.d/iptablessave
echo 'iptables-save -c > /etc/iptables.rules'>>/etc/network/if-post-down.d/iptablessave
echo 'exit 0'>>/etc/network/if-post-down.d/iptablessave
chmod +x /etc/network/if-post-down.d/iptablessave
chmod +x /etc/network/if-pre-up.d/iptablesload
vncserver :1 -geometry 1024x768 -depth 16
#section 8
#automatic upgrades
apt-get install unattended-upgrades
echo 'APT::Periodic::Update-Package-Lists "1";'>/etc/apt/apt.conf.d/10periodic
echo 'APT::Periodic::Download-Upgradeable-Packages "1";'>>/etc/apt/apt.conf.d/10periodic
echo 'APT::Periodic::AutocleanInterval "7";'>>/etc/apt/apt.conf.d/10periodic
echo 'APT::Periodic::Unattended-Upgrade "1";'>>/etc/apt/apt.conf.d/10periodic

Website Building Links – Part 4

Frontend Technologies and Frameworks

JavaScript Libraries

  • jQuery:
  • jQuery Mobile:

JavaScript Frameworks


  • Bootstrap:
  • Zurb Foundation:
  • Flat UI:


Backend Technologies and Frameworks


Play! Framework:

Ruby On Rails:

Website Building Links – Part 3


So far all my domains are registered at GoDaddy (  It is a fine company but I am also looking at NameCheap ( since I do not have to rely on GoDaddy sales, and I can get very cheap WhoisGuard and Comodo Positive SSL.

Web Server

For serving static contents both Apache ( and Nginx ( are very popular.  I chose Nginx because of its performance, simplicity and flexibility.  For a comparison between Apache and Nginx please see

For serving dynamic contents I am considering the following choices:

Both node.js and Play are event driven and can be super fast and scalable.  node.js has lots of buzz but I am much more familiar with Java.  And there is Ruby On Rails…

Website Building Links – Part 2

I consider myself an expert on Java and Perl and I know some HTML, CSS, and JavaScript.  Still there are many thing I would like to learn.  Below are some links I have gathered: