Customize your own CentOS5 automatic installation CD based on kickstart

Source: Internet
Author: User
1. download the complete DVD from www.centos.org. first, you need to customize the installation, and then install/root/install from the secure system. log to generate the list of software you want to install, run the following command cat/root/install. l...

 

1. download the complete DVD from www.centos.org.

2. first, you need to customize the installation, and then install/root/install from the secure system. log to generate the list of software you want to install. run the following command:

Cat/root/install. log | grep Installing | sed's/Installing // g' | sed's/^ [0-9] \ +: // g'>/tmp/rpm. log

Create a directory for storing rpm packages mkdir-p/data/cdrom/CentOS

Mount the ISO of CenOS55 to mount-o loop CentOS-5.5-i386-bin-DVD.iso/mnt under/mnt

Put the software in rpm. log in a directory and use the rpm. sh file.

#! /Bin/bash

DEBUG = 0

LT_CD =/mnt

ALL_RPMS_DIR =/mnt/CentOS

LT_RPMS_DIR =/data/cdrom/CentOS

Packages_list =/tmp/rpm. log

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 }''

Version = 'echo $ line | awk' {print $3} '| cut-f 2-d :'

If [$ DEBUG-eq "1"]; then

Echo $ I: $ line

Echo $ name

Echo $ version

Fi

If [$ DEBUG-eq "1"]; then

Ls $ ALL_RPMS_DIR/$ name-$ version *

If [$? -Ne 0]; then

Echo "cp $ ALL_RPMS_DIR/$ name-$ version *"

Fi

Else

Echo "cp $ ALL_RPMS_DIR/$ name-$ version * $ LT_RPMS_DIR /"

Cp $ ALL_RPMS_DIR/$ name-$ version * $ LT_RPMS_DIR/

# In case the copy failed

If [$? -Ne 0]; then

Echo "cp $ ALL_RPMS_DIR/$ name-$ version *"

Cp $ ALL_RPMS_DIR/$ name * $ LT_RPMS_DIR/

Fi

Fi

I = 'expr $ I + 1'

 

Done

 

Execute sh rpm. sh

You can copy the required package to/data/cdrom/CentOS.

Copy other CD files to/data/cdrom/CenOS

Run rsync-avpz-exclude = "CenOS"/mnt/*/data/cdrom/

Note that you do not need to use the cp command because the cp command does not copy the files starting with "." and No. discinfo. treeinfo in the ISO file. the CD cannot be used. remember! It took me one morning to discover this problem.

 

3. update the structure of the CD software package

Cd/data/cdrom/CentOS

Createrepo-g ../repodata/comps. xml.

 

4. set it to automatic installation mode

Modify the/data/cdrom/CentOS/isolinux. cfg file as follows:

Cat/data/cdrom/CentOS/isolinux. cfg

Default linux

Display boot. msg

F1 boot. msg

F2 options. msg

F3 general. msg

F4 param. msg

F5 rescue. msg

Label linux

Kernel vmlinuz

Append initrd = initrd. img ramdisk_size = 8192 ks = cdrom:/ks. cfg

Label text

Kernel vmlinuz

Append initrd = initrd. img text

Label ks

Kernel vmlinuz

Append ks initrd = initrd. img

Label local

Localboot 1

Label memtest86

Kernel memtest

Append-

 

5. Generate the ks. cfg file

Cat/data/cdrom/CentOS/ks. cfg

Install

# Text

Cdrom

Lang zh_CN.UTF-8

Keyboard us

Network-device eth0-bootproto static-ip 192.168.10.25-netmask 255.255.255.0-gateway 192.168.10.1-nameserver 8.8.8.8-hostname annv

Rootpw annv.taobao.com ### the root password is www.taobao.com.

Firewall-disabled ### disable firewall

Authconfig-enableshadow-enablemd5

Selinux-disabled ### disable selinux

 

Firstboot-disable # disable firstboot

Timezone Asia/Shanghai ### time zone

 

### Clear the hard disk and set boot to 100 M/partition to 10 GB swap partition to 2 GB others/opt

Bootloader-location = mbr

Clearpart-all

Part/boot-fstype ext3-size = 100

Part/-fstype ext3-size = 10240

Part swap-size = 2048

Part/opt-fstype ext3-size = 100-grow

 

Skipx

 

% Packages

@ Admin-tools

@ Base

@ Chinese-support

@ Core

@ Dialup

@ Editors

@ System-tools

@ Text-internet

Keyutils

Kexec-tools

Trousers

Fipscheck

Device-mapper-multipath

Audit

# % Post

% Post-nochroot

Reboot ### automatically restart after installation

 

6. generate ISO and put this ISO under/data

Mkisofs-r-T-J-V "CentOS"-B isolinux/isolinux. bin-c isolinux/boot. cat-no-emul-boot-load-size 4-boot-info-table-o/data/CentOS5.5-i386.iso/data/cdrom/

 

Now the full text is complete!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.