Gentoo Archives: gentoo-admin

From: Mike Kazantsev <mike_kazantsev@×××××××.net>
To: gentoo-admin@l.g.o
Subject: Re: [gentoo-admin] KVM guest system installation
Date: Sat, 16 May 2009 07:33:33
Message-Id: 20090516133028.2353258a@coercion
In Reply to: [gentoo-admin] KVM guest system installation by "Reber
1 On Fri, 15 May 2009 22:35:12 +0200
2 "Reber, Simon" <linux@×××××××.ch> wrote:
3
4 > But we now coming to the point where we want to install virtual guest
5 > systems to some of the systems.
6 > Since the servers are kept very basically do we not have any X packages
7 > installed, nor do we plant to.
8 > But from documentation and experience point of view, does it look like
9 > that we exactly do require something like that.
10 >
11 > So my question is, is there any way to install a guest system using KVM
12 > without having X system packages installed or a monitor plugged on?
13 > Meaning booting up the guest system, connecting from the localhost
14 > using some kind of serial console or something like that to connect to
15 > the particular virtual guest and run the installation task?
16
17 I don't know what kind of documentation you've been reading, but there's
18 no real need for X (especially X-server) on the machine to deply/use kvm
19 guests there.
20
21 If there's need for a graphical install (like MS Windows), you can use
22 VNC, otherwise ncurses-based interface should suffice to display both
23 bios data and text terminal, just append "-curses" flag to kvm line.
24
25 Of course, all these features should be enabled via use-flags.
26
27 And if you still want X for some reason, you can use sdl-based
28 graphical output thru X-forwarding, with a few additional libs (and X
29 flag enabled for ssh/sdl).
30
31 Just an example of kvm start:
32
33 exec kvm \
34 -name "$VM" \
35 -cpu core2duo \
36 -smp 8 \
37 -m "$MEM" \
38 -drive file=/dev/mapper/vm_root-$VM,if=virtio \
39 -drive file=/dev/mapper/vm_swap-$VM,if=virtio \
40 -net nic,vlan=0,model=virtio,macaddr="XX:XX:XX:XX:XX:X$SN" \
41 -net vde,vlan=0,sock=/var/run/vde/vde.ctl \
42 -localtime \
43 -kernel /boot/vmlinuz_vm32 \
44 -append 'root=/dev/vda gentoo=nodevfs' \
45 -daemonize \
46 -nographic \
47 # -monitor "telnet:127.0.0.1:820${SN},server,nowait" \
48 # -vnc ":$SN" \
49 # -curses \
50
51 vnc or curses lines (or both) here can be swapped w/ "-nographic" option
52 to enable graphical remote access. And you can control every
53 non-software aspect of VM via "-monitor" interface.
54 Of course, you won't need any of it as soon as you'll have sshd running.
55
56 And I find it much easier to do the basic deployment by cloning desired
57 FS (or stage3) to VM partition, chrooting there, doing all the
58 necessary fine-tuning or compilation then booting VM from there into
59 fully operational (boot-and-forget) state.
60 Trick here is not to accidentally mount VM partition if it's (still)
61 running, since that might cause severe fs corruption.
62
63 --
64 Mike Kazantsev // fraggod.net

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies