个人工具

UbuntuHelp:UserModeLinux

来自Ubuntu中文

Wikibot讨论 | 贡献2008年10月19日 (日) 17:54的版本

跳转至: 导航, 搜索

<<Include(Tag/ContentCleanup)>> <<Include(Tag/NeedsExpansion)>>

Getting Started

This page will help you get started using User-Mode Linux with Ubuntu. Guide is created for Hardy LTS, but will most likely work with other releases: The first thing we need is to install the uml kernel and utilities we will need.

 
sudo apt-get install user-mode-linux uml-utilities bridge-utils 

The next step is getting us a nice ubuntu hardy filesystem:

dd if=/dev/zero of=uml-root-hardy bs=4096 seek=1M count=1
mkfs.xfs uml-root-hardy
sudo mount -o loop uml-root-hardy /mnt
sudo apt-get install debootstrap
sudo debootstrap --arch amd64 hardy /mnt http://us.archive.ubuntu.com/ubuntu
sudo echo "/dev/ubd0     /     xfs     defaults     0 1" > /mnt/etc/fstab
sudo echo "proc  /     proc     proc     defaults     0 0" >> /mnt/etc/fstab
sudo mknod --mode=660 /mnt/dev/ubd0 b 98 0
sudo chown root:disk /mnt/dev/ubd0
sudo echo "127.0.0.1 localhost" /etc/hosts
sudo echo "auto lo \
iface lo inet loopback \
auto eth0 \
iface eth0 inet dhcp" > /mnt/etc/network/interfaces
sudo echo "tty0" >> /mnt/etc/securetty
sudo echo "ttys/0" >> /mnt/etc/securetty

sudo rm /mnt/etc/event.d/tty2
sudo rm /mnt/etc/event.d/tty3
sudo rm /mnt/etc/event.d/tty4
sudo rm /mnt/etc/event.d/tty5
sudo rm /mnt/etc/event.d/tty6
sudo rm /mnt/etc/udev/rules.d/75-persistent-net-generator.rules

Basically what we've done is created an empty filesystem, mounted it, and made some changes that we want done on all our vm's. We should be ready to run our new vm now:

linux ubd0=uml-root-hardy.cow1,uml-root-hardy umid=uml1

User-Mode Linux is another virtualisation technique for running VirtualMachines under GNU/Linux. See the User-Mode Linux project page for more information.