So it was time to upgrade my server software. I was using lighttpd with mongrel_clusters and php5. But with all the hype of passenger and how (actually) great it is, I decided to destroy my wonderful uptime in favor of easier deployment and less memory usage. I put up one more site so the server is kind of overloaded, i have virtually no free memory, if everything becomes to slow here i will probably shut one site down. So heres what i did (the whole thing took around 6 hours):

I backed up my databases by exporting from phpmyadmin. I then tarballed my repos and my website root directory and backed them up. And i was off, reformating my wonderful uptime of:

20:08:35 up 245 days, 3:37, 2 users, load average: 0.29, 0.35, 0.20

Then began the commands:

sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install mysql-server
sudo apt-get install php5-mysql
sudo apt-get install apache2

sudo apt-get install php5
sudo apt-get install php5-gd
sudo apt-get install libapache2-mod-php5
sudo apt-get install tetex-base tetex-bin dvipng

tar -xf rubygems-1.3.1.tgz
cd rubygems-1.3.1
sudo ruby setup.rb
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

sudo gem install rails
sudo gem install rails -v=2.1.1
sudo gem install clickatell
sudo gem install capistrano
sudo gem install haml
sudo apt-get install sqlite3
sudo gem install passenger

Now i ran into some trouble, first time. Apparently installing ruby wasnt enough. I got this:

require': no such file to load -- mkmf

I got the solution thanks to this guy

So i had to install this too:

sudo apt-get install ruby1.8-dev

Trying this command again and it worked:

sudo gem install passenger
sudo gem install mysql

Now this failed. With these error messages:

Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb install mysql
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… yes
checking for mysql_query() in -lmysqlclient… no
*** extconf.rb failed ***

So i had to run this, after some extensive googling and trying random things:

sudo apt-get install libmysqlclient15-dev

What i got from the internet originally was this: (and it was wrong, that package doesnt exist anymore, so i had to figure out to use 15 instead)

sudo apt-get install libmysqlclient5-dev

Then began the passenger installing

sudo passenger-install-apache2-module
sudo apt-get install apache2-prefork-dev

And ruby enterprise for less memory usage:

tar -xf ruby-enterprise-1.8.6-20081215.tar.gz
cd ruby-enterprise-1.8.6-20081215
sudo ./installer

(following instructions and reinstalling everything)


Some excessive configuring of Apache with Vhosts and stuff, and this:

LoadModule passenger_module /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/
PassengerRoot /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/passenger-2.0.6
PassengerRuby /opt/ruby-enterprise-1.8.6-20081215/bin/rubysudo apt-get install git

Then finally:

sudo apt-get install subversion
sudo apt-get install irb
sudo apt-get install postfix
sudo apt-get install screen irssi

Yeah i know i could have bundled this up into one big install command but i wanted to see what failed along the way. Next time i have this so i can i can do the whole command in once.