Steps and configuration files for setting up a slicehost slice.

Language: Ruby

Setup steps

The following step-by-step process outlines how to setup a Rails server on Slicehost using Debian 4.0 and Passenger.

Install git

From remote server, type:

sudo aptitude update
sudo aptitude upgrade
sudo aptitude install wget build-essential gettext zlib1g-dev
cd ~/src
tar -xzvf git-
cd git-
./configure --prefix=/usr/local
sudo make install

Add the deploy user

type adduser deploy

Command will ask you for a new password. Go ahead and choose one. You can safely choose default user information (blank).

Now you need to setup sudo for the deploy user.

type visudo

Add the following text to bottom of file:

deploy ALL=(ALL) ALL

You can confirm you got sudo setup properly by typing cat /etc/sudoers and ensuring that the deploy line you added is at the bottom of the output

SSH public key

You need to copy a SSH public key from your local machine to the server. You need to have created SSH key first.

from your local computer, type scp ~/.ssh/ deployXXX.XXX.XXX.XXX:@ (replace X’s with your slice IP, don’t forget the trailing semi-colon)

Add public key to authorized keys and set permissions

Login to the slice using your new ‘deploy’ user, and enter the following commands:

mkdir ~/.ssh
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
cat ~/ >> ~/.ssh/authorized_keys
rm ~/

Copy the setup files to remote server

Login as deploy user, and type: git clone git://

Configure the SSH daemon to be more secure

sudo -s (enter password when prompted)
cp slice/etc/ssh/sshd_config /etc/ssh/sshd_config
/etc/init.d/ssh restart

Copy bash settings to your home directory

cat slice/.bash_profile >> ~/.bash_profile
source ~/.bash_profile

Add some other misc. stuff

install locales
sudo dpkg-reconfigure locales
install screen
install build-essential

Install and setup Shorewall (firewall)

Enter these commands:

install shorewall
cp slice/etc/shorewall/rules /etc/shorewall/rules
cp slice/etc/shorewall/zones /etc/shorewall/zones
cp slice/etc/shorewall/interfaces /etc/shorewall/interfaces
cp slice/etc/shorewall/policy /etc/shorewall/policy
nano /etc/default/shorewall

Enable shorewall by setting startup=1 in the configuration

Ruby installation

install wget libssl-dev libreadline5-dev zlib1g-dev
mkdir -p ~/src
cd ~/src

tar -jxvf ruby-1.8.6-p111.tar.bz2
cd ruby-1.8.6-p111
./configure --prefix=/usr/local --disable-pthread
sudo make install

cd ~/src
tar -xzvf rubygems-1.3.1.tgz
cd rubygems-1.3.1
sudo ruby setup.rb

sudo gem install rails —no-ri —no-rdoc

Apache installation

install apache2 apache2-prefork-dev

Passenger installation

sudo gem install rake passenger
sudo passenger-install-apache2-module

MySQL installation

install mysql-server-5.0 libmysqlclient15-dev
mysqladmin -u root password YOURPASSWORDHERE
sudo gem install mysql
install phpmyadmin

Visit http://XXX.XXX.XXX.XXX/phpmyadmin/

Setup Passenger

sudo nano /etc/apache2/apache2.conf

Add the following lines:

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/
   PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3
   PassengerRuby /usr/local/bin/ruby

Restart apache with this command:

sudo /etc/init.d/apache2 restart

Setup a rails app

Install rails:

sudo gem install rails

mkdir ~/apps
cd ~/apps
git clone git://
sudo nano /etc/apache2/sites-available/cincinnatirb

Add something like this to the config file:

<VirtualHost *:80>


  DocumentRoot /home/deploy/apps/mysite/public

  <Directory "/home/deploy/apps/mysite/public">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all


To enable the new site:

sudo a2ensite cincinnatirb
sudo /etc/init.d/apache2 reload


On your local machine cd to your current project directory.
Run capify . to setup capistrano
Replace config/deploy.rb with the deploy.rb included in this project
cap deploy:setup

Be sure to create your database prior to running this step.
cap deploy:cold

If all goes well you should have a working rails app. Also, don’t forget to setup your DNS entries


Project Statistics

Sourcerank 2
Repository Size 118 KB
Stars 3
Forks 0
Watchers 1
Open issues 0
Dependencies 0
Contributors 2
Tags 0
Last updated
Last pushed

Top Contributors See all

Ry Walker Michael Guterl

Something wrong with this page? Make a suggestion

Login to resync this repository