11 Comments »

Agenda

Most students using Linux in this course are using Ubuntu, so that’s what I’m going to demo: Ruby/Rails setup on Ubuntu. There were a number of RedHat/Fedora people: try rpm instead of aptitude; it should be very similar. For SuSE, use yast. If you get in a real jam, send me some e-mail. I might possibly do an additional screencast for RedHat/Fedora, and I would gladly welcome a student-made screencast, if you can figure out how to do it.

One thing I mention below is that for Linux, you conduct some of the installation through Linux system tools (aptitude, rpm, yast, etc.) and some through the Ruby “gem” mechanism. One mildly confusion bit is that the MySQL database is installed with the Linux system tool, but the MySQL gem, which provides better performance, happens through gem. It is possible to install Rails itself through the Linux system tools, but it will usually be an older version. In short, make sure you’re using the right tool for the right component.

I have a bunch of Linux systems set up, but I don’t know how to record a screencast on them, and also I don’t think I should destabilize them since they’re all set up just right. So what I’m going to do is set up Linux on a virtual machine running under Windows, and I’ll make a screencast of that.

NOTE: My office building is closed this weekend, so I won’t be able to use my regular screencast software and headset. This means that the volume may be low, and the mouse-tracking won’t be as good. I think this is pretty straightforward, so the visual data should be enough.

Here’s what happens the screencast:

  • Download and install the VMWare Player (I’ll only show the result of this…). This is free software that can run WMWare virtual machines. There are versions for Windows and for Linux. Also, the VM should work in the new Mac Fusion product from VMWare, which you can download and test for 30 days. The VMWare Player comes from here: http://www.vmware.com/download/player/download.html
  • Download Ubuntu 7.04 Server from http://www.thoughtpolice.co.uk/vmware/
  • Start up the VMWare Player by clicking on the VM’s .vmx file. If you try this at home, you may get asked a question about creating an id for the VM. You do want to go ahead and select “create.”
  • The login credentials for the VM we’re downloading are: username: notroot password: thoughtpolice
  • One reason I decided to use that site for the VM was because of the password. When I taught at Ohio State, I used to teach a semester-long course in the writings of George Orwell (who wrote Nineteen Eighty-Four). But I digresss…
  • For Linux, we want to use the installer that comes with the distro for everything that isn’t installed as a gem. At the same time we’ll install the ssh server, MySQL, all the software used for building code from C, the MySQL development support stuff, as well as Firefox. Firefox depends on X-Windows, so we will get that, too. It will take some time to install all of this stuff!
  • So that command is (all on one line):
    sudo aptitude -r -y install ssh ruby1.8 rubygems
    irb ri rdoc mysql-server-5.0 build-essential
    libmysqlclient15-dev firefox
  • You might type time sudo aptitude ... so that you can go off for coffee and still see how long it takes.
  • The next step is to install the gems
    gem install rails --include-dependencies
    gem install mongrel --include-dependencies
    gem install mysql --include-dependencies
  • Note that the runnable code for the gems end up in /var/lib/gems/1.8/bin, and you will need to add this to your path. So edit .bashrc and add this line at the end:
    export PATH=/var/lib/gems/1.8/bin:$PATH
  • For the install verification, you need to check the versions for the installed code; you also need to grab a screenshot that shows what happens after you go to the default Rails web page and click on the link to see your setup. For this to work, you have to run the browser locally. This will be easy on your own computer, but for my setup, it will require me to use X-Windows to actually run Firefox on the virtual machine. Watch the video for this. As I say, for you it’s easy, for me there are extra steps.
  • NOTE: At the end of the first screencast, you see me picking which version of the mysql gem to install. The video ends with me picking 2, but actually 3 was right: I was being fumble-fingered and the video ran out before it caught me doing the right thing.

View (you will want to maximize your browser; to go “full-screen” in Firefox, press F11; then to turn off full-screen, press F11 again)