Top posting because I can't contribute anything meaningful inline...

Wow, Albert, this looks very, very cool. I have heard of using 'make'
and creating your own make files to do things like this, but after a few
minutes of perusing these files I realize this is just way over my head,
at least without some kind of tutorial (I'm just a lowly user whose
(lack of) bash skills would make most of you guys laugh).

Do you know of any generic tutorials on using creating/using your own
make files to do repetitive tasks (not necessarily like building an
entire system as you are doing here (but if there is something like that
even better)?

If not, no worries.

Anyway, thanks for sharing what you've done here...

Charles

Albert Hopkins wrote:
> Hello,
> 
> For a while I have been assembling methods for myself to be able to
> easily create Gentoo-based virtual appliances.  I have worked with
> Ubuntu's vmbuilder scripts and basically wanted the same or similar ease
> of use with Linux.
> 
> To make a long story short, I threw together a Makefile which basically
> gives me this ability.  I have it at a state where it's pretty much
> useful to me for my purposes.  But I thought someone else may find use
> for it as well, so I put it up on Bitbucket:
> 
> https://bitbucket.org/marduk/virtual-appliance
> 
> The Makefile pretty much does an install into a chroot, pretty much by
> the handbook, with a few alterations where I saw fit.  It hast some
> variables and a couple of hooks to allow for customization.  I've
> already created a few appliances (included) such as:
> 
> base: A base install of Gentoo Linux
> gnome: GNOME stable appliance (no GUI console)
> kde: KDE stable appliance (no GUI console)
> lodgeit: Lodgeit pastebin appliance[1]
> teamplayer: TeamPlayer appliance
> 
> The "no GUI console" means that by default these appliances don't have
> an X console.  I usually log into them via XDMCP or ssh.  So they can be
> thought of as "headless" desktop virtual appliances.  The "base"
> appliance is pretty much the handbook, with dhcpd and a syslog and
> nothing else.  TeamPlayer is a "democratic Internet radio station" web
> app that I have been developing.  To date I have not distributed it,
> though eventually plan to.  You can contact me directly if interested.
> 
> Right now there is no documentation or copyright or anything.  It's
> pretty much just the code.  Like I said this has been primarily for my
> personal use so there is nothing fancy like packaging or anything, but
> it works.  Some things can probably be done better.  I'm no expert at
> writing Makefiles.
> 
> So the way you basically use it is like this:
> 
> $ sudo make APPLIANCE=gnome VIRTIO=YES qcow
> 
> This will create a gnome virtual appliance image configured for virtio
> and supply a qcow (qcow2) disk image.  You can also just "sudo make" for
> which the default is to create a "base" appliance not configured with
> VIRTIO and only supply an image file in raw format.  There are other
> make variables that can be supplied.  Check out the Makefile.
> 
> You can "easily" create your own VM appliaces by just mkdir
> <appliance-name>.  Copy the files from base/* into it and edit them as
> needed.  The supplied appliances should be good references.
> 
> One warning: the Makefile must be run as root, and does things inside a
> chroot.  I have been careful to make sure everything is done in the
> chroot that needs to be.  It is possible for you (or me) to forget to
> put chroot before a command and cause irreversible damage to your host
> system.  Just giving you this caveat.    I'm sure the appliances I
> provided are safe, but I can't guarantee it and if you make your own
> appliance just be careful.  Ideally one would build VM appliances inside
> a VM appliance itself :)
> 
> Well, I probably left some stuff out.  Feel free to reply (to this
> thread I guess) if you have any questions.
> 
> Oh, when you are finished building your disk image just
> 
> $ sudo make clean
> 
> Which will unmount things and remove the temporary files.  
> 
> A FEW MORE IMPORTANT THINGS: 
> In the Makefile, I have PORTAGE=/portage and
> DISTFILES=/var/portage/distfiles.  These are my setup and are not the
> defaults.  You will need to change these values appropriately.   Also,
> you may need to edit the USEPKG variable.  I have the Makefile use my
> binary packages to speed up the creation process (allows me to build a
> base appliance in about 12 minutes).  You may not want this, especially
> if you have your CFLAGS tuned to a specific processor that your
> hypervisor does not support.  But I use generic CFLAGS so I have no
> problem using binpkgs.
> 
> Oh, I use kvm/virt-manager and use virtio for disks and network devices.
> I tried to configure the VM kernel so that it will support other
> formats.  I am curious as to whether or not the appliances will work
> with VMWare as I have not actually tried it, but you should be able to
> create a VM image with
> 
> $ sudo make vmdk
> 
> I'm probably leaving something out.  You should take a look at the
> Makefile first if you are going to use it.  It shouldn't be that foreign
> (it's basically handbook stuff but tailored for the use case).
> 
> Anyway it's out there for you to reference.
> 
> -a
> 
> [1] http://dev.pocoo.org/projects/lodgeit/
> 
> 


Reply via email to