середа, 14 квітня 2010 р.

Памятка - как сделать custom RedHat iso образ

Памятка для себя - как сделать свою сборку RHEL с нужным набором rpm

Взято с linuxquestions.org

this is how I make bootable SOs of RHEL 5.x

1.Download the media from http://www.redhat.com and save to /tmp
2.Create a directory structure

mkdir -p /build/rhel52

3.Mount the ISO

mount -oloop /tmp/rhel-5-server-x86_64-dvd.iso /mnt

4.Copy the files from the DVD to the /build/rhel52 directory

rsync -rv /mnt/* /build/rhel52
cp /mnt/.discinfo /build/rhel52
cp /mnt/.treeinfo /build/rhel52

5.At this point we can remove unneeded RPMs and directories(VT, Cluster, ClusterStorage), on a running system generate a list of RPMs by running the following command:

rpm -qa --queryformat '%{name},%{version}-%{release},%{arch}\n' | sort -n > /tmp/rhel5.2-rpm

6.We need to add .rpm to the list we just generated

cat /tmp/rhel5.2-rpm | sed 's/$/.rpm/g' > /build/rhel52/rhel52-list

7.Get a list of the available RPMs from the media

ls -1 /build/rhel52/Server > /build/rhel52/rhel52-all

8.Generate a list of not needed files

diff -uNr /build/rhel52/rhel52-list /build/rhel52/rhel52-all | grep ^+ > /build/rhel52/remove-list

9.Need to remove 3 lines in the rhel52-all list

vi /build/rhel52-all 
- Remove TRANS.TBL and repodata - also the top line of the file

10.Create a script to remove the unneeded files

#uncomment the next line for troubleshooting
#set -x
LINES=`cat remove-list | wc -l`
while [ $LINE_NO -le $LINES ]
BADFILE=`sed -n "${LINE_NO}p" remove-list`
rm -f /build/rhel52/Server/$BADFILE
LINE_NO=`expr $LINE_NO + 1 `

11.We need to fix the repositories that are a part of the RHEL media

createrepo -g /build/rhel52/Server/repodata/comps-rhel5-server-core.xml /build/rhel52/Server

12.Create a directory for your files

mkdir /build/rhel52/addons

15.Copy files to the addons directory

cp /pathtofiles/addons/* /build/rhel52/addons/

13.Create kickstart file from the kickstart server (I have a webpage that I use to create my kickstarts)
Copy kickstart file to build directory

cp kickstart_file /build/rhel52

14.Vi the kickstart file and change the following:

change the url --url http:// line to cdrom

Insert this above %post:
%post --nochroot
mount /tmp/cdrom /mnt/sysimage/mnt

Change the lines from /bin/rpm -Uhv http:// to /bin/rpm -Uhv /mnt/addons/

Also any references to wgets can be included in the addons directory then copied to location

15.To make install easier vi the /build/rhel52/isolinux/boot.msg and cp the 2nd line that says "To install or upgrade in text mode" and paste under the use the function key line.


- To install or upgrade in graphical mode, press the 01 ENTER 07 key.
- To install or upgrade in text mode, type: 01linux text ENTER 07.
- Use the function keys listed below for more information.
- To install the RHEL 5.2 DFS Image, type: 01linux ks=cdrom:/rhel52.ks.cfg ENTER 07.

The bottom line is the install line, the 01 on the front and 07 on the end is actually a control key sequence that makes the text bold

16.Once that is completed you can run the following to create the ISO image:

mkisofs -r -T -J -V "RHEL52 DVD" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /tmp/rhel52.iso /build/rhel52

1 коментар: