Customize your own CentOS system

Source: Internet
Author: User


Re-package CentOS into a new ISO to automatically partition, select the original package, and quickly install the system.

1. Mount the optical drive, create a temp directory
Mount/dev/cdrom/mnt/cdrom
Mkdir-p/root/iso/centos

2. Use the cp.sh script to extract the required RPM package, the normal installation of the operating system in the/root directory will have install.log files, this is the operating system installed RPM package records, we from these records, the required RPM package from the/mnt/cdrom/ Copy it into the/root/iso/centos inside the packages.

#!/bin/bash
Cd/root
awk '/installing/{print $ ' install.log | Sed ' s/^[0-9]*://g ' >package.txt
Dvd= '/mnt/cdrom/packages '
Packdir= '/root/package.txt '
New_dvd= '/root/iso/centos/'
While Read line
Do
CP ${dvd}/${line}*.rpm/${new_dvd} | | echo "$LINE don t CP ..."
Done < Package.txt

3. Copy all the original images except the packages directory to the/root/iso directory

Rsync-a--exclude=packages/mnt/cdrom//root/iso


4. Copy the anaconda-ks.cfg from the/root directory to the/root/iso directory and modify the installation requirements according to your actual needs.

#version =devel
Install
Text
CDRom
Lang en_US. UTF-8
Keyboard US
Network--onboot no--device em1--bootproto DHCP--noipv6
Network--onboot no--device em2--bootproto DHCP--noipv6
ROOTPW 123456----Default password
Firewall--disabled----shutting down the firewall
Authconfig--enableshadow--passalgo=sha512
SELinux--disabled----Disable SELinux
TimeZone--UTC Asia/shanghai
bootloader--location=mbr--driveorder=sda--append= "Crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions deleted is not expressed
# unless you clear all partitions first
# Guaranteed to work
#clearpart--none
Clearpart--all--initlabel
Zerombr
Part/boot--FSTYPE=EXT4--size=200
Part swap--size=32000
Part pv.008003--grow--size=200
Ignoredisk--ONLY-USE=SDA
Volgroup volGroup00--pesize=4096 pv.008003
Logvol/--FSTYPE=EXT4--name=logvol00--vgname=volgroup00--size=200000
Logvol/data--FSTYPE=EXT4--name=logvol01--vgname=volgroup00--size=1655232
Reboot
#repo--name= "CentOS"--baseurl=cdrom:sr0--cost=100
%packages
@chinese-support
@core
@server-policy
%end

5. Have ISO follow the Anaconda-ks.cfg file to perform the installation

Vi/root/iso/isolinux/isolinux.cfg
Default VESAMENU.C32 modified to default Linux ks=cdrom:/anaconda-ks.cfg

6. Regenerate the repo file using the repo.sh script

#!/bin/bash
Iso_dir=/root/iso
CD ${iso_dir}
Declare-x discinfo=$ (head-1. Discinfo)
MV ${iso_dir}/repodata/*x86_64-comps.xml ${iso_dir}/repodata/c6-x86_64-comps.xml
Createrepo-g ${iso_dir}/repodata/c6-x86_64-comps.xml ${iso_dir}
#createrepo-U "media://$discinfo"-G ${iso_dir}/repodata/c6-x86_64-comps.xml ${iso_dir}
MV ${iso_dir}/repodata/*x86_64-comps.xml ${iso_dir}/repodata/c6-x86_64-comps.xml
Createrepo-u "media://$discinfo"-G ${iso_dir}/repodata/*c6-x86_64-comps.xml ${iso_dir}

7. Making ISO
Yum-y Install Mkisofs
Mkisofs-o Mycentos.iso-b isolinux/isolinux.bin-c isolinux/boot.cat-no-emul-boot-boot-load-size 4-boot-info-table-r -j-v-t/root/iso/

After executing the command, a Mycentos.iso file is generated in the current directory, so a custom version of CentOS comes out.


* * Reference Interface * *
http://kling.blog.51cto.com/3320545/1249962
http://lihuipeng.blog.51cto.com/3064864/759122

Customize your own CentOS system

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.