Posted on:
August 19, 2010
by Wolfram Arnold

Ubuntu 10.10 (Maverick) Installation from Scratch and Setup for Ruby-on-Rails Development

My steps to install Ubuntu 10.10 (Maverick) from scratch and setting it up for Ruby-on-Rails Development.

These notes started while setting up 10.04 from scratch and were expanded upon when I set up a second machine a little later with 10.10. Generally the installation process is pretty smooth, the only real glitches I had were figuring out the right combination of USB stick preparation and USB BIOS settings to get it to boot, and then fiddling with my nVidia graphics card. 10.10 was better than 10.04 in terms of installation and I expect the trend to continue with future releases.

This post comes in these main sections. Feel free to skip ahead if you’re already got a system up and a basic understanding.

Booting from USB Stick

I prefer USB Boot, rather than burning a throw-away copy of the installation CD. You’ll likely only need this once (per machine), and a wasting a CD every time bothered me. Burning a CD may be an alternative method, if you’re running into too many issues with preparing the USB stick.

Making a USB boot stick

I largely followed the Ubuntu Guide for Preparing Files for USB Memory Stick Booting, it has useful information and download links for images.

Assuming your USB stick is attached on /dev/sdb, run the partitioning tool:

    sudo cfdisk -z /dev/sdb

Use the menu to make a new primary partition, choose Type “1c” (fat32 lba), and mark it bootable. Then save it to disk.

WARNING/DISCLAIMER: BE EXTRA SURE THAT YOUR ARE RUNNING CFDISK AGAINST THE CORRECT DEVICE! THIS COMMAND WILL IRRECOVERABLY WIPE OUT THE CONTENTS OF THE SPECIFIED DEVICE/DISK!!!

A trick I use to figure out which device was mounted after inserting the USB stick is to take a look at /log/syslog and watch for the most recent entries about attached USB devices. It’ll specify the devise handle in there.

Now, after partitioning, it’s time to format the stick with a file system, we choose FAT32, because any BIOS can read that. Note well that if the device is attached to /dev/sdb, then you now have a partition numbered 1, accessible as /dev/sbd1 and that’s the one you want to format. Note the 1.

    sudo mkfs.vfat /dev/sbd1

Choosing an Image

Now you can follow the Guide and the download link therein for the netboot image, to put the minimalist netboot image on the stick. The netboot image doesn’t contain most of the packages, but only the necessary installer files to get the maching up and running, set up a network connection and will then download all the latest packages.

If this doesn’t work for you, you can also download one of the standard distribution images from the Ubuntu 10.10 Releases Page. For a Ruby-on-Rails development system, pick the Desktop release, and be sure to choose the 64-bit version! Unless you have some very specialized embedded needs or ancient hardware, 64 bit has been standard for years (at least in the Linux world), and 3rd party tool & software support is much better.

You may also choose the alternate installer which runs in text mode, in case you’re having trouble with a graphics card (see below). The alternate installer also gives you an option that the standard installer does not, and that is setting up your main disk in LVM mode with encryption. This is advisable on a multi-user server. On a single-user machine, e.g. a laptop, you can setup disk encrpytion at the user-level which is sufficient for most single-user environments. See these links for a discussion on LVM and encryption: Ubuntu Wiki Security Features, Discussion on LVM and LVM2 by IBM, and discussion by The Linux Project.

After you download the image, it’s probably a good idea to check its MD5SUM. The expected value are here.

If you’re already running a prior Ubuntu distribution, just use the “USB Creator” tool, System -> Administration -> Startup Disk Creator to transfer the image the the USB stick prepared above.

Unmount the USB stick, and put it into the new machine you want to setup. It should just launch the installer and guide you through the menus.

Troubleshooting

ASUS motherboard

I ran into one problem with an ASUS A8N-E motherboard, where it wouldn’t list the USB stick as boot device in the BIOS, but when holding down F8 to show boot menu it was a mounted drive and works.

I also needed to turn on legacy USB support in the BIOS, in order to avoid freezing of USB my keyboard, when the USB drive is inserted.

Boot failure

If the USB stick boots up to “SYSLINUX” and then hangs, that means that the USB stick needs to be formatted. Similarly, if the USB Creator tool gets stuck at “Starting”, this also indicates the USB stick needs formatting.

nVidia graphics cards driver

nVidia cards are notorious for not playing nice with the default installer, because of driver issues. The tell-tale sign for this is an all-black screen with a blinking cursor where things just seem to stop. In that case choose the “alternate installer” from the Releases Page which runs in text mode and should work.

You can also stick with the graphical installer and set some custom kernel parameters to appease the driver. See this article for a discussion and workaround. One key bit that was missing from this reference is that you need to hold down SHIFT to reveal the Grub boot menu. It’s important to get into the Grub menu before it’s booting. See the Grub2 documentation for details.

Following this article, I added nomodeset to the linux /boot/vmlinuz-2.6... line, then booted up the system, pressed “e” and got to a “Recovery Menu” in text mode. Drop to the shell root prompt and open /etc/default/grub, e.g. using nano, and add nomodeset to GRUB_CMDLINE_LINUX_DEFAULT. This will make this setting permanent, for every reboot. Exit and return to the “Recovery Menu”. Next, pick “grub” to update grub bootloader, i.e. write the default options just changed in /etc/default/grub to the boot sector on disk. Then, resume boot.

If you’re using the alternate installer instead, at end, after it asks to install grub boot loader, say “yes”. Then is asks to reboot with options “continue” and “go back’. Choose “go back” and it’ll drop you to the installer main menu.

Execute a shell, the disk will be mounted to /target. Check that nomodeset is listed in options.

Install nVidia H/W proprietary driver from UI, and notice after reboot a message for low graphics mode. Drop to the command line, login and run sudo nvidia-xconfig. That should fix it.

The proprietary driver that ships with Ubuntu 10.10 is version 173.x and is obsolete for newer cards. You should install a more up-to-date driver from nVidia which will have fewer issues, also with suspend/resume, dual monitor support, etc.

    sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
    sudo apt-get update
    sudo apt-get install nvidia-current nvidia-settings

Then activate with Administration -> Additional Drivers -> Select current

nVidia graphics cards suspend/resume

If you have a suspend/resume problem with nVidia’s proprietary driver edit /etc/X11/xorg.conf and add in the Section “Device”:

    "Option "NvAGP" "1"

See here for details.

In /etc/defaults/acpi-support add:

    # Set the following to "platform" if you want to use ACPI to shut down
    # your machine on hibernation
    HIBERNATE_MODE=shutdown
    # Should we save and restore state using the VESA BIOS Extensions?
    SAVE_VBE_STATE=false
    # Should we attempt to warm-boot the video hardware on resume?
    POST_VIDEO=false

nVidia graphics card power modes

nVidia graphics cards can be power hungry which significantly shortens battery life on laptops. There are various kernel driver settings that control the power modes.

This blog post has been very helpful.

Post-Installation Guides

Install Flash Player

Flash should install via the Ubuntu software package mangers. Run Synaptic and under Settings -> Repositories be sure to check “Community-maintained”, “Proprietary drivers” and “Software restricted by copyright”. Then you should be able to just find the “flashplugin-installer” and install it. This is the preferred way.

If that for some reason doesn’t work, here are manual instructions with download from Adobe.

Adobe has discontinued its fledgling support for a native 64-bit flash player on Linux. In fact, Adobe doesn’t seem to offer 64-bit flash players on any OS. This is worse on other OS’s because Adobe recommends to use a 32-bit browser. In Ubuntu, luckily a mechanism has been devised to run a 32-bit browser plugin for a 64-bit browser, the so-called “nspluginwrapper”.

  1. Download flash for linux as tar.gz from: http://get.adobe.com/flashplayer/
  2. Extract libflashplayer.so
  3. Copy the file to /usr/lib/mozilla/plugins
  4. Run sudo nspluginwrapper -i /usr/lib/mozilla/plugins/libflashplayer.so Note: This command requires the absolute path!
  5. Run sudo ln -s /usr/lib/nspluginwrapper/plugins/npwrapper.libflashplayer.so /usr/lib/firefox-addons/plugins
  6. The same works for Chrome, just make a symlink to its plugin directory: sudo ln -s /usr/lib/nspluginwrapper/plugins/npwrapper.libflashplayer.so /usr/lib/chromium-browser/plugins

Here is an instructional video

You may also need to create a file /etc/adobe/mms.cfg containing: OverrideGPUValidation=true This is because Flash places fairly stringent requirements on the GPU and the software environment, and they don’t have a good way to test for it, so that their test might give a false negative. More details: http://blogs.adobe.com/penguinswf/2008/08/secrets_of_the_mmscfg_file_1.html http://blogs.adobe.com/penguinswf/2008/05/flash_uses_the_gpu.html

Check Flash Player

To verify you’ve got the correct version, type “about:plugins” into url field of Firefox or Chrome. It should be Shockwave Flash 10.2.x This makes Hulu finally enjoyable on Ubuntu Linux.

Fingerprint reader

http://rohitexplains.blogspot.com/2011/02/getting-fingerprint-reader-to-work-on.html

Development Tools

Open File Handles

If you’re running a Java-based IDE for development such as RubyMine or Eclipse, the default limit for open file handles (open file descriptors) in Linux is insufficient. ulimit -Hn show the “hard” limit, and ulimit -Sn the “soft” limit. The hard limit cannot be increased by a non-root user, the soft limit may be increased up to the hard limit.

Edit the file /etc/security/limits.conf and set:

    * hard nofile 16384

Also set in /etc/environment (specifically needed for RubyMine):

    export JDK_HOME=/usr/lib/jvm/jre1.6.0_16

Remote Pair-Programming setup

If you do a lot of pair programming work with remote parties, a remote pairing setup is a must.

While Ubuntu comes with a VNC-based screen-sharing solution, VNC has very high bandwidth demands for high resolutions and fast updates. A better protocol is offered by NoMachine’s Server which offers a highly compressed, low-bandwidth optimized solution for sharing a graphical desktop with 2 people.

From NoMachine’s download page, install all 3 packages, first nxclient, then nxnode, then nxserver.

If you get an error messages that permissions on IPP will not enable printing from the session, run: chmod 755 /usr/lib/cups/backend/ipp

On nxnode install, if you get an error about cups (the Ubuntu printer server) not being installed, install it with sudo apt-get install cups (or via Synaptic). Once installed, run: /usr/NX/scripts/setup/nxnode --nxprintsetup <pathname>, with the path pointing to cups root path.

For adding remote users that will only have access through NoMachine (e.g. remote pairing sessions), need to access NX server config file, or via web tool: http://www.nomachine.com/download-package.php?Prod_Id=2147 which provides also deskop sharing functionality. This may not be needed for session shadowing (the most basic form of screen sharing in NoMachines).

The NX service can be controlled via /usr/NX/bin/nxserver --status|--start|--stop|--restart

To avoid having to unlock the key agent on NX client login every time, set this in /etc/ssh/ssh_config:

    ForwardAgent yes

Burning CD’s with K3B

If K3B fails with “permission error” after burn start, in /etc/security/limits.conf set:

    @cdrom           -       memlock         unlimited

Apple keyboard function key fix

If you’re using the Apple keyboard which I like because it’s ergonomic and travels well, you’ll find that the function F1-F12 keys don’t work, but instead trigger the super-imposed features (e.g. brightness, volume, etc). This article describes how to fix this.

Developing on Android devices

To enable Android device recognition for development, edit sudo gedit /etc/udev/rules.d/51-android.rules and add (for the HTC EVO 4G):

    SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c8d", MODE="0666"

Then restart udev:

    sudo restart udev

You may need to unplug and re-plug the device. See here for other devices.

Setup for Ruby-on-Rails

RVM

You need the following system prerequisites:

   sudo apt-get install build-essential as root.
   sudo apt-get install zlib1g-dev as root.
   sudo apt-get install libssl-dev as root.
   sudo apt-get install libreadline5-dev as root.

RVM is highly recommended and their system-wide (multi-user) installation is preferred in my experience. Web servers can also use the same set. The installation instructions on the RVM site recommend single-user mode, which should work as well for most single-developer laptop environments, but not for web servers.

If you run the mutli-user setup, it is furthermore advisable to edit the master .bashrc file from which each new user’s .bashrc file is cloned: /etc/skel/.bashrc

Java

Java is needed for many IDE’s as well as jruby and some tools.

Using apt-get install or Synaptic, install sun-java-jre and/or sun-java-jdk (if you want to do Java development or run jruby and gems). The open-source GPL java implementation (openjdk and icetea) is not recommended, they should be un-installed. Then set the Java version system-wide. Run sudo update-java-alternatives -l to see a list of installed Javas and set the Sun one with then set to sun with sudo update-java-alternatives -s <version>

rvm use –default ree (so that default applies in new shells also)

MySQL

System prerequisites:

    sudo apt-get install libmysqlclient-dev

Capybara

System prerequisites:

    sudo apt-get install libxslt1-dev libxml2-dev
blog comments powered by Disqus