Daniel Hoelbling-Inzko talks about programming

Site migrated - more awesome - more root!

Posted by Daniel Hölbling on September 15, 2011

The title actually says it all. I just finished the migration of my blog to a new server I am now administering myself (wether that's a good thing or not still remains to be seen).

Last week I noticed that I could get a full root server for the same money I am paying for the 100 megs of PHP4/MySQL4 hosting at my old provider. So I jumped at the opportunity and got a nice little Debian Squeeze VM from my good friends at CoUnity.at.

I've now spent two days configuring the heck out of that machine and I must say I am impressed, so here are some notes that may help when you are migrating/setting up.


It's ridiculous how easy it is to install gitolite. You just follow this little guide here and you are up and running your own private Git server in 5 minutes tops.

I actually just canceled my paid GitHub account since I can now host my private Git repositories on my own server now.

Apache / MySql

It's almost kind of silly and feels totally outlandish to anyone who has ever gone through a IIS and SQL Server 2008 install, but getting the full stack running on Debian was once again a two liner on the shell:

apt-get install mysql5
apt-get install apache2


One of the main reasons why I wanted my own root server was so I could run my own little rails projects I had nowhere to put before. So naturally I checked for the apt packages on ruby and found out that they are horribly outdated. Since I primarily wanted Rails3 I installed Ruby 1.9.2 through RVM.

Once again, so easy that any Windows Sysadmin will weep:

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
#restart the prompt
rvm notes
#Read through the notes as it will tell you what packages ruby 1.9.2 requires
#and install them through apt-get
rvm install 1.9.2
rvm use 1.9.2 --default

The rvm install will take about 10 minutes since it's actually compiling ruby 1.9.2 from source and installing it to /usr/local/rvm but that's it then.


Being able to run Ruby is nice, but Apache2 didn't know anything of it's luck yet so next step was to install the Passenger in order to run Rack apps.

Now here it's a bit tricky because Passenger is available in the apt sources. So if you run apt-get install libapache2-mod-passenger you are screwed as apt will go ahead and pull down Ruby 1.8 and overwrite all the stuff you did with RVM before. (No big deal but not ideal either).

So the better way to install Passenger is to actually install it through the new RVM rubie as a Gem:

gem install passenger

Again, it can't really get any easier. The installer will even tell you what libraries you are missing and tell you exactly what to type into apt-get to install them.

After the install is done you simply need to hack open your apache2.conf and add the module settings (they are listed in the installer), but it's better to go into your /etc/apache2/mods-available and put the code into a new file (conveniently called passenger-local.load). Now your local passenger install is an apache module and apache won't blow up on the next apt-get upgrade.

You then activate your module with a2enmod passenger-local and restart apache (/etc/init.d/apache2 restart).


Migrating a Wordpress blog was fairly easy, I just copied all the files from my old host into /var/www and restored the MySQL database from the mysql-dump. The thing that amazed me at this point however was Sequel Pro and SSH. The MySQL server does not allow connections from the outside for obvious security reasons so I was already thinking about either installing phpMyAdmin on the machine or figuring out how to run the 5 mb SQL insert script through the MySQL commandline client. Turns out, my Mac MySQL app Sequel Pro can connect to MySQL servers over SSH. So I connected to over the encrypted SSH tunnel - getting a really nice management interface with no open ports whatsoever. Wow..

Anyways, the Wordpress install was pretty easy. I set the correct file permissions on my /var/www folder with chown -R www-data:www-data /var/www and changed the database connection strings in wp-config.php. I then had to fiddle a bit because mod-rewrite was not enabled and all permalinks where broken. I fixed that with a2enmod rewrite and setting the AllowOverride setting in /etc/apache2/sites-available/default to FileInfo

In closing I have to say I am genuinely impressed by the amount of flexibility you get with SSH. Windows could really use a good command line interface and desperatly needs a way to remote into servers without having to run RDP all the time. Especially sending files around with SCP or tunneling traffic over SSH is so incredibly useful that I can't understand why there is no such thing in Windows at all. Your best bet there is PowerShell remoting but that's far away from useful.

Filed under site-news
comments powered by Disqus

My Photography business


dynamic css for .NET