Sunday, May 15, 2011

301 Moved Permanently

This is the last posting I do on this blog.
I decided to switch to a self hosted wordpress installation for blogging. I hope to see you soon on my new blog site.
There is already a new blog post about setting up SUSE Manager.

Friday, April 8, 2011

Cobbler on openSUSE

Preamble


What is cobbler?


To answer that, I want to quote from the homepage of Cobbler


Cobbler is a Linux installation server that allows for rapid setup of network installation environments. It glues together and automates many associated Linux tasks so you do not have to hop between lots of various commands and applications when rolling out new systems, and, in some cases, changing existing ones.

With a simple series of commands, network installs can be configured for PXE, reinstallations, media-based net-installs, and virtualized installs (supporting Xen, qemu, KVM, and some variants of VMware). Cobbler uses a helper program called 'koan' (which interacts with Cobbler) for reinstallation and virtualization support.


This artice describes the installation and setup of Cobbler on openSUSE 11.4 and the basic steps of using it.

Preparation


Install the required software


First of all, you need it install an openSUSE 11.4 with the cobbler+cobbler-web package installed of course :)

Most people will have those repos already after the installation but anyway, if you don't have the default repos do:

zypper ar http://download.opensuse.org/distribution/11.4/repo/oss/ oss
zypper ar http://download.opensuse.org/update/11.4/ updates

There is cobbler v2.0.10 on openSUSE 11.4 (oss repo) but that version does not have all fixes and functionality you want. So you have to use the latest cobbler version you can find in this repo:


zypper ar http://download.opensuse.org/repositories/systemsmanagement/openSUSE_11.4/ cobbler
zypper ref -s

Make sure you have the latest mod_python module update installed. It has to be at least apache2-mod_python-3.3.1-161 because the 11.4 goldmaster version of mod_python has a bug and does not work with any python script. We released an online update for mod_python on 11.4 on openSUSE 11.4 in the beginning of march 2011, so maybe you already have it installed. In any case, do:

zypper up apache2-mod_python

Now we install cobbler:

zypper install cobbler cobbler-web atftp

That should install version 2.1.0 or later. We are done with the package installation and have to do some configuration now.


Basic configuration of Cobbler


If you want to use the cobbler web ui, you have to authenticate and there are multiple ways cobbler can authenticate a user. In the file /etc/cobbler/modules.conf we set the authentication module to authn_configfile. That will read the account information from /etc/cobbler/users.digest:

sed -i 's/module = authn_denyall/module = authn_configfile/' \
/etc/cobbler/modules.conf

There are more auth modules like for ldap-authentication and they are all documented in /etc/cobbler/modules.conf

Now we change the server settings in /etc/cobbler/settings. Search for "server: 127.0.0.1" in that file and replace it with the ip address of your cobbler server. That address will end later in the autoyast=..... and install=.... parameter.


YOUR_IP="....."
sed -i "s/^server: 127.0.0.1/server: $YOUR_IP/" \
/etc/cobbler/settings

We are done with the basic configuration now and it's time start cobbler for the first time:

insserv apache2
insserv cobblerd
rcapache2 restart
rccobblerd restart

First Steps


Look around


take your webbrowser and visit http://localhost/cobbler_web. You'll get a login mask where you can login with user: cobbler, password: cobbler. That's the default configuration in /etc/cobbler/users.digest and we did not change that so far. If you want to add your own accounts, you can do that by:


htdigest2 /etc/cobbler/users.digest "Cobbler" $USER

After the login, your webbrowser presents you a webpage like this:


We are ready to work with cobbler now.

Importing a Distro


To do installations, we need an installation source. So let us import one into Cobbler and we use the openSUSE 11.4 DVD for that. Please mount the DVD to /mnt and choose "Import DVD" on the left side of the webui. Fill out the form like you see on the screenshot:


If you press the "run" button, an import job is being scheduled. You can see the job by clicking on "Events" (third link from the top in "Configuration" on the left side). Your import job has the state "running" but that will change to "complete" in a while, when cobbler has copied the complete DVD to the harddisk.

When Cobbler has finished the import, two new distros are created like you can see on the Distros page


Distro is another word for installation source but why two? Because the DVD contains two bootable kernels. One for xen guests and one for a normal physical machine. You can see that one distro got a "xen" in the name and that's the installation source you can use to install virtual xen machines.
As you can see, an install=... parameter has already been added by Cobbler so the distro is ready for installations. You can add own kernel parameter if you wish but for this tutorial it's not needed.

Adding an Autoinstallation Profile


Profiles in Cobbler are connected to a distribution.

If you click on Profiles you can see that cobbler has created two empty autoinstallation profiles already - one for each distro. We will ignore those and create our own one by chosing "Create new profile" and click on "go". Copy your AutoYaST XML file to /var/lib/cobbler/kickstarts/ (or any other path you like) and fill out the form like I did:


You can see that I selected the non-xen version of our distros. If you want to install a virtual xen machine, you have to choose the other distro with the "xen" in the name.

If you press "save" you'll get back to the profile overview page where you can see three profiles now, including the one you just created.

On the right side of each profile is a link "view kickstart" and if you press on that, you'll see your XML file (cobbler has added some scripts but you don't have to care about that now).

Install a virtual machine


We have a distro and an AutoYaST XML file now and that's enough to create a virtual machine. I'll not explain here how to setup kvm or xen but I assume you have a physical machine configured for running virtual machines. I use kvm and need to to some little changes in the test_profile for that. I change the virt-type to qemu and the Virt Bridge from xenbr0 tp br0 because that's how the bridge is called on my virtual host platform.

You have to install koan from the same repo as cobbler on your virtual host platform (cobbler itself is not needed to be installed) and run:

koan --server=$your_cobbler_server.example.net \
--virt \
--profile=test_profile \
--virt-name=virt_host1

This will trigger the creation and autoinstallation of a virtual machine called "virt_host1". If you start virt-manager, you can see that the machine is installing the openSUSE 11.4 with the AutoYaST XML file.

Bare Metal Installation


If you want to do bare metal installations via PXE boot, you need to acticate the tftp server on the Cobbler machine:

rcatftpd start
insserv atftpd

For the bare metal installation we have to create a system record in Cobbler, so let's got to Systems -> create new system and configure the fields as I di in the screenshot:


When you press save you will be redirected to the systems-list and you can see your system there. If you switch to the console, you can see that a PXE boot config file was created in /srv/tftpboot/pxelinux.cfg/01-yo:r:mac:add:rr:ess so it'll start an installation next time it boots.

If you set the option pxe_just_once in /etc/cobbler/settings to "1", autoyast will turn off the PXE boot before it reboots at the end of the 1st stage, so you don't have endless PXE boot loops. You can switch on/off the netboot option for a system in the web ui of cobbler.

What else?


There is a lot to discover in cobbler. For example:

  • You can create Snippets which are a kind of include files but way more powerful. They can be referenced by $SNIPPET(name_of_snippet) then in the AutoYaST XML file

  • You can let Cobbler manage your dhcp server, so all systems get a dhcp record automatically (very useful, I use it here in my testlab)
  • You can let Cobbler manage your dns server, so all systems get a dns record automatically (very useful too but I don't use it here)
  • You can create boot ISO images so you can do installations without network
  • You can register existing systems by calling cobbler-register to add a system-record based on the running system automatically (devel:tools:python-ethtool is needed for that on the client)

  • You can let koan reinstall a running machine. It'll copy kernel/initrd to the harddisk and rewrites the grub config. With the next reboot, a new system is getting installed on the machine
  • cobbler has a command line client tool called cobbler that lets you do everything you can do in the web ui via command line too
  • ...


As you can see, cobbler offers a lot more than I can cover in one blog.

If you have questions or look for more information go to:

Of course you can send me an eMail too.


have fun, Uwe

Friday, March 4, 2011

SUSE Manager Autoinstall Screenshots

as you might know, we published the SUSE Manager yesterday.
It was fun to work on that project and I learned really a lot.
Anyway, I read many announcement texts in the press and from Novell but I did not see any pictures. People love pictures. So here they come (most screenshots about autoinstallation - I guess you know why ;) ).

Overview page:

AutoYaST/Kickstart Profiles overview:
Edit an AutoYaST profile:

Overview of your systems (machines and virtual machines):
Reinstall a physical machine with AutoYaST/Kickstart:

Install a virtual machine on a physical host with AutoYaST:


Configure bare metal installations (assign an AutoYaST XML file to an ip address range):
that's it for now!
Have fun - Uwe