I’m starting my foray into Ruby, Rails, and all things Ubuntu! It’s quite a learning curve, but I have a mentor (a real person, not Google!) that is helping me through this process. That said, I do prefer to at least try and figure things out on my own, and installing Ruby for Rails on the latest version of Ubuntu was no easy task! It seems straight forward, but it was definitely a “take one step backward for every two steps forward” process. Here’s how I finally got it working to point where the Rails server comes up and I can browse to the welcome screen.
First, I am running Ubuntu as a VM using Virtual Box, version 4.1.22 and with the virtual box extensions. To do this:
- Downloaded Ubuntu 12.10 from here.
- I upped the default memory allocation to 1GB and dedicated 3 processors
- For some reason, this download uses the Italian keyboard layout by default, so the first order of business was to get the keyboard configured for English (US), which was easily enough done through the “System Settings” icon.
Now for Ruby on Rails. This was not straight forward:
Open a Terminal and in the following:
sudo apt-get install git-core
sudo apt-get install curl
sudo apt-get install zlib1g-dev
sudo apt-get install libyaml-dev
sudo apt-get install libsqlite3-dev
sudo apt-get install nodejs
sudo apt-get install build-essential
curl -L get.rvm.io | bash -s stable –ruby –rails
You should not get any message that you need to do anything else, so:
Now comes the bizarre part, and I haven’t figured out a way around this–spent about half a day trying though. I suspect you can chalk this up to my noobie Ubuntu experience. Anyways, you have to uninstall Ruby because Rails requires openssl, and Ruby needs to be reinstalled with a specific option. Like I said, I did not find any way of doing this in a way that didn’t require the uninstall. So, type this:
rvm remove 1.9.3
rvm pkg install openssl
rvm install 1.9.3 –with-openssl-dir=$HOME/.rvm/usr
press q again.
Finally, do this:
rvm use 1.9.3 –default
gem intall execjs
gem install therubyracer
You should now be able to create a default Rails website:
rails new RailTest
and start the Rails server:
and browse to the welcome page in Firefox at localhost:3000
At the time of this writing, this installed (I’m not detailing everything!):
- rvm 1.16.17
- ruby 1.9.3p286
- gem 1.8.24
FYI, I recently stumbled across this blog detailing very similar instructions, but I haven’t actually tried it and I note that he is installing an older version of Gem.