Quick Steps to Your Unmanaged VPS

Published on
Aug 6, 2010

It's up to you whether to continue with your current shared hosting account, or to upgrade to your own highly-customizable well performing and all-mighty Virtual Private Server!

It usually takes years to understand that shared hosting is not the best solution for you, and that managing your own VPS is not a big deal at all. All is needed is a ridiculously diminutive bunch of knowledge and a big desire to extend it when required.

The outcome of the effort is a robustness, stability and high performance of your server, as well as spare of headaches most of you are familiar with: the bigest downside of all shared hostings is that when it's down it's down, no matter what the reason, and you can't do about it much except waiting until your ISP provider fixes it.

Regarding to the price - it's about the same as of shared hostings.

The bottom line - you get it all for the same price, just have fun and configure it!

Before all, you'll need to have an OS installed. Usually you'll be able to choose it, I recommend Ubuntu, but you can choose whichever you like. We're in the Linux geeky world, right? Great, next...

Let's have an easy editor, if you type nano in the command line and get a feedback like this
1. nano: command not found

$ sudo apt-get update $ sudo apt-get install nano
Now we need a firewall. Linux comes with a great firewall built-in. And we use iptables-save and iptables-restore commands. The next step you don't really need, unless you encounter same problem. But have a look at this how-to on IPTables on your free time. 2. I had a problem with iptables-restore in the last line "COMMIT" (probably some rule was incorrect) did manually
$ sudo iptables followed_by_rules in terminal and then: $ sudo service iptables save 3. You'll probably connect through putty or by typing ssh in the shell ("command line") one thing to note, if you need to copy something to clipboard just select the text in putty then in other window click the middle mouse button - this will "paste".

4. Install vsftpd - is not required, only if you need it. You can upload stuff through Webmin, or using scp command, but here are quick steps:
a) check if firewall port 21 is open && MAKE sure that in Filezilla the SSH is chosen.
b) create a user because root is not allowed
c) give that user chown and set in /etc/passwd his directory

5 . Install mysql, Ruby On Rails (or other things that you'll need)
mysql-server ( run # mysql_secure_installation ),
ruby + rails

6. upload your site $ gzip -dc target.tar.gz | tar xf - $ sudo gem install thin $ sudo apt-get install php-myadmin $ thin start -e development -p3000 -d tail -f log/development -or- $ thin start -e production -p3000 -d tail -f log/production Note: "Thin" is a web server for RoR, and it's fast and highly recommended.
Another tip - to find files type locate, but if you get:
7. locate xxx : no such file or dir, execute: $ sudo updatedb to update the database for locate. This will scan all the files and index them.
8. Set up the Webmin to have a free Control Panel if you feel like it's indispensable. It's like CPanel but free, and will get you all you need.
9. DNS
a. To setup your "private" DNS follow this link.
b. To check if your DNS has any problems use this tool

10. Nginx. For configuration instructions check this excellent article.
(a) Create 'nginx' directory under the application's root
(b) ln -s the created in sites-available to sites-enabled
(c) add to the /etc/hosts the domain names!
(d) restart nginx
11. If you forget anything of the above, here's a magic command: $ history | grep the_word or words which will get you all the previously typed command which contain the the_word or words :) 12.Don't want to repeat sudo on each line followed by password confirmation, just type once $ sudo -i and then enter the commands without sudo. so, the config:
upstream domain1 { server; } #server { # listen 80; # server_name example.com; # rewrite ^/(.*) http://www.example.com permanent; # } server { listen 80; server_name www.example.com alias example.com; access_log /home/projects/example.com/nginx/access.log; error_log /home/projects/example.com/nginx/error.log; root /home/projects/example.com/public/; index index.html; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect false; if (-f $request_filename/index.html) { rewrite (.*) $1/index.html break; } if (-f $request_filename.html) { rewrite (.*) $1.html break; } if (!-f $request_filename) { proxy_pass http://domain1; break; } } }

Now you're ready to play with these configurations. When done and you feel like you're ready for it, then don't hesitate! One thing always to remember about is security. Always think about it. Be paranoid about it :) Use the most weird and hard to guess passwords of infinite lenghts :) Good luck, and I'll be happy to hear about your adventures with VPS'es.