Вы находитесь на странице: 1из 8

Development:Kickstart CD - ProjectDiaStar

http://wiki.projectdiastar.org/index.php/Developme...

Development:Kickstart CD
From ProjectDiaStar

Contents
1 Introduction to Using Kickstart 1.1 Introduction 1.2 Installing Necessary Tools 1.3 Create a Working Copy of the CentOS Installation Disk 1.4 Create a Kickstart Configuration File - ks.cfg 1.5 Changing the splash.lss File 1.6 Changing the Splash Image displayed by Grub (splash.xpm.gz) 1.7 Customizing Anaconda 1.7.1 Changing the Graphics displayed by Anaconda 1.8 Creating a Customized CentOS Distribution 1.8.1 Choose the appropriate RPMs to be in CentOS/RPMS 1.8.2 Test if all dependencies for all the RPMs in CentOS/RPMS are resolved 1.8.3 Create repodata using createrepo 1.8.4 Create the ISO Image 1.9 References 1.10 Additional Information

Introduction to Using Kickstart


Introduction
This page is about how to create a single boot CD installation. It is based on CentOS 5 and we are using the kickstart technology included with CentOS and Fedora to script the Anaconda installer. In addition to creating an automated install, this page also describes how to create a custom distribution of CentOS that includes only the needed RPMs. The distribution fits on one CD and is self-contained resolving all its dependencies. No network connection is required to install it. This was the process used to create the DiaStar ISO install disk Project DiaStar Server - ISO Install and is posted here in the event of your wanting to create a

1 of 8

05/26/2010 01:02 PM

Development:Kickstart CD - ProjectDiaStar

http://wiki.projectdiastar.org/index.php/Developme...

similar disk yourself.

Installing Necessary Tools


The scripts required to perform all the necessary operations are part of the CentOS / Fedora distribution.
# yum install anaconda-runtime createrepo yum-utils anaconda anaconda-help busybox-anaconda mkisofs

CentOS / Fedora also provides a graphical tool that allows creating and editing kickstart configuration files. This might be useful and is mentioned here for completeness. The description below is focused on manually editing the config files as this is almost easier than using a graphical tool. Start it by choosing Applications ? System Tools ? Kickstart. (Or: /usr/sbin/system-config-kickstrart).
# yum install system-config-kickstart

Create a Working Copy of the CentOS Installation Disk


We are using CentOS 5 to start with. Only CD 1 is required as we are interested in a customized minimal installation. Mount the CD and copy its content to a working directory:
$ $ $ $ $ mkdir centos-cd1 cd1 sudo mount /dev/cdrom centos-cd1 rsync -a centos-cd1/* cd1 cp centos-cd1/.discinfo cd1 sudo umount centos-cd1

Create a Kickstart Configuration File - ks.cfg


The most important file is the kickstart configuration file (ks.cfg). This file has to be copied to the root directory of the new CD. It provides all the parameters to Anaconda for an automated installation, determines what packages to install and allows some post installation scripts to be executed.

2 of 8

05/26/2010 01:02 PM

Development:Kickstart CD - ProjectDiaStar

http://wiki.projectdiastar.org/index.php/Developme...

####################################### # Kickstart file for DiaStar appliance # ####################################### #platform=x86, AMD64, or Intel EM64T #version=BETA # Firewall configuration # Dialogic RTP 49152 (2 ports per channel, rtp and rtcp) firewall --enabled --ssh --port=42420:tcp,49152-51152:udp # Root password rootpw --iscrypted $1$137n62W.$C4fWL0yd10McOTZOfwxVu1 # System authorization information auth --useshadow --passalgo=md5 # Use graphical install graphical firstboot --disable # Skip the X Window System configuration skipx # System keyboard keyboard us # System language lang en_US # SELinux configuration selinux --disabled # Install OS instead of upgrade install # Use CDROM installation media cdrom # System timezone timezone --utc America/New_York # Network configuration network --bootproto=query --device=eth0 --onboot=on --hostname=diastar # System bootloader configuration bootloader --location=mbr # Clear the Master Boot Record zerombr

# Partition clearing information clearpart --all --initlabel # Disk partitioning information part /boot --fstype="ext3" --size=128 part swap --size=1024 part / --fstype="ext3" --size=4096 part /var --fstype="ext3" --grow --size=1 # Pre installation #%pre # Packages to be installed %packages --resolvedeps e2fsprogs grub kernel ntp vim-enhanced gcc

3 of 8

05/26/2010 01:02 PM

Development:Kickstart CD - ProjectDiaStar

http://wiki.projectdiastar.org/index.php/Developme...

The file isolinux.cfg specifies that the splash screen to be displayed before starting the boot process is called boot.msg:
^L ^Xsplash.lss Press <ENTER> to start the installation.

WARNING: All data will be erased and the disk is formatted. -----------------------------------------------------------

Root password is "opendialogic".

^O02[F1-Main] [F2-Options] [F3-General] [F4-Kernel]^O07

Note: Adapt the other files options.mgs, general.msg, param.msg to your liking.

Changing the splash.lss File


The splash.lss file is the splash file that displays in the very first screen after the machine restarts and presents the user with the boot options. This file is in the directory /isolinux. An excellent description of how to do this is here (http://www.sweb.cz/Frantisek.Rysanek/splash/isolinux-splash-HOWTO.html) . First Step: Create an image file of the format 640 x 220 pixels using The Gimp. Down sample the colour depth to 14 colours. This is done in GIMP by going to ->Image->Mode select "indexed". Then save the file in the png format. second Step: Convert the
.png

file to

.lss

$ pngtopnm splash.png | ppmtolss16 '#c0c0c0=7' > splash.lss

Third Step: Copy the file


splash.lss

to the

/isolinux

directory.

Additional Notes on Down sampling Colour Depth in GIMP: Our target number of colours is 16. However, consider setting this to 15 or 14 to save one or two slots in the index table for one or two text colours. Alternatively, you can select suitable text colours from your resulting image and use them in your boot.msg (or whatever

4 of 8

05/26/2010 01:02 PM

Development:Kickstart CD - ProjectDiaStar

http://wiki.projectdiastar.org/index.php/Developme...

your welcome screen text is called). In The Gimp indexing dialog, you can also select an appropriate palette optimization method. For images originating in photos with a large number of colour shades use one of the Floyd-Steinberg dithering methods. This produces mellow random noise in the resulting image, greatly reducing the effects of low color depth. If you have a flat-colour company logo, choose "no dithering" - your company colours will be slightly shifted but clean. Please note that if you're already in indexed mode, e.g. as a result of loading an 8bpp GIF as a master image of your splash screen, you need to switch to RGB mode first and then back to indexed in order to get to the index generation screen, to get the palette down to 16 colours. The colour palette can be checked using [context menu]->dialogs->indexed palette.

Changing the Splash Image displayed by Grub (splash.xpm.gz)


1. Start the GIMP. 2. Click on File->New or type Ctrl+N 3. In the new image dialog, change Width to 640 pixels and Height to 480 pixels. (The image should be of size 640x480 pixels.) Now click OK. 4. Create the image which you would like to be the splash image. It's quite fun to experiment with the various tools of the GIMP! 5. After you have finished creating the image, hit Alt+i or right click on the image and click on Image->Mode->Indexed... 6. In the Indexed Color Conversion dialog that appears, click on the radio button "Generate optimal Palette" and in "# of colors" enter 14. Click OK.(The image should be of only 14 colors) 7. Now right-click on the image and click on File->Save As...Save the file as splash.xpm in a directory of your choice. 8. Now open a terminal window and navigate to the directory where you have saved splash.xpm 9. Now key in gzip splash.xpm 10. You will find that a file named splash.xpm.gz is created in the directory where splash.xpm used to exist. 11. Copy this splash.xpm.gz to the /boot/grub directory. You may want to back up the pre-existing splash.xpm.gz file in the /boot/grub directory first.

Customizing Anaconda
Anaconda is the program that provides all the installation services and displays all the graphics during the installation process. It is included in the directory

5 of 8

05/26/2010 01:02 PM

Development:Kickstart CD - ProjectDiaStar

http://wiki.projectdiastar.org/index.php/Developme...

cd1/images in a file-system image file called stage2.img. An excellent explanation of how to edit this image manually can be found here (http://wings.buffalo.edu /computing/ublinux/HOWTO-anaconda.html) .

Changing the Graphics displayed by Anaconda


The following describes a crude way of changing the artwork used by Anaconda during the installation process. The cleaner way would be to use buildinstall to create a new installer. In this case we start with an existing installer and modify it. The file-system image of the Anaconda installer can be found in cd1/images. The image file is called stage2.img. We will now mount this image so that we can look inside.
$ mkdir ~/anaconda $ mount -o loop cd1/images/stage2.img ~/anaconda

Now we need to copy the contents to a directory where we can alter the files. A simple cp command was claimed to not work because of some hard links included in the image. For this reason we use tar to package the contents of the directory and then untarred them where we could work on them.
$ $ $ $ $ $ cd ~/anaconda tar -cvf ~/stage2.tar . cd ~ mkdir stage2 cd stage2 tar -xvf ../stage2.tar

Now we can alter the artwork used by the installer located in usr/share/anaconda /pixmaps and the artwork used in the installation slide show in usr/share/anaconda /pixmaps/rnotes. You can also edit the text in the left sidebar, which is in HTML format, in usr/share/anaconda/help/[locale]. After you've made the desired modifications, we need to compress this information back into an .img file.
$ cd ~ $ mksquashfs

stage2/ stage2.img.new

Then, copy the altered stage2.img to the images directory.


$ cp stage2.img.new cd1/images/stage2.img

Creating a Customized CentOS Distribution


6 of 8 05/26/2010 01:02 PM

Development:Kickstart CD - ProjectDiaStar

http://wiki.projectdiastar.org/index.php/Developme...

The next steps describe how to create a customized distribution of CentOS that includes only the packages we want and their dependencies. This is the most time consuming step as it is an iterative process where you select packages and then test for dependencies until all dependencies are resolved.

Choose the appropriate RPMs to be in CentOS/RPMS


This is the most difficult step. It involves selecting a set if RPMS that comprise all the necessary elements for Linux to install and boot. In addition it requires all the RPMS required for the system you are building. In addition, all the dependencies have to be resolved. And lastly, its size must not exceed what can fit onto a single CD. We started with the first CD of the CentOS 5 distribution. The list of RPMs we deleted is long. In addition, it is possible to update the RPMs to their latest patch level which make s it unnecessary to run yum update after the system is installed.

Test if all dependencies for all the RPMs in CentOS/RPMS are resolved
The following test is absolutely crucial. Inevitably once you start removing or adding RPMs to the repository, you will have to make sure that all dependencies are resolved properly. Once the test below passes, you have succeeded to create a self-contained repository that will install properly.
$ $ $ $ cd ~ mkdir testdb rpm --initdb --dbpath $PWD/testdb rpm --test --dbpath $PWD/testdb -Uvh cd1/CentOS/*.rpm

Create repodata using createrepo


$ cd ~ $ createrepo -g repodata/comps.xml ~/cd1/

Create the ISO Image


$ cd ~ $ mkisofs -R -J -T -no-emul-boot -boot-load-size 4 -boot-info-table -V "DiaStar 1.0" \ -A "Created on 27/7/2009" -P "DiaStar" -p "DiaStar" -b isolinux/isolinux.bin \ -c isolinux/boot.cat -x "lost+found" -o DiaStar.iso cd1

7 of 8

05/26/2010 01:02 PM

Development:Kickstart CD - ProjectDiaStar

http://wiki.projectdiastar.org/index.php/Developme...

Optional (for check disk utility):


$ /usr/lib/anaconda-runtime/implantisomd5 DiaStar.iso

The ISO image can now be burnt to a CD for test.

References
http://sipx-wiki.calivia.com/index.php?title=A_Kickstart_CD_for_sipX_on_CentOS

Additional Information
http://fedoraproject.org/wiki/Anaconda http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual /Installation_Guide-en-US/ch-kickstart2.html http://fedoraproject.org/wiki/Kadischi/FAQ http://wings.buffalo.edu/computing/ublinux/HOWTO-selectpkg.html http://www.linuxjournal.com/article/6473 Retrieved from "http://wiki.projectdiastar.org/index.php/Development:Kickstart_CD" This page was last modified on 25 August 2009, at 19:26.

8 of 8

05/26/2010 01:02 PM

Вам также может понравиться