How to install ubuntu server in qemu with network capabilities
Author : Aperell
From TechnologicalWiki
Contents |
[edit] Installing Qemu Packages
$apt-get install qemu kqemu-common kqemu-source
[edit] Configuring kqemu
$sudo apt-get install module-assistant
$sudo m-a prepare
sudo m-a a-i kqemu-source
Add the next content to the file: /etc/udev/rules.d/60-kqemu.rules
KERNEL=="kqemu", NAME="%k", MODE="0660", GROUP="kqemu"
Edit /etc/modprobe.d/kqemu and add:
options kqemu major=0
Creating a group for kqemu
$sudo addgroup –system kqemu $sudo adduser $USER kqemu
Edit file /etc/modules and add:
kqemu
Now, reboot your system and check if the device /dev/kqemu exists. If not, try this:
$sudo modprobe kqemu
[edit] Installing Qemu Network Packages
$sudo apt-get install uml-utilities bridge-utils
[edit] Qemu Network Configuration
Edit /etc/udev/rules.d/60-kqemu.rules, then add rule:
KERNEL=="tun", MODE="0666"
[edit] Creating Qemu Image File
qemu-img -f qcow ubuntuserver804 10G
[edit] Installing Ubuntu Server on Qemu
Install ubuntu normally:
qemu -cdrom ubuntu-8.04.1-server.iso ubuntuserver804
Create the next script to configure and load qemu:
#Network Configuration /sbin/ifconfig $1 0.0.0.0 promisc up /usr/sbin/brctl addif br0 $1 #Load Modules modprobe tun modprobe bridge modprobe kqemu major=0 #Second Network configuration ifconfig eth0 down brctl addbr br0 ifconfig eth0 up brctl addif br0 eth0 ifconfig br0 192.168.0.100 up ifconfig eth0 down ifconfig eth0 0.0.0.0 up route add default gw 192.168.0.1 #Qemu Load USERID=$(whoami) iface=$(sudo tunctl -b -u $USERID) qemu -hda ubuntuserver8041 -net nic -net tap,ifname=$iface tunctl -d $iface &>/dev/null
We need to configure /etc/network/interfaces in the guest.
sudo nano /etc/network/interfaces
Add this content:
auto eth0
iface eth0 inet static
address 192.168.0.101
gateway 192.168.0.1
netmask 255.255.255.0
Now, guest and host are sharing the network.


