Customize Your Own Linux

Topic: Customize Your OWN CentOS ISO Image.

Environment:

HW: PC(64bit processor)

SW: Win7 Home Basic

Platform:VMware Server 2(www.vmware.com)

Primary/TargetOS: CentOS 6.0/5.x x86_64 (www.centos.org or http://mirrors.163.com/centos/)

 

1. Create oneCentOS6.0/5.x virtual machine on VMware server platform and select necessarypackages(According to your own preferences).

2. Update theOS packages.

linuxdba--> yum update

linuxdba--> reboot     //reboot the systemafter OS upgrade

3. Copy someessential files from primary iso image.

linuxdba--> mkdir /linuxdba      (Target iso base dir)

linuxdba--> mount /dev/cdrom  /mnt

linuxdba--> cd /mnt

linuxdba-->cp  .discinfo .treeinfo TRANS.TBL repodataisolinux  images /linuxdba

linuxdba--> mkdir /linuxdba/CentOS

4. Installsome essential tools/packages

linuxdba--> yum install createrepo yum-utils anaconda mkisofs

5. Download the OS rpms by following script.

#!/bin/bash

DEBUG=0

RPMS_STORE_DIR=/linuxdba/CentOS

rpm -qa >/tmp/packages.list

cd$RPMS_STORE_DIR

packages_list=/tmp/packages.list

number_of_packages=`cat$packages_list | wc -l`

i=1

while [ $i-le $number_of_packages ] ; do

line=`head -n$i $packages_list | tail -n -1`

name=`echo$line | awk '{print $1}'`

yumdownloader$name

i=`expr $i +1`

done

rm -f/tmp/packages.list

 

6. Createks.cfg file under isolinux.

linuxdba--> touch /linuxdba/isolinux/ks.cfg

My ks.cfg forCentOS 5.7:

# Kickstartfile automatically generated by anaconda.

install

text

cdrom

langen_US.UTF-8

keyboard us

skipx

network--device eth0 --bootproto dhcp --hostname LinuxdbaOS

rootpw --iscrypted$1$y8Bfyokr$hgnioo7v.XsK7PtzhxED2/

authconfig--enableshadow --enablemd5

firewall--disabled

selinux--disabled

timezoneAsia/Chongqing

bootloader--location=mbr --driveorder=sda --append="rhgb quiet"

# Thefollowing is the partition information you requested

# Note thatany partitions you deleted are not expressed

# here sounless you clear all partitions first, this is

# notguaranteed to work

#clearpart--linux

#part /boot--fstype ext3 --size=600

#part /data--fstype ext3 --size=24000

#part swap--size=2500

#part /--fstype ext3 --size=100 --grow --asprimary

clearpart--all --initlabel

part /boot--fstype=ext3 --size=600

part swap--size=2000

part /--fstype ext3 --grow --asprimary --size=200

reboot

%packages

@base

@chinese-support

@core

@development-libs

@development-tools

@dialup

@editors

@gnome-desktop

@base-x

keyutils

iscsi-initiator-utils

trousers

fipscheck

device-mapper-multipath

imake

xorg-x11-server-Xnest

xorg-x11-server-Xvfb

glibc

glibc-devel

compat-libstdc++

libstdc++

sysstat

 

My ks.cfg forCentOS6.0:

# Kickstart file automaticallygenerated by anaconda.

#version=RHEL6

install

text

cdrom

lang en_US.UTF-8

keyboard us

skipx

rootpw  --iscrypted$6$nDNKIJpOAdMWMN9B$.7iUcgBoC79lGr.9Ee.Kcpe5IUBLhmNROlx8EKMgOI50KpJ9P0UBpmWRjPHQQK3VlH4lVfnRcEe1JLuYPdJOH1

firewall--disabled

authconfig --enableshadow--passalgo=sha512 --enablefingerprint

selinux--disabled

timezone Asia/Shanghai

network--device eth0 --onboot=yes --bootproto dhcp --noipv6 --hostname=LinuxdbaOS.org

bootloader --location=mbr--driveorder=sda --append="crashkernel=auto rhgb quiet"

# The following is the partitioninformation you requested

# Note that any partitions youdeleted are not expressed

# here so unless you clear allpartitions first, this is

# not guaranteed to work

#clearpart --none --drives=sda

clearpart --all --initlabel

part / --fstype=ext4 --grow--size=200

part /data --fstype=ext4--size=15000

part swap --size=3000

#repo--name="CentOS" --baseurl=file:///mnt/source --cost=100

reboot

%packages

@base

@chinese-support

@compat-libraries

@core

@basic-desktop

@desktop-platform

@development

@ftp-server

@fonts

@java-platform

@large-systems

@legacy-unix

@legacy-x

@mainframe-access

@nfs-file-server

@optional

@php

@perl-runtime

@server-policy

@x11

mtools

sgpio

cjkuni-fonts-ghostscript

libstdc++-docs

imake

compat-gcc-34

compat-gcc-34-g77

jpackage-utils

gcc-objc

gcc-objc++

compat-gcc-34-c++

xferstats

cjkuni-fonts-ghostscript

telnet

tcp_wrappers

tftp

xterm

libXmu

festival-lib

bind-libs

libXxf86dga

libmcpp

yum-plugin-fastestmirror

libss

ConsoleKit-libs

libedit

mpfr

libtar

automake16

libfprint

libXfont

libdmx

libfontenc

libnih

fipscheck-lib

libgtop2

perl-DBD-SQLite

unixODBC

unixODBC-devel

libaio-devel

libaio

createrepo

mkisofs

yum-utils

-jomolhari-fonts

-dejavu-serif-fonts

-lohit-assamese-fonts

-lohit-bengali-fonts

-lklug-fonts

-dejavu-sans-mono-fonts

-liberation-serif-fonts

-thai-scalable-waree-fonts

-abyssinica-fonts

-liberation-sans-fonts

-lohit-kannada-fonts

-khmeros-base-fonts

-paktype-tehreer-fonts

-kurdit-unikurd-web-fonts

-tibetan-machine-uni-fonts

-liberation-mono-fonts

-lohit-devanagari-fonts

-vlgothic-fonts

-smc-meera-fonts

-lohit-gujarati-fonts

-paktype-naqsh-fonts

-sil-padauk-fonts

-lohit-punjabi-fonts

-dejavu-sans-fonts

-un-core-dotum-fonts

-lohit-tamil-fonts

-stix-fonts

-lohit-telugu-fonts

-madan-fonts

-lohit-oriya-fonts

-NetworkManager

%end

 

7.  Edit /linux/isolunx/isolinux.cfg

Myisolinux.cfg for CentOS5.7:

default ks

prompt 1

timeout 12

displayboot.msg

F1 boot.msg

F2options.msg

F3general.msg

F4 param.msg

F5rescue.msg

label linux

  kernel vmlinuz

  append initrd=initrd.img

label text

  kernel vmlinuz

  append initrd=initrd.img text

label ks

  kernel vmlinuz

  append ks=cdrom:/isolinux/ks.cfginitrd=initrd.img

label local

  localboot 1

labelmemtest86

  kernel memtest

  append -

 

Myisolinux.cfg for CentOS6.0:

default auto

#prompt 1

timeout 10

display boot.msg

menu background splash.jpg

menu title Welcome to CentOS 6.0!

menu color border 0 #ffffffff#00000000

menu color sel 7 #ffffffff#ff000000

menu color title 0 #ffffffff#00000000

menu color tabmsg 0 #ffffffff#00000000

menu color unsel 0 #ffffffff#00000000

menu color hotsel 0 #ff000000#ffffffff

menu color hotkey 7 #ffffffff#ff000000

menu color scrollbar 0 #ffffffff#00000000

label auto

                kernel vmlinuz

                append ks=cdrom:/isolinux/ks.cfginitrd=initrd.img

label linux

 menu label ^Install or upgrade an existing system

 menu default

 kernel vmlinuz

 append initrd=initrd.img

label vesa

 menu label Install system with ^basic video driver

 kernel vmlinuz

 append initrd=initrd.img xdriver=vesa nomodeset

label rescue

 menu label ^Rescue installed system

 kernel vmlinuz

 append initrd=initrd.img rescue

label local

 menu label Boot from ^local drive

 localboot 0xffff

label memtest86

 menu label ^Memory test

 kernel memtest

 append -

8.  Create/update comps.xml

linuxdba--> createrepo -g repodata/comps.xml .

 

9. Create ISO.

For CentOS5.7:

linuxdba--> mkisofs -R -J -T -r -l -d -allow-multidot -allow-leading-dots -no-bak -o/opt/linuxdba.iso -b /linuxdba/isolinux/isolinux.bin -c /linuxdba/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .

ForCentOS6.0:

linuxdba--> mkisofs -R -J -T -r -l -d -joliet-long -allow-multidot-allow-leading-dots -no-bak -o /opt/linuxdbaOS.iso -b /linuxdba/isolinux/isolinux.bin -c /linuxdba/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .

10. You will get the target ISO file under /opt, Enjoy.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章