Long Live Open Source Software !!

User Mode Linux (UML) is my favourite tool for simulating real network environtment. Because it’s simple and using small computer resources. But you can simulate a full working server in a UML. In this post, i will show you how to prepare a host computer for running User Mode Linux. Unlike Qemu, there is a ‘special treatment’ for the host so it can run UMLs.

I recommend Debian if you want to use UML, because as far as i know, Debian is the most stable distribution for running UML. I’ve tried Ubuntu, but UML isn’t working. When installing Debian, give space for swap as big as possible. It is useful when you running a lot of UMLs. Usually, i use 10 GB for swap. It’s better if your memory size is also big.

Ok, now this is step-by-step that you need to prepare host for User Mode Linux :

  1. Install openssh-server and build-essential
  2. Download kernel source from repository or from kernel.org. I recommend to use kernel version 2.6.35.4, because newest SKAS patch is avalaible for that version
  3. Extract the kernel source into a directory (e.g: /usr/src/), then in that directory will exist a folder named linux-2.6.35.4/
  4. Download kernel patch for SKAS (Separate Kernel Address Space) from here
  5. Patch the kernel source :
    cd linux-2.6.35.4
    patch -p1 < ../2.6.35.4-skas3.patch
  6. Edit Makefile in the kernel source directory, look for a line with “EXTRAVERSION = “ and change it to “EXTRAVERSION = skas3″, so the new kernel won’t have same name with existing kernel.
  7. Now you need to make .config file, you can use make oldconfig or make menuconfig. Make sure /proc/mm option is enabled.
  8. Compile the kernel with make bzImage or make -j 3 bzImage if your computer use dual core processor. If you use quad core processor, change the -j value to 5
  9. Compile the kernel modules with make modules. You can use -j option too if you’re using multicore processor.
  10. Install the kernel modules with make modules_install, don’t forget that you must run this command as root
  11. Copy bzImage file from kernel_source_dir/arch/i386/boot to /boot/ and give it easy-to-remember name such as vmlinuz-2.6.35.4-skas3
  12. Copy System.map from kernel_source_dir to /boot/ and give it name like above
  13. Create initramfs for your new kernel : update-initramfs -c -k <kernel version> (e.g : 2.6.35.4-skas3, look in /lib/modules dir if you don’t know the kernel version)
  14. Run update-grub to update your Grub configuration
  15. Update /etc/fstab, append this line. : (Total memory size is RAM size + Swap size, but i recommend don’t use all of your RAM size)
    none      /dev/shm      tmpfs     size=<total memory size>    0    0
  16. Restart your computer and choose the new installed kernel
  17. Install additional package such as xterm, xserver-xorg, x-window-system,  x-window-system-core, uml-utilities, and user-mode-linux
  18. If you want to use UML remotely, make sure you can do ssh -X into your server
  19. If you want to use UML networking functionality, add your user to uml-net group (e.g : adduser username uml-net)
  20. Change file permission for /dev/net/tun to 666

That’s all for the preparation, next post maybe will tell you about how to make your own root filesystem for UML

 

Be Sociable, Share!

Maybe you like this post too :