Gentoo Archives: gentoo-admin

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