Monday, October 19, 2009

Installing VirtualBox Guest Additions on Ubuntu 9.04/9.10 Guest, Vista Host

Here are some notes on how I installed the VirtualBox 3.0.8 Guest Additions on a 32-bit Unbuntu Server (9.04 Jaunty Jackalope) guest running on a 32-bit Windows Vista host.

The Ubuntu server is a very bare-bones server install running only sshd, so as you'll see below, we have to install gcc and friends.

This info is adapted from a post in the VirtualBox forums.

  1. Mount VirtualBoxGuestAdditons.iso via Devices > Mount CD/DVD ROM > CD/DVD ROM Image...
  2. The .iso file should be located on the Windows host here: C:\PROGRA~1\Sun\VIRTUA~1\VBoxGuestAdditions.iso
  3. Install the Guest Additions on the Ubuntu guest (adapted from http://forums.virtualbox.org/viewtopic.php?p=29316):
    mount /cdrom; cd /cdrom
    sudo apt-get update
    sudo apt-get install build-essential linux-headers-`uname -r`
    sudo ./VBoxLinuxAdditions-x86.run
    cd ~; umount /cdrom
    
  4. Optional cleanup (I didn't bother since I'm using this box as a development server, and will need gcc et al.)
    sudo apt-get remove build-essential linux-headers-`uname -r`
    sudo apt-get autoremove
    sudo apt-get autoclean
    
  5. reboot the guest (possibly not necessary, but I did it)

The guest additions are now installed and running. Next step would be to actually do something with them. In my case, I wanted to mount the c:\ drive of the host (Vista) machine.

To share the entire Vista c:\ in the directory /mnt/c on the Ubuntu guest:
  1. On the host window, go to Devices > Shared folders...
  2. Add new shared folder: Folder Path = c:\, Folder Name = c, not Read-only, check Make Permanent
  3. Add the following line to /etc/fstab:
    c    /mnt/c    vboxsf    rw,gid=1000,uid=1000,auto    0    0
    
  4. Note: I've mounted this as my main user. If you've only created one user on your Ubuntu server, this should work. If in doubt, run id as the user you want to mount the Windows share as.
  5. Create the mountpoint: sudo mkdir /mnt/c
  6. Mount the share (this will happen automatically in the future): sudo mount /mnt/c

Update 28-Dec-2009: I just used this same procedure on Karmic 9.10 and it also seems to work fine there.

Friday, October 9, 2009

Installing PostgreSQL 8.4 on Ubuntu Jaunty (9.04)

Inaugural post!

Ubuntu 9.04 (Jaunty Jackalope) includes PostgreSQL 8.3 via the expected apt-get install postgresql. This is great, but PostgreSQL 8.4.1 has a number of nice features that I want (WITH queries, for example). At first I was just going to wait for Ubuntu 9.10, which is coming very shortly, but I am impatient. It turns out there is a pretty easy "Ubuntu way" to get PostgreSQL 8.4 installed on 9.04 without a lot of headaches (like building from source). The solution is using Ubuntu PPAs.

Add the custom PPA for PostgreSQL to /etc/apt/sources.list:

deb http://ppa.launchpad.net/pitti/postgresql/ubuntu jaunty main
deb-src http://ppa.launchpad.net/pitti/postgresql/ubuntu jaunty main

Get the key for these new sources:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8683D8A2

Update the package list:

sudo apt-get update

Install!

sudo apt-get install postgresql-8.4

PostgreSQL 8.4.1 will now be running, but on port 5433, not the standard 5432. I assume this was done so you can run 8.3 and 8.4 at the same time on Ubuntu 9.04. I only want 8.4.1, so I changed the port and restarted:

sudo sed -i.bak -e 's/port = 5433/port = 5432/' \
    /etc/postgresql/8.4/main/postgresql.conf

sudo /etc/init.d/postgresql-8.4 stop
sudo /etc/init.d/postgresql-8.4 start

These PPAs for PostgreSQL only exist because of Martin Pitt, who appears to be responsible for PostgreSQL on Ubuntu, so many thanks to him!