segunda-feira, março 12

How to install UML with kernel 2.6 (and use in production!)

My friend Francisco try to install uml on debian sarge, and I think so it was hard to he as hard to me. And becase that little story I made this how to.

I named host the computer that will runing another uml machines, and virtual user mode machines I called umlhosts.

First you need to install debian sarge on host, and I think so you know how do this, but if you don't, download Debian Net Install from this link, and follow this instructions. We also need create one commom user, here called ernexto on host. This user will run virtual machines.

With host machine running, install User Mode Linux, these are the basic steps:

1. Install uml-utilities package:

apt-get install uml-utilities;
2. Install user_mode_linux package:
This package exists only in debian testing (etch), so if you're installing on etch host, you don't need change apt sources.list file, but my friend Xico is installing on Sarge... type all these commands! hehehe
cd /etc/apt;
cp sources.list sources.list.backup;
echo "deb http://http.us.debian.org/debian testing main contrib non-free" >> /etc/apt/sources.list;
apt-get update;
apt-get install user-mode-linux;
mv sources.list.backup sources.list;
3. Install bridge:
If you need use network in umlhosts, you need this package. Exists many ways to put network working, you can learn more at UML official site.
apt-get install bridge-utils;
4. Download one filesystem:
At uml site, you can download many filesystems. Redhat, debian, slack and others are available. We are going to download Debian 3.0 filesystem from this link. After download, unzip the file using
bunzip2 Debian-3.0r0.ext2.bz2
5. Running it!
Now we have all that we need to running many uml virtual hosts without network configuration. You can test the uml installation typing these commands:
linux ubd0=Debian-3.0r0.ext2;
You will see the commom linux initialization screen, services wake up, and if all occured successful, the login screen. You can logging it using username: root, and blank password.

6. Setup network:
You can normal shutdown the umlhost. We use tun/tap devices to run virtual network. Tun/tap is good for security reasons, becase use preconfigured devices. We will create one tun/tap device, called tap0, belongs to ernexto.
tunctl -u ernexto
echo 1 > /proc/sys/net/ipv4/ip_forward
route add -host 172.16.0.51 dev tap0
echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp
arp -Ds 172.16.0.50 eth0 pub

brctl addbr br0
ifconfig eth0 0.0.0.0 promisc up
ifconfig tap0 0.0.0.0 promisc up
ifconfig br0 172.16.0.50 netmask 255.255.0.0 up
brctl stp br0 off
brctl setfd br0 1
brctl sethello br0 1
brctl addif br0 eth0
brctl addif br0 tap0

7. Finish
With tap device configured, you can run umlhost again, now starting with eth0 device.
linux.uml ubd0=Debian,eth0=tap0
After loggin in umlhost, configure network normally, using command ifconfig eth0. You can set default gatway to host ip.

For more information, see links bellow, or send mail to me.
http://user-mode-linux.sourceforge.net
http://www.debian.org

2 comentários:

Anônimo disse...

todos querendo traduzir as coisas e esse cassiano escreveno em ingês....
mas ficou bom, então ta valendo!

Claudia Manfroi disse...

Cassiano,
É um deboche esse teu blog!!! rsrs
Gosto de passar aqui vezenquando e ler: além do visual ser bonito, os textos e temas são relevantes, atuais, sempre tem novidades, têm dicas úteis que tu sabe expor de uma forma bem didática (tu deve ser meio Prof. Pardal, rsrs) e opiniões válidas (baseadas no que tu já trabalhou e testou).
Sugiro divulgá-lo mais ainda, pra que muitas pessoas possam se beneficiar, de alguma forma. Eu admiro quem não retém o conhecimento só pra si próprio.
Sucesso pra ti!