OBriens tower
Musings on software development, Linux and business

Archive for the 'linux' Category

Gone next door …

Friday, August 22nd, 2008

Hi. If you’re looking for my blogs on all things Linux, I’ve moved them to our other blog - http://www.atlanticlinux.ie/blog/ = please join me over there!

Setting up a Debian Sarge guest in VMware

Tuesday, November 14th, 2006

In the last couple of days I’ve been using VMware for the first time. VMware server is basically a virtual machine that allows you run images of other operating systems (called guests) from within your host OS. Images for many operating systems are readily available to download to load directly into the server as virtual appliances.

My aim was to set up a Debian 3.1 (Sarge) guest with Java 1.4, Tomcat 5.0 and Oracle XE installed to use as a basis for portable product demos. This was mostly straightforward once I got familiar with how VMware worked. The only slight problem related to the disk space and swapfile size requirements of oracle. The rest of this article describes the steps I followed.

First steps with VMware Server

To get started, I downloaded the free version of VMware Server here. You need to go through a brief registration process to obtain a serial number. Once the server was installed and running I got the virtual image for Debian Sarge from here. Unzip the image and open it in the VMware server.

At this point there’s a couple of handy things to know regarding VMware server in general:

  • Firstly, I advise taking snapshots (this can be done from the snapshot menu) at regular intervals after you’ve verified everything’s working ok. This saves the entire state of your current guest OS including what programs are running etc. You can rollback to the previous snapshot at any time if you’ve inexplicably broken something. This allows you to experiment uninhibited - safe in the knowledge the last working state of your guest OS is recoverable.
  • Secondly, you regularly need to switch keyboard/mouse focus between your host and guest OS’s - CTRL+G gives focus to the guest, CTRL+ALT returns it to the host. This can take a while to get used to :)

Before powering on the image, you can right click on it in the Inventory and click settings to edit these. The only change I made here was to change the ethernet setting to ‘Bridged’ instead of ‘NAT’. This allowed the guest OS to obtain it’s own IP address from our DHCP server during setup and behave for all intents and purposes like an independant box on our network. Nice!

Powering on the Debian guest OS

Click the green arrow play button to start the virtual machine and it’ll behave like a fresh Debian install prompting you for the root password etc. I won’t go through the steps of configuring the install as that’s already covered elsewhere. The configuration went smoothly, I logged in and the guest OS appeared on the network and I was able to ftp to/from it from other machines on our network directly.

So I moved on to installing Oracle XE. Using Stephen’s fine tutorial this would also be straightforward right? well… not quite. Oracle requires 1.5 GB of disk space and a swapfile of at least 750 MB. My guest OS stood at 400 MB and ~200 MB respectively. I stopped the machine and looked for a way in VMware Server to increase the total disk space allocated to the guest (the original was 4GB) but I couldn’t see a way. Fortunately, the server does allow you to create additional virtual disks and this proved to be enough, as I’ll describe in the remainder of the article.

Creating an additional virtual disk

  1. Shut down the guest OS by clicking the stop button (red square)
  2. Right click on the image in the inventory panel of the GUI
  3. Click settings
  4. Stay in the hardware tab which is shown by default
  5. Click ‘add’ at the bottom of the tab and
  6. Select ‘hard disk’ and click next
  7. Select ‘create a new virtual disk’ and click next
  8. Select scsi and click next
  9. Chose the size of disk you want to create and whether to allocate all of this space up front (I did) and click next
  10. Provide a name, click finish and you’re done.

Configuring the new disk

To configure the new disk re-start the guest image and log in. The newly created virtual disk should now exist as /dev/sdb. The disk must be partitioned and a file system created on it.

  1. From within a terminal start fdisk
    fdisk /dev/sdb
  2. Create a new primary partition
    n
  3. You'll be prompted for values for first and last cylinders. I used the min and max to allocate all disk space to this partition.
  4. Write the new partition table, and exit fdisk
    w
  5. Create the file system
    mkfs -t ext3 /dev/sdb1
  6. Mount the new drive at /hd2 (or whever you choose)
    mkdir /hd2
    mount /dev/sdb1 /hd2
  7. Add a line for /dev/sdb1 to /etc/fstab similar to the line for sda1 e.g.
    /dev/sdb1 /hd2 ext3 defaults,errors=remount-ro 0 1

Creating a larger swap file

I decided to create a swapfile of roughly 1GB on the new partition to keep Oracle happy:

  1. cd /hd2
    dd if=/dev/zero of=swapfile bs=1024 count=1000000
    chmod 600 swapfile
    mkswap swapfile
    swapon swapfile
  2. Again, edit your /etc/fstab to add the following
    /hd2/swapfile swap swap defaults 0 0

I tried running apt-get install oracle-xe-universal again and this time it installed successfully. Thankfully installing java and tomcat required nothing out of the ordinary and before long my guest OS was up and running as required.

Six year old boy installs Ubuntu Linux

Monday, October 23rd, 2006

One day last week I thought I could distract my son from annoying his sisters for a couple of hours by giving him my old (wiped clean) laptop and a Linux distribution cd. My son is six years old. He installed Ubuntu in 20 minutes.

Let’s get some perspective here. We are talking about a kid who recently learned to read (as Gaeilge agus as Bearla). He is a bright kid, but I don’t think this is down to him. It was possible because the Ubuntu team has done such an excellent job of packaging up their linux distribution.

Daniel was presented with only a few prompts during the installation. The first one was for the language (he got that), the second for the country (he got that), the third was for the keyboard (he didn’t understand why we use a British keyboard in Ireland). One prompt for the network interface (for some reason a wireless interface was picked up though afaik the laptop does not have one), I helped him select eth0 rather than eth1. For partitioning the hard disk (he didn’t know what that was about), he left the default (1 swap plus 1 big data partition). He chose the name ‘Ranger’ for the computer, and when prompted for the user entered the same credentials he uses on the other system in the house. That was it. The rest was magic.

Once installed he rebooted the pc, and logged in. It was remarkable.

The moral of the story is this: if you want to keep your kid entertained for hours on end by installing an operating system, don’t use Ubuntu. Maybe try Gentoo.