cobbler check
The first time you setup cobbler, it's always a good idea to run cobbler check. A sample run on my newly installed system shows ...
# cobbler check #0: The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it. #1: For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network. #2: Must enable selinux boolean to enable Apache and web services components, run: setsebool -P httpd_can_network_connect true #3: service cobblerd is not running #4: service xinetd is not running #5: change 'disable' to 'no' in /etc/xinetd.d/tftp #6: service httpd is not running #7: since iptables may be running, ensure 69, 80, 25150, and 25151 are unblocked #8: One or more kickstart templates references default password 'cobbler' and should be changed for security reasons: /etc/cobbler/sample.ks, /etc/cobbler/legacy.ks, /etc/cobbler/sample_end.ks
Take a few moments to walk through each of the recommendations. I'm leaving out the actions performed to resolve the above issues, they are outside the scope of this post. If you have questions, toss them in the blog and I'll be happy to help.
After making the recommended corrections, running cobbler check again shows:
# cobbler check The following potential problems were detected: #0: since iptables may be running, ensure 69, 80, 25150, and 25151 are unblocked #1: One or more kickstart templates references default password 'cobbler' and should be changed for security reasons: /etc/cobbler/sample.ks, /etc/cobbler/legacy.ks, /etc/cobbler/sample_end.ksAssuming you have opened up the recommended ports in your firewall, you should be safe to proceed. Let's start getting things ready for the big event.
What To Wear?
Okay a stretch, but the whole point of this is so we can easily try on different distributions. I'm going to use several versions of Fedora, but cobbler doesn't limit you to Red Hat Enterprise Linux or Fedora-based derivatives (see SupportForOtherDistros). I'm also fortunate in that all the distros I want are available via NFS on a nearby system. If that wasn't the case, you may need to download the DVD's from a local mirror.
- Download a DVD or CD image from a nearby mirror (i'll be using the DVD).
- Loopback mount the DVD image:
# mount -o loop Fedora-10-x86_64-DVD.iso /media
- Import the DVD into cobbler -
# cobbler import --name F-10-GOLD --path /media
- Unmount the volume:
# umount /media
- Rinse & repeat the process for other version of Fedora, Red Hat Enterprise Linux, or other.
- When finished, cobbler should show all the distributions you imported:
# cobbler distro list F-10-GOLD-x86_64 F-8-GOLD-x86_64 F-8-GOLD-xen-x86_64 F-9-GOLD-x86_64 F-9-GOLD-xen-x86_64
There are many different ways to import a distribution into cobbler. I typically choose not to mirror the entire distribution locally since it is often mirrored already on a nearby system. Instead, I provide a locally mounted nfs path to the distribution as well as the URL cobbler should use to install this distro --available-as. For example:
# cobbler import --name F-10-GOLD --path /mnt/path/to/F-10/GOLD/Fedora/i386/os \ --available-as http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Fedora/x86_64/osFor information on other ways to use cobbler import see UsingCobblerImport.
Making Room For Our Guests
I prefer using LVM logical volumes for my virtual guests. This allows me to re-install my host operating system while leaving the guests intact (useful when upgrading to a new Fedora release). We'll use the free-space we left available when we installed the system.
- Let's see how much free-space we have in our Volume group. Running vgs shows ...
# vgs VG #PV #LV #SN Attr VSize VFree VolGroup00 1 2 0 wz--n- 232.62G 182.81G
As noted above, we have roughly 182G of disk space to play with. Let's start by creating 5 15G logical volumes to act as virtual disk space for 5 virtual guests (I'll create those next). - Let's create some logical volumes:
# for NUM in 1 2 3 4 5; do lvcreate -L 15G -n vguest$NUM VolGroup00 ; done Logical volume "vguest1" created Logical volume "vguest2" created Logical volume "vguest3" created Logical volume "vguest4" created Logical volume "vguest5" created
- Finally, we'll adjust the SELinux security contexts for the LVM logical devices by typing (dwalsh, thanks for the tip!):
# chcon -t virt_image_t /dev/mapper/VolGroup00-vguest* /dev/VolGroup00/vguest*
What's a Party Without Networking? (optional)
I prefer bridging rather than NAT since the bridged guests appear on the same subnet as my host. This makes network PXE booting easier (more on that later).
The commands to disable NetworkManager and create the bridge are very well detailed over at libvirt.org.
Thanks to poelcat for providing the link!
What's a Party Without Guests?
Now that we've imported a few distributions, and made room for our guests to live ... let's invite the guests.
- Define your system in cobbler:
# cobbler system add --name vguest1 --profile F-10-GOLD-x86_64 \ --virt-type qemu --virt-bridge virbr0 \ --virt-path /dev/VolGroup00/vguest1 \ --virt-ram 1024
- Repeat this command for our 4 other guests. Adjust the --name, --virt-path, and --virt-ram each time to meet your needs.
- When finished, you should have 5 virtual systems defined in cobbler. To list the systems we just created:
# cobbler system list vguest1 vguest2 vguest3 vguest4 vguest5
Let's Get This Party Started!
Wow, that was a lot of prep work, but it will pay off I promise :) Before we go any further, lets run a quick test to ensure everything works.
- Let's kick off a quick install using vguest1:
# koan --server `hostname` --virt --system vguest1 - reading URL: http://your.hostname.here/cblr/svc/op/ks/system/vguest1 install_tree: http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Fedora/x86_64/os/ libvirtd (pid 3182) is running... - using qemu hypervisor, type=kvm - adding disk: /dev/VolGroup00/vguest1 of size 5 libvir: QEMU error : Domain not found libvir: QEMU error : Domain not found use virt-manager and connect to qemu to manage guest: vguest1
- Launch the viewer:
# virt-viewer vguest1
Network timeout?
You may encounter an error message indicating that a network connection could not be made, just click Retry for now (see bug#471382 for details). This will be addressed also in the next version of koan.
Congrats! You now have 5 virtual guests configured and available for provisioning through cobbler. You'll notice that your first install was an automated text-mode installation.
My next post will spend more time on configuring the installs using kickstart and integrating it with SNAKE. Stay tuned ...