Installing Ubuntu Feisty Fawn on Virtual PC to Run Ruby on Rails

This post follows a 14 hour struggle to get going on my Windoze Vista and my Windoze XP machine. I’ve been doing PHP development for a little while now, and have been using Xampp on both of my machines to create a local server for web-development. Recently we made a decision to build one of our in-house sites with Ruby on , to take advantage of its agile nature, plugin modules, and overall speed of development. Boy was I in for a surprise.

Apparently, you cannot install Instant Rails, unless you want to try to figure out how to merge your 2 instances of Apache, and MySQL that are now running. In my hours of hunting, I could not come across a Rails plugin for Xampp. I tried to do a stand-alone rails install, and manually configure it, but then I could not use localhost for anything other than Ruby. This whole time, all I can think is that if I only had a Mac… but wait, I have an idea.

I’m a big fan of Windows Virtual PC 2007, so why not try to just set-up a Virtual instance, and . Plus, once I get it set up, I can copy the Virtual PC hard-drive, and pass it around the office to everyone having the same problem I am.. BRILLIANT. For the record, I am writing this as I do it, so if I encounter FAIL, I’ll retitle, and post this in hopes someone can help.

Step 1Install Virtual PC 2007. This is one of the few free things that Microsoft offers, so I highly recommend you take advantage of it. You will find it to be quite versatile… I like the idea of running everything in a virtual PC, so if I need to buy a new computer, I don’t loose all my software and settings.. I just copy the Virtual Hard Drive, and BAM!, I’m ready to go. I also spec’d a lightweight machine, and copied it over to a thumb drive with a copy of the Virtual PC install file.. now I can load my personal PC on any windows machine.

Step 2Download Ubuntu 7.04 and Create a Virtual Machine. I am using a desktop version of Feisty Fawn, and can vouch that what I lay out here will work for this version only. To keep focus, I’m going to point you to Mike Kolitz for a detailed tutorial to install on Virtual PC. For some reason, some unanswered “issues” are not referenced though, and the answers are spread out, so if you encounter problems with video resolution, sound, networking (first click network, then wired), mouse, or system time < — check out the links. Please note – the install process takes about an hour, so try going for a jog, or pancakes..or both!

I edited the settings for my Virtual Machine to enable an “undo” function for the virtual drive. This way I could play with some of these “fixes” without worry of putting myself back to zero. When I make a system configuration change and it is successful, I go to the action menu, select close, and then select save state save changes (so I don’t have to wait on a reboot).

(Optional) Do a quick check for updates by going to terminal and typing (without quotes) “sudo apt-get update && sudo apt-get upgrade”. This will probably take a little while, so go grab a bottle of wine or a few beers and start drinking!

Step 3Install LAMP – Thanks to Joe Raad for the wonderful walk-through. If you follow his instructions, you’ll have no problem, and you get the benefit of installing through apt-get vs. some package, which is one of many AWESOME Linux functions. Unlike Windows, Linux uses the apt-get function to update not only your OS, but also all of the programs.. pretty sweet! We’ll try it out once we wrap up the Ruby install.

Step 4 – Install Ruby on Rails –

-Start with Ruby using apt-get

~$ sudo apt-get install apt-get install ruby rdoc irb libyaml-ruby libzlib-ruby ri libopenssl-ruby ruby1.8-dev build-essential

-Install Gems from source (we are not using apt-get here because Gems updates itself and Rails, and we don’t want to confuse apt-get

~$ wget http://rubyforge.org/frs/download.php/34638/rubygems-1.1.0.tgz
~$ tar -xvzf rubygems-1.1.0.tgz
~$ rm rubygems-1.1.0.tgz
~$ cd rubygems-1.1.0
~$ sudo ruby setup.rb


-Allow Ruby Gems to update itself (and make sure gem installed properly)

~$ sudo gem update --system

If you get a gem: command not found error.. create a symbolic link by executing this:

~$ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

-Now, we install Rails using Ruby Gems

~$ sudo gem install rails
~$ PATH=${PATH}:/var/lib/gems/1.8/bin/
~$ export PATH

-Add the Driver for MySQL

~$ sudo apt-get install libmysql-ruby

Alright, now that the grunt work is over, you can start building some applications. Have fun!


Update 05/03/08

I finally got it working on Windows – check it out


Update 04/15/09

If I want to use Ruby on Rails (ROR) I dual boot to Linux vs. fighting to install Rails on Windows machine.

Tags: , , ,

Posted in Technology | 25 Comments »

  • http://joeabiraad.com Joe Abi Raad

    Nice I like it 🙂

    // Jo

  • http://joeabiraad.com Joe Abi Raad

    Nice I like it 🙂

    // Jo

  • Pingback: Install Xampp and Rails on a Windows Machine | Grape Thinking

  • Jake

    Thanks Joe, you really made the process a heck of a lot easier for me. I wish everyone’s tutorials were so straight to the point and easy to follow.

  • SuperGNU

    Thanks for a great article!
    My only problem is I can’t get it up and running… I’m on a XP SP2 pc running the latest versions of all the required installers. My xampp apache runs fine without the mods in httpd.conf, but as soon as I put your stuff in there it simply won’t start. During your installation instructions I didn’t run into any problems at all except a little confusion about wich gem updates to choose, so I put my money on win32 versions all the way.

    Any ideas on what might be wrong?

  • SuperGNU

    Thanks for a great article!
    My only problem is I can’t get it up and running… I’m on a XP SP2 pc running the latest versions of all the required installers. My xampp apache runs fine without the mods in httpd.conf, but as soon as I put your stuff in there it simply won’t start. During your installation instructions I didn’t run into any problems at all except a little confusion about wich gem updates to choose, so I put my money on win32 versions all the way.

    Any ideas on what might be wrong?

  • http://tastevine.com Jake

    @SuperGNU

    Thanks for the props!

    When you say “it simply won’t start”, what exactly is not starting.. Apache? MySql? Rails Server?

    Just to check, you are following all of the steps at Getting Rails To Work On A Windows Machine Running Xampp, and not the steps in this article, correct?

    For the record.. if you are just interested in running Rails, and not interested in a php library… I’d uninstall Xampp, and just go with InstantRails Just make sure you unzip it properly.

  • http://tastevine.com Jake

    @SuperGNU

    Thanks for the props!

    When you say “it simply won’t start”, what exactly is not starting.. Apache? MySql? Rails Server?

    Just to check, you are following all of the steps at Getting Rails To Work On A Windows Machine Running Xampp, and not the steps in this article, correct?

    For the record.. if you are just interested in running Rails, and not interested in a php library… I’d uninstall Xampp, and just go with InstantRails Just make sure you unzip it properly.

  • http://tastevine.com Jake

    Oh.. and another thing.. Try restarting your computer, and then restarting Apache… If you modified the httpd.conf without shutting down Apache server, it can cause problems…

  • http://tastevine.com Jake

    Oh.. and another thing.. Try restarting your computer, and then restarting Apache… If you modified the httpd.conf without shutting down Apache server, it can cause problems…

  • SuperGNU

    Well, I’ve now installed everything all over again just to rule out any mistakes. I’m certain I used the right guide 🙂

    My problem is the apache service. After modifying conf file it won’t start. When I press “START” button in the control panel it just says “Apache service started” but nothing happens. I also tried starting it through windows services but only got an error message (service spesific error 1). If I remove the modifications in conf file the apache starts up as normal. MySQL runs fine on both.

    For the record I’ve been developing php in my spare time for years, but used XAMPP as I’ve got little interest in running a real server only for testing apps. I’m about to digg myself into Ruby, but I’ll still be using php for many projects, so I’m really just looking for a way out of the multi-virtual-pc crap I’ll be stuck with if I can’t get this to work proporly 🙂

  • SuperGNU

    Well, I’ve now installed everything all over again just to rule out any mistakes. I’m certain I used the right guide 🙂

    My problem is the apache service. After modifying conf file it won’t start. When I press “START” button in the control panel it just says “Apache service started” but nothing happens. I also tried starting it through windows services but only got an error message (service spesific error 1). If I remove the modifications in conf file the apache starts up as normal. MySQL runs fine on both.

    For the record I’ve been developing php in my spare time for years, but used XAMPP as I’ve got little interest in running a real server only for testing apps. I’m about to digg myself into Ruby, but I’ll still be using php for many projects, so I’m really just looking for a way out of the multi-virtual-pc crap I’ll be stuck with if I can’t get this to work proporly 🙂

  • SuperGNU

    Oh, and I’ve tried rebooting my pc. Didn’t do much for me *sigh*.
    Do I have to run some command to start the rails server?
    I get nothing on http://localhost:3000

  • SuperGNU

    Oh, and I’ve tried rebooting my pc. Didn’t do much for me *sigh*.
    Do I have to run some command to start the rails server?
    I get nothing on http://localhost:3000

  • http://gostep.org Jake

    try typing the following in command line after apache is running.

    ruby scriptserver

    Once you edit the .conf you can still browse to localhost for the apache and friend page right?

  • http://gostep.org Jake

    try typing the following in command line after apache is running.

    ruby script\server

    Once you edit the .conf you can still browse to localhost for the apache and friend page right?

  • SuperGNU

    nope, as I can’t start apache localhost is directed towards a service who’s not here, giving me a “Page Not Found”.

    I tried running [cmd -> ruby scriptserver] with no results.
    The apache isn’t running, so it returns:
    ruby: no such file or directory — script/server (load error)

    It’s like the service itself get jammed when I start it up, cause I get no form of error msg from the xampp control panel.

  • SuperGNU

    nope, as I can’t start apache localhost is directed towards a service who’s not here, giving me a “Page Not Found”.

    I tried running [cmd -> ruby script\server] with no results.
    The apache isn’t running, so it returns:
    ruby: no such file or directory — script/server (load error)

    It’s like the service itself get jammed when I start it up, cause I get no form of error msg from the xampp control panel.

  • http://tastevine.com Jake

    Hi SuperGNU.. I have updated the post at Getting Rails To Work With Xampp on Windows There was a missing bracket in the httpd.conf file. If you copy and paste, it will work.

  • http://tastevine.com Jake

    Hi SuperGNU.. I have updated the post at Getting Rails To Work With Xampp on Windows There was a missing bracket in the httpd.conf file. If you copy and paste, it will work.

  • gm

    @superGNU, I had a very simliar problem and spent forever trying to get it going. It ultimately led me to stop with Rails and move to Django, and some php now too. Rails may be saturated – you see stuff like Heroku and twitter getting off rails

  • gm

    @superGNU, I had a very simliar problem and spent forever trying to get it going. It ultimately led me to stop with Rails and move to Django, and some php now too. Rails may be saturated – you see stuff like Heroku and twitter getting off rails

  • http://tastevine.com Jake Bohall

    Compile Ruby to Python For those of you wanting to make the switch from RoR, here’s a cool tool

  • http://tastevine.com Jake Bohall

    Compile Ruby to Python For those of you wanting to make the switch from RoR, here’s a cool tool

  • Pingback: How to install Ruby on Rails on almost any popular Operating System? | Vinsol

Categories

Archives