Gentoo Archives: gentoo-user

From: Albert Hopkins <marduk@×××××××××××.org>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Facilities for creating Gentoo Linux based virtual appliances
Date: Thu, 29 Jul 2010 00:48:02
Message-Id: 1280364468.6024.40.camel@paska
1 Hello,
3 For a while I have been assembling methods for myself to be able to
4 easily create Gentoo-based virtual appliances. I have worked with
5 Ubuntu's vmbuilder scripts and basically wanted the same or similar ease
6 of use with Linux.
8 To make a long story short, I threw together a Makefile which basically
9 gives me this ability. I have it at a state where it's pretty much
10 useful to me for my purposes. But I thought someone else may find use
11 for it as well, so I put it up on Bitbucket:
15 The Makefile pretty much does an install into a chroot, pretty much by
16 the handbook, with a few alterations where I saw fit. It hast some
17 variables and a couple of hooks to allow for customization. I've
18 already created a few appliances (included) such as:
20 base: A base install of Gentoo Linux
21 gnome: GNOME stable appliance (no GUI console)
22 kde: KDE stable appliance (no GUI console)
23 lodgeit: Lodgeit pastebin appliance[1]
24 teamplayer: TeamPlayer appliance
26 The "no GUI console" means that by default these appliances don't have
27 an X console. I usually log into them via XDMCP or ssh. So they can be
28 thought of as "headless" desktop virtual appliances. The "base"
29 appliance is pretty much the handbook, with dhcpd and a syslog and
30 nothing else. TeamPlayer is a "democratic Internet radio station" web
31 app that I have been developing. To date I have not distributed it,
32 though eventually plan to. You can contact me directly if interested.
34 Right now there is no documentation or copyright or anything. It's
35 pretty much just the code. Like I said this has been primarily for my
36 personal use so there is nothing fancy like packaging or anything, but
37 it works. Some things can probably be done better. I'm no expert at
38 writing Makefiles.
40 So the way you basically use it is like this:
42 $ sudo make APPLIANCE=gnome VIRTIO=YES qcow
44 This will create a gnome virtual appliance image configured for virtio
45 and supply a qcow (qcow2) disk image. You can also just "sudo make" for
46 which the default is to create a "base" appliance not configured with
47 VIRTIO and only supply an image file in raw format. There are other
48 make variables that can be supplied. Check out the Makefile.
50 You can "easily" create your own VM appliaces by just mkdir
51 <appliance-name>. Copy the files from base/* into it and edit them as
52 needed. The supplied appliances should be good references.
54 One warning: the Makefile must be run as root, and does things inside a
55 chroot. I have been careful to make sure everything is done in the
56 chroot that needs to be. It is possible for you (or me) to forget to
57 put chroot before a command and cause irreversible damage to your host
58 system. Just giving you this caveat. I'm sure the appliances I
59 provided are safe, but I can't guarantee it and if you make your own
60 appliance just be careful. Ideally one would build VM appliances inside
61 a VM appliance itself :)
63 Well, I probably left some stuff out. Feel free to reply (to this
64 thread I guess) if you have any questions.
66 Oh, when you are finished building your disk image just
68 $ sudo make clean
70 Which will unmount things and remove the temporary files.
73 In the Makefile, I have PORTAGE=/portage and
74 DISTFILES=/var/portage/distfiles. These are my setup and are not the
75 defaults. You will need to change these values appropriately. Also,
76 you may need to edit the USEPKG variable. I have the Makefile use my
77 binary packages to speed up the creation process (allows me to build a
78 base appliance in about 12 minutes). You may not want this, especially
79 if you have your CFLAGS tuned to a specific processor that your
80 hypervisor does not support. But I use generic CFLAGS so I have no
81 problem using binpkgs.
83 Oh, I use kvm/virt-manager and use virtio for disks and network devices.
84 I tried to configure the VM kernel so that it will support other
85 formats. I am curious as to whether or not the appliances will work
86 with VMWare as I have not actually tried it, but you should be able to
87 create a VM image with
89 $ sudo make vmdk
91 I'm probably leaving something out. You should take a look at the
92 Makefile first if you are going to use it. It shouldn't be that foreign
93 (it's basically handbook stuff but tailored for the use case).
95 Anyway it's out there for you to reference.
97 -a
99 [1]


Subject Author
Re: [gentoo-user] Facilities for creating Gentoo Linux based virtual appliances Tanstaafl <tanstaafl@×××××××××××.org>
Re: [gentoo-user] Facilities for creating Gentoo Linux based virtual appliances Walter Dnes <waltdnes@××××××××.org>