Greg Benedict

Thoughts on the web and creativity.

A Full Rails Stack With RM-Install on Ubuntu

Updated: I’ve added info to modify the /etc/profile script to load the path vars for all users.

Five Runs has just released an installer for automating the installation process of a full rails stack based on either a development or production environment. Included in the install are:

  • Ruby 1.8.6
  • Rails 1.2.3
  • MySQL 5.0
  • SQLite 3.3
  • Subversion 1.4
  • Apache HTTP Server 2.2 (Production mode)
  • OpenSSL
  • ImageMagick 6.3
  • Mongrel/Mongrel Cluster
  • Capistrano
  • Gruff
  • Rake
  • RMagick

The install is a binary executable that will run command line or as a gui application. There are currently two versions: linux and OS X 10.4.x.

To get started, I’ve setup Ubuntu 6.06 LTS server in Parallels on my Mac Book Pro. Note that I used that alternate install disc instead of the server or desktop discs. There is a known issue with the server disc that causes it to hang on reboot. You can grab the desktop(live cd), server or alternate disc here: http://osmirrors.cerias.purdue.edu/pub/ubuntu-releases/6.06.1/

If you choose the alternate disc, simply enter server at the command prompt to install it. Using the defaults you’ll be in great shape.

Once you are setup, login to you ubuntu server via the terminal or SSH. You’ll need to download rm install now. Skipping registration, the download page is here: http://www.fiveruns.com/products/rm/install/download. Be sure to choose the linux version. Here is the version as of me writing this:

wget http://www.fiveruns.com/downloads/rminstall-1.0.1-linux.bin
chmod 755 rminstall-1.0.1-linux.bin
sudo ./rminstall-1.0.1-linux.bin

Be sure to sudo when running the script or it will drive you crazy why you can’t setup Apache on port 80.

Here’s where the boring part comes in. With the command line install you have to page (via the enter key) WAY TOO MUCH to read all of the EULAs! I just held down the enter key until I saw a yes/no accept prompt, and hit yes.

Depending on your install you’ll choose the developer or server install. I’ve used the server install here.

From there, I chose to install to /opt/rminstall/ rather than the default ~/rminstall. It makes more sense to me to have it in a convenient shared place that is common to every server or desktop install.

The server install includes mongrel cluster and apache with the load balancing option all setup, where the developer path does not. Other than that, they are identical.

Once installed, they recommend that you setup a .proflie to auto load the paths correctly. Ubuntu (Debian as well) uses a .bash_profile instead, so it’s slightly different. You’ll need to run this for all users who need access.

echo "source /opt/rminstall/scripts/setenv.sh" >> ~/.bash_profile

Update: You can also add this to the /etc/profile file to make it load for all users!

sudo vi /etc/profile

At the top of the file, put the following 3 lines:

if [ -f /opt/rminstall/scripts/setenv.sh ]; then
. /opt/rminstall/scripts/setenv.sh
fi

You can now logout and log back in and you’ll be able to type ruby -v, rails -v or other commands such as mysql and rake.

This really is a blazingly fast install (< 10 minutes in a VM!). Configuring ImageMagick has always been a pain in the ass and this just makes life easy.

Check it out. It works great!

5 ResponsesLeave one →

  1. Thank you so much for this small tutorial. I was seriously held up on how to install this at the command line and was fearing I’d have to load the graphical version of Dapper Drake just to try this install out. I was trying to mount the .bin and all sorts of things. chmod was part of my issue but your post cleared that all up.

  2. chap

     /  November 29, 2007

    I’m having a hell of a time knowing what to do after all this is installed. I can do the typical script/server in the app folder, but that just serves my app at 0.0.0.0:3000 when I’m trying to get the server to put it at my.ip.address:80 (at least that’s where I think I want it so that it can be accessed by the world) I just don’t know if I’m suppose to start mongrel, mongrel clusters, apache, or do a capify?

    Any thoughts on the next steps after setting up rminstall on my server?

  3. gbenedict

     /  December 17, 2007

    @Chap – The best place to start is with the mongrel documentation as it walks through several examples.

    http://mongrel.rubyforge.org/docs/index.html

    Also, 0.0.0.0:80 listens for requests on all ip addresses on port 80. If you specify an ip address, such as 192.168.1.100:80 it limits it to just that IP. the benefit of using the zeros is that you can access it as localhost, 127.0.0.1, or the actual IP of the machine. That can help with troubleshooting if you are running a front end proxy like nginx, Lighttpd or Apache.

    One other resource I highly recommend is to have a look at Ezra’s Deploying Rails Applications: http://www.pragprog.com/titles/fr_deploy. It walks through and explains exactly what you need help with and is worth the $22 for the PDF.

  4. Hi,
    Im running rm-install developer version on Ubuntu hardy. I am unable to set the environment variables using the above methods. My installation directory is /opt/rminstall-1.1-0/ so I modified the command accordingly. But it still returns ‘command not found’ when i type rails -v.
    Any thoughts on what might be the problem?

    Thanks.

  5. @Sandip – What happens if you type `whereis ruby` at the command prompt? It could be a couple of things happening.

    1) the paths aren’t right
    2) the profile hasn’t been loaded
    3) things related to the profile have changed in Hardy vs 6.06LTS. I haven’t used the latest releases to verify this still works.

Leave a Reply