Setting up a Ruby VPS

Contents

[edit] 1 Basic Set Up

Choosing: Ubuntu 8.10 64bit.

First, update the system:

apt-get update && apt-get upgrade

Get necessary packages:

apt-get install mercurial subversion apache2 apache2-mpm-prefork \
  apache2-prefork-dev mysql-server wget unzip vim build-essential \
  postgresql libpq-dev postfix
apt-get install ruby-full 

[edit] 2 Install Ruby Gems

cd /usr/local/source
wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
tar xzvf 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 update --system
gem install rails
gem install mysql

[edit] 3 Make user

adduser lims
usermod -a -G sudo lims

[edit] 4 Create the app and enable it in Apache

su lims
rails /home/lims/www/lims -d mysql
gem install passenger
passenger-install-apache2-module
exit

Add to the end of /etc/apache2/apache2.conf:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6
PassengerRuby /usr/bin/ruby1.8

Put this in /etc/apache2/sites-available/ruby-lims:

<VirtualHost *:80>
    ServerName thehost.com
    DocumentRoot /home/lims/www/lims
</VirtualHost>

Enable modules and restart Apache:

a2enmod rewrite
a2ensite ruby-lims
/etc/init.d/apache2 restart

[edit] 5 Database making

Edit /home/lims/www/lims/config/database.yml to point to this database. Then run:

rake db:create
XHTML 1.1 CSS 2 Sec 508