Monday, October 25, 2010

Using Apache2 to deploy & maintain SUSE

This entry is a little different because its open ended compared to my previous posts. The solution I'm about to share may or may not work for you and that's the nature of the enterprise IT environment. Nevertheless, I hope it will be a good reference for you.

Automation is an important aspect in enterprise IT. In this specific scenario, we are talking about the ability to scale deployment and maintenance of multiple SLES instances (or SLED or openSUSE). Unlike installing a single SLES instance for evaluation, the DVD media (or even USB sticks) is not going to cut it if you have 3, 5, 50 or 100s of SLES deployed in a data center. This also applies to setting up an IT training classroom of 25 machines.

To make things more interesting, if you have Blade servers, you'll noticed that each Blade server chasis/enclosure have only one shared physical DVD drive. Sure, its read-only and can be shared amongst all the blades but what if you need to install another software (requiring another DVD) on the first blade and the rest are still reading from your SLES DVD media? Oops.

The idea is to share the SLES binaries over the network and there are various mechanism like HTTP, FTP, NFS and even Samba (oh-boy). My preferred choice is HTTP via Apache2 webserver for 2 simple reasons. First, it works quite well from experience and as importantly, its really easy to setup (ie quick & painless setup).

Install Apache2

a) Command-line option: zypper in apache2



OR

b) GUI option: YaST -> Software Management -> Search for the apache2 package and click Accept & continue for automatic changes with associated packages for installation.




Configure Apache2

1) Edit the following configuration file at /etc/apache2/default-server.conf with your favourite text editor.

2) Under the Directory section (see screenshot), look for the line Options None and replace it with Options Indexes FollowSymLinks as shown in screenshot below. This allows apache2 webserver to list directories and also follow symbolic links.




Mounting ISOs under Apache2

1) The Document root for Apache2 is /srv/www/htdocs/ so I would suggest the following directory structure:

/srv/www/htdocs/software/SLES-11-SP1/i586
/srv/www/htdocs/software/SLES-11-SP1/x86_64

/srv/www/htdocs/software/SLES-11-SP1/s390x


By way of example above, you can see that I created a software sub-directory followed by directories for the product & version and, in turn, followed by the architecture.

2) Assuming you have the DVD ISO file somewhere on your filesystem (I usually put them in /media), you can mount them via:

mount -t iso9660 -o ro,loop /media/SLES-11-SP1-x86_64.iso /srv/www/htdocs/software/SLES-11-SP1/x86_64/


Starting Apache2

a) rcapache2 start

b) To make apache2 auto-start on boot, chkconfig -s apache2 on


Configure target SLES instances

1) On your target SLES instances, you can add a new repository via YaST.

For SLES 10: YaST -> Installation Source
For SLES 11: YaST -> Software Repositories

There is an equivalent zypper command but I find the GUI much more productive in this case. senyum

2) Click Add to add another source for YaST to query and retrieve software. Choose Specify URL... and enter the URL to the Apache2 server you've just setup.

As an example, assuming your target is SLES 11 SP1 & as shown in screenshots below, you enter http://[IP address to Apache2]/software/SLES-11-SP1/x86_64



Once this is setup, you may disable or remove other sources (like the one that points to your DVD media).


Conclusions

1) It works well and scales nicely to quite a degree.

2) You don't waste DVDs (or the time in creating them).

3) You get to keep all your ISO binaries in one place which is great from admin standpoint. Plus, you do not waste disk space storing duplicate ISOs spread all over your servers or SAN.

4) If you have virtualized SLES instances, this works just as well since its all network based. As long as your servers (physical or virtual) has a network path to your Apache2, its good. Heck, you can even virtualize this Apache2 server if you like.

peace


What's not documented in this blog entry is how to setup a PXE-boot server (tftp & dhcpd) environment in SLES in addition to Apache2 (mentioned above) so you can provision new servers that are capable of booting up over the network and kick-start the installation process with Auto-YaST.

If you are interested, let me know in the comments section and I'll look into writing it... in the meantime, I can refer you to these helpful resources:

http://en.opensuse.org/SDB:PXE_boot_installation
http://www.novell.com/coolsolutions/feature/17719.html

senyum

No comments:

Post a Comment

Post a Comment