Setting up Ubuntu 11.04 for Rails development

The setup for Ubuntu 11.04 almost identical to the 10.10 setup.

First, install the necessary packages and a system Ruby (1.8.7). RVM will ignore the system installed Ruby, but in my experience you will save yourself a lot of hassle by having a system-installed Ruby.

sudo apt-get install ri ruby ruby1.8 ruby-dev rake libruby1.8 zlib1g-dev libssl-dev libreadline5-dev libncurses5-dev build-essential curl git-core git-gui gitk libxml2 libxml2-dev libxslt1-dev bison autoconf

Then install RVM (see the RVM website for the latest installation instructions).

bash < <(curl -s

Then run the following command, and… READ THE NOTES!

rvm notes

Make sure you read the RVM post-installation notes. You will get an updated list of OS dependencies and instructions on how to modify your .bash file. If you don’t do this you will probably drive yourself crazy trying to get RVM to work. You will fail.

Finally, install whatever rubies you want:

rvm install 1.8.7-head
rvm install 1.9.2-head

Then install MySQL (and the MySQL GUI tools)…

sudo apt-get install mysql-server libmysqlclient-dev libmysql-ruby mysql-admin

Happy coding!


6 thoughts on “Setting up Ubuntu 11.04 for Rails development

  1. Hi there, I am new to Ubuntu and am trying to install rails on it. I have successfully followed the instruction here and on the RVM website about setting up the .bash_profile

    user$ echo ‘[[ -s “$HOME/.rvm/scripts/rvm” ]] && . “$HOME/.rvm/scripts/rvm” # Load RVM function’ >> ~/.bash_profile

    I’ve done so and restarted the terminal and typed

    source .bash_profile

    then rvm will be available as a function in this terminal. My first question is, is there a way to automatically do the source .bash_profile line each time the terminal is open so I don’t have to type it? Because if I don’t run it manually, rvm is not available.

    Secondly, I was following the Agile Web Development with Rails guide before I came across your post, so I have this Ruby 1.8.7 installed So now, even though I have done the rvm install 1.9.2-head, but whenever I do

    rvm system

    the terminal returns to 1.8.7 Also, even after I do a rvm use 1.9.2, and then, say, sudo gem install rails. that gem doesn’t appear in the 192 stack but appears in the 187 stack (!) How strange.

    My apologies for asking so many question but I couldn’t find any solution on myself on the web as of yet.

    Thank you for your time

    1. It sounds like you have something wrong with your bash setup. I can’t give you exact instructions because the RVM instructions are subject to change, which is why I emphasize that you should carefully read the instructions after the RVM installation step. I suggest you re-run the installation and follow the post-install instructions carefully.

      If you are using RVM there is almost no need to use the system ruby – why else would you be using RVM? With RVM you should NEVER use “sudo” when installing gems as this will install the gems to your system ruby and not the current RVM ruby. Don’t use sudo with RVM.

      Hope that helps.

      1. Thanks Ed, I removed RVM, followed the instruction to install the readline and zlib lib, then reinstall rvm and indeed, I don’t have to sudo to gem install anymore and everything now works!

        Thanks again!

  2. I think this is one of the most important info for me.
    And i am happy studying your article. However should remark on few general things, The websitte taste
    is perfect, the articles is really excellent :
    D. Excellent task, cheers

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s