Re: KVM guest system installation

Mike Kazantsev <mike_kazantsev-h6Lg6mc/[email protected]> Sat, 16 May 2009 13:30:28 +0600
Newsgroups gmane.linux.gentoo.admin
Message-ID <20090516133028.2353258a@coercion>
--Sig_/3Ev0+Stn9I8mBubUud_tSL3
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Fri, 15 May 2009 22:35:12 +0200
"Reber, Simon" <[email protected]> wrote:

> But we now coming to the point where we want to install virtual guest
> systems to some of the systems.
> Since the servers are kept very basically do we not have any X packages
> installed, nor do we plant to.
> But from documentation and experience point of view, does it look like
> that we exactly do require something like that.
>=20
> So my question is, is there any way to install a guest system using KVM
> without having X system packages installed or a monitor plugged on?
> 	Meaning booting up the guest system, connecting from the localhost
> using some kind of serial console or something like that to connect to
> the particular virtual guest and run the installation task?

I don't know what kind of documentation you've been reading, but there's
no real need for X (especially X-server) on the machine to deply/use kvm
guests there.

If there's need for a graphical install (like MS Windows), you can use
VNC, otherwise ncurses-based interface should suffice to display both
bios data and text terminal, just append "-curses" flag to kvm line.

Of course, all these features should be enabled via use-flags.

And if you still want X for some reason, you can use sdl-based
graphical output thru X-forwarding, with a few additional libs (and X
flag enabled for ssh/sdl).

Just an example of kvm start:

  exec kvm \
   -name "$VM" \
   -cpu core2duo \
   -smp 8 \
   -m "$MEM" \
   -drive file=3D/dev/mapper/vm_root-$VM,if=3Dvirtio \
   -drive file=3D/dev/mapper/vm_swap-$VM,if=3Dvirtio \
   -net nic,vlan=3D0,model=3Dvirtio,macaddr=3D"XX:XX:XX:XX:XX:X$SN" \
   -net vde,vlan=3D0,sock=3D/var/run/vde/vde.ctl \
   -localtime \
   -kernel /boot/vmlinuz_vm32 \
   -append 'root=3D/dev/vda gentoo=3Dnodevfs' \
   -daemonize \
   -nographic \
  # -monitor "telnet:127.0.0.1:820${SN},server,nowait" \
  # -vnc ":$SN" \
  # -curses \

vnc or curses lines (or both) here can be swapped w/ "-nographic" option
to enable graphical remote access. And you can control every
non-software aspect of VM via "-monitor" interface.
Of course, you won't need any of it as soon as you'll have sshd running.

And I find it much easier to do the basic deployment by cloning desired
FS (or stage3) to VM partition, chrooting there, doing all the
necessary fine-tuning or compilation then booting VM from there into
fully operational (boot-and-forget) state.
Trick here is not to accidentally mount VM partition if it's (still)
running, since that might cause severe fs corruption.

--=20
Mike Kazantsev // fraggod.net

--Sig_/3Ev0+Stn9I8mBubUud_tSL3
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)

iEYEARECAAYFAkoOa5kACgkQASbOZpzyXnGefQCfWeotJLZ96o570CWqbqUC/rhi
m9IAn37n/YxKiZu+6rbjJTGHQ5k+O0GZ
=tBHk
-----END PGP SIGNATURE-----

--Sig_/3Ev0+Stn9I8mBubUud_tSL3--