1 |
Top posting because I can't contribute anything meaningful inline... |
2 |
|
3 |
Wow, Albert, this looks very, very cool. I have heard of using 'make' |
4 |
and creating your own make files to do things like this, but after a few |
5 |
minutes of perusing these files I realize this is just way over my head, |
6 |
at least without some kind of tutorial (I'm just a lowly user whose |
7 |
(lack of) bash skills would make most of you guys laugh). |
8 |
|
9 |
Do you know of any generic tutorials on using creating/using your own |
10 |
make files to do repetitive tasks (not necessarily like building an |
11 |
entire system as you are doing here (but if there is something like that |
12 |
even better)? |
13 |
|
14 |
If not, no worries. |
15 |
|
16 |
Anyway, thanks for sharing what you've done here... |
17 |
|
18 |
Charles |
19 |
|
20 |
Albert Hopkins wrote: |
21 |
> Hello, |
22 |
> |
23 |
> For a while I have been assembling methods for myself to be able to |
24 |
> easily create Gentoo-based virtual appliances. I have worked with |
25 |
> Ubuntu's vmbuilder scripts and basically wanted the same or similar ease |
26 |
> of use with Linux. |
27 |
> |
28 |
> To make a long story short, I threw together a Makefile which basically |
29 |
> gives me this ability. I have it at a state where it's pretty much |
30 |
> useful to me for my purposes. But I thought someone else may find use |
31 |
> for it as well, so I put it up on Bitbucket: |
32 |
> |
33 |
> https://bitbucket.org/marduk/virtual-appliance |
34 |
> |
35 |
> The Makefile pretty much does an install into a chroot, pretty much by |
36 |
> the handbook, with a few alterations where I saw fit. It hast some |
37 |
> variables and a couple of hooks to allow for customization. I've |
38 |
> already created a few appliances (included) such as: |
39 |
> |
40 |
> base: A base install of Gentoo Linux |
41 |
> gnome: GNOME stable appliance (no GUI console) |
42 |
> kde: KDE stable appliance (no GUI console) |
43 |
> lodgeit: Lodgeit pastebin appliance[1] |
44 |
> teamplayer: TeamPlayer appliance |
45 |
> |
46 |
> The "no GUI console" means that by default these appliances don't have |
47 |
> an X console. I usually log into them via XDMCP or ssh. So they can be |
48 |
> thought of as "headless" desktop virtual appliances. The "base" |
49 |
> appliance is pretty much the handbook, with dhcpd and a syslog and |
50 |
> nothing else. TeamPlayer is a "democratic Internet radio station" web |
51 |
> app that I have been developing. To date I have not distributed it, |
52 |
> though eventually plan to. You can contact me directly if interested. |
53 |
> |
54 |
> Right now there is no documentation or copyright or anything. It's |
55 |
> pretty much just the code. Like I said this has been primarily for my |
56 |
> personal use so there is nothing fancy like packaging or anything, but |
57 |
> it works. Some things can probably be done better. I'm no expert at |
58 |
> writing Makefiles. |
59 |
> |
60 |
> So the way you basically use it is like this: |
61 |
> |
62 |
> $ sudo make APPLIANCE=gnome VIRTIO=YES qcow |
63 |
> |
64 |
> This will create a gnome virtual appliance image configured for virtio |
65 |
> and supply a qcow (qcow2) disk image. You can also just "sudo make" for |
66 |
> which the default is to create a "base" appliance not configured with |
67 |
> VIRTIO and only supply an image file in raw format. There are other |
68 |
> make variables that can be supplied. Check out the Makefile. |
69 |
> |
70 |
> You can "easily" create your own VM appliaces by just mkdir |
71 |
> <appliance-name>. Copy the files from base/* into it and edit them as |
72 |
> needed. The supplied appliances should be good references. |
73 |
> |
74 |
> One warning: the Makefile must be run as root, and does things inside a |
75 |
> chroot. I have been careful to make sure everything is done in the |
76 |
> chroot that needs to be. It is possible for you (or me) to forget to |
77 |
> put chroot before a command and cause irreversible damage to your host |
78 |
> system. Just giving you this caveat. I'm sure the appliances I |
79 |
> provided are safe, but I can't guarantee it and if you make your own |
80 |
> appliance just be careful. Ideally one would build VM appliances inside |
81 |
> a VM appliance itself :) |
82 |
> |
83 |
> Well, I probably left some stuff out. Feel free to reply (to this |
84 |
> thread I guess) if you have any questions. |
85 |
> |
86 |
> Oh, when you are finished building your disk image just |
87 |
> |
88 |
> $ sudo make clean |
89 |
> |
90 |
> Which will unmount things and remove the temporary files. |
91 |
> |
92 |
> A FEW MORE IMPORTANT THINGS: |
93 |
> In the Makefile, I have PORTAGE=/portage and |
94 |
> DISTFILES=/var/portage/distfiles. These are my setup and are not the |
95 |
> defaults. You will need to change these values appropriately. Also, |
96 |
> you may need to edit the USEPKG variable. I have the Makefile use my |
97 |
> binary packages to speed up the creation process (allows me to build a |
98 |
> base appliance in about 12 minutes). You may not want this, especially |
99 |
> if you have your CFLAGS tuned to a specific processor that your |
100 |
> hypervisor does not support. But I use generic CFLAGS so I have no |
101 |
> problem using binpkgs. |
102 |
> |
103 |
> Oh, I use kvm/virt-manager and use virtio for disks and network devices. |
104 |
> I tried to configure the VM kernel so that it will support other |
105 |
> formats. I am curious as to whether or not the appliances will work |
106 |
> with VMWare as I have not actually tried it, but you should be able to |
107 |
> create a VM image with |
108 |
> |
109 |
> $ sudo make vmdk |
110 |
> |
111 |
> I'm probably leaving something out. You should take a look at the |
112 |
> Makefile first if you are going to use it. It shouldn't be that foreign |
113 |
> (it's basically handbook stuff but tailored for the use case). |
114 |
> |
115 |
> Anyway it's out there for you to reference. |
116 |
> |
117 |
> -a |
118 |
> |
119 |
> [1] http://dev.pocoo.org/projects/lodgeit/ |
120 |
> |
121 |
> |