This is the second part to getting a Windows machine set up for Ruby on Rails Development by having Ubuntu running inside Virtualbox. View Part 1 here. Today’s screencast will walk through installing Ruby, rubygems 1.3.5 and Rails with rubygems, and SqLite3 as well as installing my preferred code editor Komodo Edit. Watch the screencast or read below for the written instructions.
This same procedure has now been tested on Ubuntu 9.10 and works fine.
To install Ruby in Ubuntu we can simply install from the built in repository in Ubuntu. You don’t need to compile this from source if you don’t want to.
[bash]sudo apt-get install ruby-full build-essential[/bash]
Now let’s see what version of Ruby we have.
This should return something along the lines of:
[bash]ruby 1.8.7p5000 (2009-02-22) [i686-linux][/bash]
And finally let’s check to make sure the Ruby library is working.
[bash]ruby -ropenssl -rzlib -rreadline -e ‘puts :Hello'[/bash]
Installing Ruby Gems
Ruby Gems should be compiled from source using the latest version of Ruby Gems. The first line of bash I run just runs two commands one after the other.
tar -xzvf rubygems-1.3.4.tgz
sudo ruby setup.rb
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
Nothing shows as output form the last command. It creates a symbolic link.
[bash]sudo gem install rails[/bash]
Testing Your Rails Installation
Now that we have Ruby on Rails installed properly we should test it just to be sure.
Now open up Firefox and enter “localhost:3000” into your url bar. You should see the standard Ruby on Rails starting app page.
As you’ll notice in the screencast Rails works but gives a warning and I wasn’t sure what it was. Thanks to Brian Mayle who helpfully points out the answer in the comments. We still need to install the sqlite3 connector. So run the following two lines and you’ll be right as rain.
sudo apt-get install libsqlite3-dev
sudo gem install sqlite3-ruby
Finally we’re going to install Komodo Edit which is my preferred code editor for Ruby on Rails projects. I have tried Bluefish, Netbeans and many other but just keep coming back to Komodo Edit as superior for how I work.
Start by downloading Komodo Edit and just directly opening it in the Archive Manager. Drag the resulting folder onto your desktop and jump back into the terminal and run the commands below.
Now it’s going to ask where you want to install your software. I like to keep things organized so I install all of the custom apps inside my Home folder in a folder called software. Run the following commands to accomplish this.
Next we have to insert the executable in our PATH variable with the command below.
sudo ln -s ‘/home/myuser/Software/Komodo-Edit-5/bin/komodo’ /usr/local/bin/komodo
Now you’ll have a new ‘icon’ on your desktop that says ‘komodo-edit-5.desktop. This is the actual icon to launch the application but first we need to right click on it select ‘Properties/Permission” and check the box that allows executing as a program. You should now see the proper Komodo Edit Icon.
I like to drag this icon into the software folder we created and then from there drag it into the top bar in my Ubuntu installation so I can launch the application easily.
Now we have a working Ruby on Rails development environment with a working code editor. If you have any questions let me know in the comments.