Set up new Slicehost with Ruby and Rails

2008 March 2
by mike

OK, this one is going to be all technical.

I signed up with SliceHost a while back but recently decided to re-image my slice. The plan is to go with a Ubuntu Dapper Drake 6.06 LTS image since that seems to have the most documentation for Rails stuff. This is mostly Greek to me so this installation list is a good way for me to keep track of everything for the future.

References

  • http://wiki.neeraj.name/slicehost/published/HomePage
  • http://hivelogic.com/articles/ruby-rails-leopard/
  • http://ubuntuforums.org/showthread.php?t=649881
  • http://codersifu.blogspot.com/2007/03/howto-install-ruby-in-ubuntu-edgy-610.html

Steps

    ssh root@x.x.x.x                       # insert IP address here
    adduser --ingroup users myusername     # pick something nicer than 'myusername'
    visudo

Go to the end of the file and add the following line:

    myusername ALL=(ALL) ALL

And save the file. Logout and then back in with the new username.

Bring the slice up to date with the following commands:

    sudo apt-get update
    sudo apt-get dist-upgrade
    #Restart the slice
    sudo shutdown -r now

We’re going to deviate from apt-get here a little bit so that we can install the latest and greatest version of Ruby from rubyforge. Before grabbing Ruby, we need to install a few tools and create a directory for our source files first:

     sudo apt-get install build-essential curl
     mkdir /home/myusername/sources
     cd /home/myusername/sources

To use Ruby 1.8.6, you have to install it manually instead of using apt-get. Here’s the steps:

    curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p111.tar.gz
    tar xzvf ruby-1.8.6-p111.tar.gz
    cd ruby-1.8.6-p111
    ./configure --prefix=/usr
    make
    sudo make install
    sudo ln -s /usr/bin/ruby /usr/local/bin/ruby
    cd ..

Now when you type:

ruby -v

You should see:

ruby 1.8.6 (2007-09-24 patchlevel 111) [x86_64-linux]

Now that Ruby is installed, Ruby Gems can be installed. Everything is much easier after this.

    curl -O http://files.rubyforge.mmmultiworks.com/rubygems/rubygems-1.0.1.tgz
    tar xzvf rubygems-1.0.1.tgz
    cd rubygems-1.0.1
    sudo ruby setup.rb
    sudo gem update
    cd ..

That’s it. A bit of a pain but at least everything is set up and good to go. The next step is to get Rails and Mongrel installed. After that, Apache, mongrel clusters and MySQL need to be setup. Finally, things should be ready for Capistrano!

[Post to Twitter]  [Post to Plurk]  [Post to Yahoo Buzz]  [Post to Delicious]  [Post to Digg]  [Post to Ping.fm]  [Post to Reddit]  [Post to StumbleUpon] 

2 Responses
  1. 2008 March 3

    I have heard nothing but good things about Slicehost. One of my contractors (http://blog.enspiredsoftware.com) out of Floria made the move to them recently and is pretty happy there also. My personal hosting is up soon I think I’m going to make the switch over to them also.

    I would recommend putting nginx or thin out in front of your clusters rather then Apache. Yes Apache it is the defacto standard for the web but all that versatility comes with so much bloat. I’m assuming you have a slice with 256Mb of RAM. The memory footprint of nginix is tiny when compared to Apache, and you will get far better performance.

Comments are closed.