CentOS system cropping and ISO re-encapsulation

Source: Internet
Author: User

A. Installing a Linux system on a VM

B. Install the custom tool Anaconda Repodata Createrepo mkisofs

C. Too many associations using the Yum installation customization process requires generating comps.xml files and generating ISO

1, Custom installation system, select common components

2. Install the basic package required for the production of the release version

Yum install-y Createrepo Genisoimage

#genisoimage provide the/usr/bin/mkisofs command to regenerate the ISO

3. List of RPM files required to build the installation system

awk '/installing/{print $ ' install.log |sed ' s/^[0-9]*://g ' >/root/packages.list

#生成后, you need to look closely at the file, usually in some file start part such as "1:" Such characters, need to delete these characters, do not follow the copy action will be error

4. Create custom working directory

Mkdir-p/mnt/cdrom

Mkdir-p/data/os

Mount/dev/cdrom/mnt/cdrom

Rsync-a--exclude=packages/mnt/cdrom/*/data/os #将源系统镜像除packages目录所有文件拷贝到/data/os

Mkdir/data/os/packages

Check if there is a. discinfo file, and if you do not copy the files on the CD to/data/os, disk not found will appear if no such file is installed.

5, copy the streamlined RPM package

Vi/data/cprmps.sh #创建自动复制RPM包脚本

#!/bin/bash

Debug=0

Centos_dvd=/mnt/cdrom

All_rpms_dir=/mnt/cdrom/packages

Kos_rpms_dir=/data/os/packages

Packages_list=/root/packages.list

Number_of_packages= ' Cat $packages _list | Wc-l '

I=1

While [$i-le _of_packages]; Do

Line= ' head-n $i $packages _list | Tail-n-1 '

Name= ' echo $line | awk ' {print '} '

Version= ' echo $line | awk ' {print $} ' | 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 * $KOS _rpms_dir/"

CP $ALL _rpms_dir/$name-$version * $KOS _rpms_dir/

# in case the copy failed

If [$?-ne 0]; Then

echo "CP $ALL _rpms_dir/$name-$version *"

CP $ALL _rpms_dir/$name * $KOS _rpms_dir/

Fi

Fi

i= ' expr $i + 1 '

Done

#执行脚本

sh/data/cprmps.sh


6. Configuring Kickstart Scripts

KS files are divided into three main parts

A, system installation and configuration

b, custom Installation Preparation (%post--nochroot)

c, user-defined installation (%post)

System installation and configuration generally written in the Ks.cfg file, define the system installation settings to%post? Nochroot as the end flag, followed by the user-defined Installation Preparation section, with "%post--nochroot" as the beginning, with "%post" as the end,

The Custom Installation section starts with "%post".

General convenience can be modified directly by the anaconda-ks.cfg under root

Vi/data/os/isolinux/jeffery.cfg

#platform =x86, AMD64, or Intel EM64T

#version =devel

# Firewall Configuration

Firewall--disabled

# Install OS instead of upgrade

Install

# Use Network Installation

CDRom

# Root Password Jeffery

ROOTPW--iscrypted $1$hajb7jcc$hg.5dlmp2uhegxf88bdq3.

# System Authorization Information

Auth--useshadow--passalgo=md5

# Use graphical Install

#graphical

# Use text mode install

Text

Firstboot--disable

# System Keyboard

Keyboard US

# System Language

Lang en_US

# SELinux Configuration

SELinux--disabled

# Installation Logging Level

Logging--level=info

# Reboot after installation

Reboot

# System TimeZone

TimeZone Asia/shanghai

# Network Information

Network--bootproto=dhcp--device=eth0--onboot=on

# System Bootloader Configuration

Bootloader--LOCATION=MBR

# Clear the Master Boot Record

Zerombr

# Partition Clearing Information

Clearpart--all--initlabel

# Disk Partitioning Information

Part/boot--fstype= "Ext4"--size=100

Part swap--fstype= "swap"--size=1500

Part/--fstype= "EXT4"--grow--size=1

%packages

@security-tools

Aide

Amtu

Hmaccalc

Openscap

Openscap-utils

Tpm-tools

Trousers

%end

7. Generate Warehouse File Comps.xml

Cd/data/os

Createrepo-g repodata/*-comps.xml/data/os/

8. Let the system start the installation from the Kickstart configuration

Vi/data/os/isolinux/isolinux.cfg

Customizing the Startup interface

In Isolinux, there are three files and a custom installation interface.

Boot.msg is the definition of how the boot interface is displayed

ISOLINUX.CFG determines how the user's input is handled and the corresponding installation process is performed

SPLASH.LSS is the background image of the start screen

9. Generate ISO file

Cd/data/os

Mkisofs-o/root/jeffery_centos.6.5_x86.iso-b isolinux/isolinux.bin-c Isolinux/boot.cat-no-emul-boot- Boot-load-size 4-boot-info-table-joliet-long-r-j-v-t/data/os/

If it appears, the following is basically a custom success.

10. Generate MD5 Test Code

11. Testing

Create a new machine using a custom ISO

FAQ:

To copy the ". Discinfo" file from the CD, if you do not copy the file, when you install the CD-ROM

The following error is prompted: "The CentOS CD is not found in any of your CDROM drives.

Please insert the CentOS CD with press OK to retry. "

CentOS system cropping and ISO re-encapsulation

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.