User Mode Linux and Fedora Core 3

User Mode Linux (UML) is pretty amazing: you run a complete Linux installation inside your normal system. This is what's called a virtual machine. If you've seen VMWare in action, you'll know what I mean.

There's an enormous amount of old information floating around on UML. The most important thing to know is: from kernel 2.6.9, UML is standard in the kernel; it doesn't need to be patched. Below are the steps to get an UML instance running on Fedora Core 3, but other distributions will probably be fine as well. In virtual machine terms, the host is your normal, real system. The guest is the virtual machine.

Setting up Fedora Core 3 with a stock kernel

Part A, if you want to run Fedora Core 3 on a "stock" kernel (you can skip this if you want):

  1. Download kernel 2.6.9 from the appropriate mirror from http://www.kernel.org/
  2. Unpack your fresh kernel into /usr/src, and rename the directory to linux-2.6.9-host or similar
  3. Enter the new directory, and copy the /boot/config-2.6.9-1.667 to the current directory, renaming it into .config
  4. Compile and install the new kernel:
  $ make bzImage && make modules && make install

Compiling a User Mode Linux kernel

Part B, compiling the guest kernel:

  1. If you haven't done so, download kernel 2.6.9 from the appropriate mirror from http://www.kernel.org/
  2. Change directory to /usr/src
  3. Unpack the newly downloaded kernel, and rename it into linux-2.6.9-host or similar
  4. Configure as follows: ARCH=um make menuconfig
    You can set some options here, but by default most things are OK. Note that modules are turned off; a monolithic kernel is built.
  5. Compile as follows: ARCH=um make
  6. If it's finished, test the new kernel by typing ./vmlinux --help. You should see a screen or two filled with parameters.
  7. The filesize can be up to 15Mb. You can remove debugging information and get it down to 2Mb or so: strip vmlinux
  8. Create a directory for your virtual machine: mkdir ~/uml
  9. Download a ready-made image from:
    http://prdownloads.sourceforge.net/user-mode-linux/Debian-3.0r0.ext2.bz2
  10. Unpack the image and move it to your UML directory: mv Debian-3.0r0.ext2 ~/uml
  11. Now do a test run:
  $ cd ~/uml</tt>
  $ ./vmlinux udb0=Debian-3.0r0.ext2</tt>

If all's well, a boot sequence should be shown, and after 10 seconds, a login prompt. Login with root.

Get network going

If your UML instance runs, shut it down. As root, load the tun/tap kernel module which provides UML with a virtual network device:

  # modprobe ethertap

Then start your UML instance again, passing it a number of options for networking:

  $ ./vmlinux ubd0=Debian-3.0r0.ext2 eth0=ethertap,tap0,fe:fd:0:0:0:1,10.0.0.37

This tells the UML instance that for network device eth0:

After the UML instance started, bring up the eth0 device, remove unnecessary routes and add the default gateway:

  # ifconfig eth0 10.0.0.27 netmask 255.255.255.0
  # route del -net 10.0.0.27 dev eth0 netmask 255.255.255.0   
  # route add default gw 10.0.0.37

Using the console

You will probably put UML instances in the background. Now where have they put the power button? Download the UML tools from here: http://prdownloads.sourceforge.net/user-mode-linux/uml_utilities_20040406.tar.bz2

Unpack and install them as follows:

  $ tar xfj uml_utilities_20040406.tar.bz
  $ cd tools
  $ make all
  $ su -
  # make install DESTDIR=/

This will install the following files:

  /usr/bin/uml_net
  /usr/bin/tunctl
  /usr/bin/uml_mkcow
  /usr/bin/uml_mconsole
  /usr/bin/uml_watchdog
  /usr/bin/uml_moo
  /usr/bin/uml_switch
  /usr/bin/jailtest
  /usr/lib/uml
  /usr/lib/uml/port-helper

To test, shut your UML down if it was running (on the prompt of the guest, type "shutdown -h now"). Then start it again, and pass the umid option with an identifier, like so:

  ./vmlinux umid=debian ubd0=Debian-3.0r0.ext2

Open another console on the host and test it as follows (bold is your input):

  $ uml_mconsole debian

On the prompt, type "version" and press enter. The console should respond:

  OK Linux (none) 2.6.9 #1 Sun May 1 16:00:28 CEST 2005 i686

Exit with CTRL-D. Check out the HOWTO, section 10 for an overview of all possible commands.

Bridged Networking

http://edeca.net/articles/bridging/

Links

Hosters Price/Feature Comparison

See also Cheap VPS Hosting.