>

5自行安装光盘,简单定制二个符合本身用的Cen

- 编辑:www.bifa688.com -

5自行安装光盘,简单定制二个符合本身用的Cen

实验环境:VMware CentOS5.6(64bit)

定制centos 6.5自动安装光盘

一、制作环境准备
实验环境:
VMware Workstation
CentOS-6.5-x86_64-minimal 最小化安装
安装后,我们会使用系统 /root 目录下 install.log 和 anaconda-ks.cfg 这两个文件(在此基础上修改比较方便)

1.光盘目录结构

*isolinux 目录存放光盘启动时的安装界面信息
*images 目录包括了必要的启动映像文件
*Packages 目录存放安装软件包及信息
*.discinfo 文件是安装价质的识别信息
MediaCentOS 目录存放媒体中心安装包
Repodata 目录存放rpm包依赖信息
5.x 系列, boot.iso 存在于 images/ 这个目录
6.x 系列, 存放于 /isolinux 目录下
6.x 网络安装需要在官网下载:netinstall.iso 镜像文件

  1. 定制步骤
    (1)安装最小化的操作系统.包括基本的系统和所需要的工具等(我这先实现最小化自动安装)
    比如:对于http,mysql等软件,建议使用编译的方式安装, 然后打包放进去,可以减少许多依赖包的麻烦.
    (2)安装系统后,收集系统已安装的软件包,使用脚本统一转存到一个目录中.
    (3)在安装光盘复制images镜像,从光盘启动centos安装所需的文件等.
    (4)定义自己的kickstart安装脚本.
    (5)按照之前转存的软件(rpm)包, 重新生成光盘的repodata信息.
    (6)打包生成ISO文件,及MD5效验码.

二、操作过程记录:

1、安装所需工具包

1#yum-yinstallanacondarepodatacreaterepomkisofsrsync

2、 挂载并拷贝文件

目录规划:
挂载目录为: /mnt

定制光盘文件目录: /root/iso

[[email protected] ~]# pwd
/root
[[email protected] ~]# mkdir iso # 建立iso文件制作目录
[[email protected] ~]# mkdir -p ./iso/{Packages,repodata} # 建立软件包目录和repodata目录
[[email protected] ~]# mount /dev/cdrom /mnt # 挂载 DVD
mount: block device /dev/sr0 is write-protected, mounting read-only
# 拷贝 源DVD镜像中,除了Packages,repodata 目录外的所有文件到 iso 目录
[[email protected] ~]# /usr/bin/rsync -a --exclude=Packages --exclude=repodata /mnt/ ./iso/
[[email protected] ~]# ls iso
CentOS_BuildTag GPL Packages RPM-GPG-KEY-CentOS-6 RPM-GPG-KEY-CentOS-Testing-6
EFI images RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-Debug-6 TRANS.TBL
EULA isolinux repodata RPM-GPG-KEY-CentOS-Security-6

# 参考当前系统的安装包,拷贝
[[email protected] ~]# awk '/Installing/ {print $2}' install.log | xargs -i cp /mnt/Packages/{}.rpm ./iso/Packages/ #如果安装系统时选了安装语文为中文这里Installing会乱码
[[email protected] ~]# ls iso/Packages/ | wc -l
205
# 执行createrepo程序生成repodata下的comps.xml文件(重要)
#comps.xml 文件中包含了安装时用户所见到的与rpm相关的所有内容,它会检查Packages下
# 的RPM包的依赖关系,安装时如果缺少依赖包,它会提示您哪个RPM 包需要哪些依赖库。

[[email protected] ~]# pwd
/root
# 编辑 shell 脚本, 并执行
#!/bin/bash

ISO_DIR=/root/iso
cd ${ISO_DIR}
declare -x discinfo=$(head -1 .discinfo)

cp /mnt/repodata/*-minimal-x86_64.xml ${ISO_DIR}/repodata/minimal-x86_64.xml

createrepo -g ${ISO_DIR}/repodata/minimal-x86_64.xml ${ISO_DIR}

createrepo -u "media://$discinfo" -g ${ISO_DIR}/repodata/*-minimal-x86_64.xml ${ISO_DIR}

到这里,comps.xml文件和其他相关联的文件已被重新生成到repodata目录下。
Tips:如果你新增或删除了Packages目录的RPM包,请重新生成comps.xml文件。

3、制作 ks.cfg 脚本
ks文件由系统安装所创建的 anaconda-ks.cfg进行修改,当然也可以用system-config-kickstart工具制作而得。可以根据需要和实际情况进行修改:

编写.cfg文件

将~/anaconda-ks.cfg复制到~/ios/isolinux/ks.cfg

修改后Ks.cfg的内容如下

#Kickstartfileautomaticallygeneratedbyanaconda.

#version=DEVEL

install

#text

cdrom

#设置安装语言

#langen_US.UTF-8

langzh_CN.UTF-8

keyboardus

#skiptheXconfiguration

skipx

network--onbootno--deviceeth0--bootprotodhcp--noipv6

#设置root密码,此处为:centos

rootpw--iscrypted$6$q4pbJVjqD7ZmOEEq$f7C0H8gIBf3rlKXqVn0UOVfOYqYIG8kFU2yBghH5lc0uVjmU0mFTSgHe4MwZGuXvHWZOyXxhnBoIK9yIuDBt20

firewall--service=ssh

authconfig--enableshadow--passalgo=sha512

selinux--enforcing

timezone--utcAsia/Chongqing

bootloader--location=mbr--driveorder=sda--append="crashkernel=autorhgbquiet"

#Thefollowingisthepartitioninformationyourequested

#Notethatanypartitionsyoudeletedarenotexpressed

#heresounlessyouclearallpartitionsfirst,thisis

#notguaranteedtowork

#clearpart--linux--drives=sda

#volgroupVolGroup--pesize=4096pv.008002

#logvol/--fstype=ext4--name=lv_root--vgname=VolGroup--grow--size=1024--maxsize=51200

#logvolswap--name=lv_swap--vgname=VolGroup--grow--size=1984--maxsize=1984

#part/boot--fstype=ext4--size=500

#partpv.008002--grow--size=1

#clearpart--linux--drives=sda

#clearpart--all--initlabel

clearpart--all --initlabel #此命令必须添加,否则系统会让用户手动选择是否清除所有数据

#所有硬碟的分割表通通被清除!clearpart--all#僅清除vda硬碟的分割表,其他的硬碟不要清除分割表!clearpart--drives=vda--all

#此处设置分区

part/boot--fstype=ext4--size=300 --ondisk=sda

part/home--fstype=ext4--grow--size=1 --ondisk=sda #使用剩下的所有空间

part/opt--fstype=ext4--size=3000 --ondisk=sda

part/var--fstype=ext4--size=2000 --ondisk=sda

part/ --fstype=ext4--size=8000 --ondisk=sda

partswap--recommended --ondisk=sda

#repo--name="CentOS"--baseurl=cdrom:sr0--cost=100#这句一定要注释掉不然会提示找不到名为CentOS的有效的repo

#要安装的软件包@开头的为group,也可写单个包名如vim

%packages

@core

@server-policy

@workstation-policy

%end

#%post--nochroot

#mountcdrom

#/bin/mkdir-p/mnt/cdrom

#/bin/mount-r-tiso9660/tmp/cdrom/mnt/cdrom

#umountcdrom

#/bin/umount/mnt/cdrom

%post#这部分是安装完系统之后执行的步骤,可自定义

/bin/echo"mount-n-oremount,ro/">>/etc/rc.local

/bin/echo"tmpfs/tmptmpfsdefaults00">>/etc/fstab

%end

#--Rebootthehostafterinstallationisdone

reboot

4、修改 isolinux.cfg 配置文件,指定 ks 路径
注意,编辑这个文件,需要强制保存。 :wq!

# vi ./iso/isolinux/isolinux.cfg

defaultauto

#defaultvesamenu.c32

#prompt1

timeout600

displayboot.msg

menubackgroundsplash.jpg

menutitleWelcometoCentOS6.5!

menucolorborder0#ffffffff#00000000

menucolorsel7#ffffffff#ff000000

menucolortitle0#ffffffff#00000000

menucolortabmsg0#ffffffff#00000000

menucolorunsel0#ffffffff#00000000

menucolorhotsel0#ff000000#ffffffff

menucolorhotkey7#ffffffff#ff000000

menucolorscrollbar0#ffffffff#00000000

labelauto

kernelvmlinuz

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

labellinux

menulabel^Installorupgradeanexistingsystem

menudefault

kernelvmlinuz

appendinitrd=initrd.img

labelvesa

menulabelInstallsystemwith^basicvideodriver

kernelvmlinuz

appendinitrd=initrd.imgxdriver=vesanomodeset

labelrescue

menulabel^Rescueinstalledsystem

kernelvmlinuz

appendinitrd=initrd.imgrescue

labellocal

menulabelBootfrom^localdrive

localboot0xffff

labelmemtest86

menulabel^Memorytest

kernelmemtest

append-

5、生成iso镜像,并生成 MD5校验码

#cd ~/iso

#mkisofs-R-J-T-r-l-d-joliet-long-allow-multidot-allow-leading-dots-no-bak-o../myos-0.1-x86.iso

-bisolinux/isolinux.bin-cisolinux/boot.cat-no-emul-boot-boot-load-size4-boot-info-table./

CentOS 6.5系统定制自动化部署

根据自己的习惯,将CentOS重新打包成一个新ISO,可以自动分区、选择原件包,快速安装系统。

9.修改光盘背景,文字等信息

一、制作环境准备

实验环境:

VMware Workstation

CentOS-6.5-x86_64-minimal 最小化安装

安装后,我们会使用系统 /root 目录下install.log和anaconda-ks.cfg这两个文件(在此基础上修改比较方便)

1.1定制步骤**

1、安装最小化的操作系统.包括基本的系统和所需要的工具等.

比如:对于http,mysql等软件,建议使用编译的方式安装,然后打包放进去,可以减少许多依赖包的麻烦.

2、安装系统后,收集系统已安装的软件包,使用脚本统一转存到一个目录中.

3、在安装光盘复制images镜像,从光盘启动centos安装所需的文件等.

4、定义自己的kickstart安装脚本.

5、按照之前转存的软件(rpm)包,重新生成光盘的report信息.

6、打包生成ISO文件,及MD5效验码.

1.2 安装所需工具包

[[email protected]~]``#yum-yinstallanacondarepodatacreaterepomkisofsrsync

1.3 下载CentOS 6.5镜像

为了方便制作,我们可以在VMware、vbox、xen等虚拟环境中进行安装,这里我们选用了VMware作为制作环境。我们可以在官网或者其他比较近的镜像站点下载CentOS 镜像文件。CentOS-6.4-x86_64-minimal.iso

先用虚拟机按照正常的流程安装一个CentOS系统,接下来在这系统上去建立我们的定制系统:

9.1修改系统自动安装过程中显示的背景图片.修改光盘背景,文字等信息
#进入光盘images目录cd/data/ISO/images/#install.img镜像中包含了光盘安装过程中使用到的背景图片,挂载此img文件mount-oloop-tsquashfsinstall.img/mnt/installmkdirtmp#挂载的install.img不能编辑,需要拷贝一份,修改后替换原install.img文件rsync-av/mnt/install/tmp/#进入背景图片所在目录,选择需要修改的图片,并替换(主机图片尺寸,格式需要与原来的相同),图片位置为:tmp/install/usr/share/anaconda/pixmaps#重新创建新的install.imgmksquashfstmp/install_v1.img-all-root#替换install.imgcptmp/install_v1.imginstall.img

二、定制系统

2.1 光盘目录结构

*isolinux 目录存放光盘启动时的安装界面信息

*images 目录包括了必要的启动映像文件

*Packages 目录存放安装软件包及信息

*.discinfo 文件是安装价质的识别信息

MediaCentOS 目录存放媒体中心安装包

Repodata 目录存放rpm包依赖信息

5.x 系列, boot.iso 存在于 images/ 这个目录。

6.x 系列, 存放于 /isolinux 目录下

6.x 网络安装需要在官网下载:netinstall.iso 镜像文件。

2.2 挂载并拷贝文件

目录规划:

  • 挂载目录为: /mnt

  • 定制光盘文件目录: /root/iso

[[email protected]~]``#pwd``/root``[[email protected]~]``#mkdiriso#建立iso文件制作目录``[[email protected]~]``#mkdir-p./iso/{Packages,repodata}#建立软件包目录和repodata目录``[[email protected]~]``#mount/dev/cdrom/mnt#挂载DVD``mount``:blockdevice``/dev/sr0``iswrite-protected,mounting``read``-only``#拷贝源DVD镜像中,除了Packages,repodata目录外的所有文件到iso目录``[[email protected]~]``#/usr/bin/rsync-a--exclude=Packages--exclude=repodata/mnt/./iso/``[[email protected]~]``#lsiso``CentOS_BuildTagGPLPackagesRPM-GPG-KEY-CentOS-6RPM-GPG-KEY-CentOS-Testing-6``EFIimagesRELEASE-NOTES-en-US.htmlRPM-GPG-KEY-CentOS-Debug-6TRANS.TBL``EULAisolinuxrepodataRPM-GPG-KEY-CentOS-Security-6``#参考当前系统的安装包,拷贝``[[email protected]~]``#awk'/Installing/{print$2}'install.log|xargs-icp/mnt/Packages/{}.rpm./iso/Packages/``[[email protected]~]``#lsiso/Packages/|wc-l``205``#执行createrepo程序生成repodata下的comps.xml文件(重要)``#comps.xml文件中包含了安装时用户所见到的与rpm相关的所有内容,它会检查Packages下``#的RPM包的依赖关系,安装时如果缺少依赖包,它会提示您哪个RPM包需要哪些依赖库。``[[email protected]~]``#pwd``/root``#编辑shell脚本,并执行``#!/bin/bash``ISO_DIR=``/root/iso``cd``${ISO_DIR}``declare``-xdiscinfo=$(``head``-1.discinfo)``cp``/mnt/repodata/``*-minimal-x86_64.xml${ISO_DIR}``/repodata/minimal-x86_64``.xml``createrepo-g${ISO_DIR}``/repodata/minimal-x86_64``.xml${ISO_DIR}``createrepo-u``"media://$discinfo"``-g${ISO_DIR}``/repodata/``*-minimal-x86_64.xml${ISO_DIR}``###``到这里,comps.xml文件和其他相关联的文件已被重新生成到repodata目录下。``Tips2:如果你新增或删除了Packages目录的RPM包,请重新生成comps.xml文件。

1、挂载光驱

9.2 修改安装过程中的欢迎语
mkdir/data/ISO/isolinux/tmp#解压initrd.img镜像xz-dc../initrd.img|cpio-id#修改欢迎语.buildstamp文件,把其中的CentOS替换为PowerSoftvim.buildstamp#创建新的initrd.img并替换find.|cpio-c-o|xz-9--format=lzma>../initrd.img

附件下载:
  图片 1ks.cfg 下载地址:

6.5自动安装光盘 一、制作环境准备 实验环境: VMware Workstation CentOS-6.5-x86_64-minimal 最小化安装 安装后,我们会使用系统 /root 目录...

三、制作 ks.cfg 脚本

ks文件由系统安装所创建的 anaconda-ks.cfg进行修改,当然也可以用system-config-kickstart工具制作而得。这里大家需要根据实际情况进行修改:

  • 默认root用户密码: 123456

  • 静态获取地址

  • 硬盘至少15G

[[email protected]~]``#pwd``/root``[[email protected]~]``#cpanaconda-ks.cfg./iso/isolinux/ks.cfg``[[email protected]~]``#vim./iso/isolinux/ks.cfg``##请根据实际情况进行调整``#Kickstartfileautomaticallygeneratedbyanaconda.````#version=DEVEL``install``cdrom``langen_US.UTF-8``keyboardus``network--onboot``yes``--deviceeth0--bootprotostatic--noipv6--ip=192.168.3.132--netmask=255.255.255.0--gateway=192.168.3.254``rootpw--iscrypted$6$060kt9rryFXbrlgx$WWWNQYLnpz0Es8dTlouy3LXqjTdHIRToojidbpYoZrd2ETOJ.JsNbgnMylQVbFRThPZwSdRKJcrAml7LQDdR00``firewall--service=``ssh``authconfig--enableshadow--passalgo=sha512``selinux--disabled``timezone--utcAsia``/Chongqing````text``firstboot--disable``logging--level=info``reboot``````bootloader--location=mbr--driveorder=sda--append=``"crashkernel=autorhgbquiet"``zerombr````#Thefollowingisthepartitioninformationyourequested``#Notethatanypartitionsyoudeletedarenotexpressed``#heresounlessyouclearallpartitionsfirst,thisis``#notguaranteedtowork``#clearpart--none````#part/boot--fstype=ext4--size=200``#partswap--size=2048``#part/--fstype=ext4--grow--size=200````clearpart--all--initlabel``part``/boot``--fstype=ext4--size=200``partswap--size=2048``part/--fstype=ext4--size=10240``part``/data``--fstype=ext4--size=1--grow````#repo--name="CentOS"--baseurl=cdrom:sr0--cost=100````%packages--nobase``@core``%end

mount /dev/cdrom /mnt

四、修改 isolinux.cfg 配置文件,指定 ks 路径

注意,编辑这个文件,需要强制保存。 :wq!

[[email protected]~]``#vi./iso/isolinux/isolinux.cfg``defaultvesamenu.c32``#prompt1``timeout600``displayboot.msg``menubackgroundsplash.jpg``menutitleWelcometoCentOS6.5!``menucolorborder0``#ffffffff#00000000``menucolorsel7``#ffffffff#ff000000``menucolortitle0``#ffffffff#00000000``menucolortabmsg0``#ffffffff#00000000``menucolorunsel0``#ffffffff#00000000``menucolorhotsel0``#ff000000#ffffffff``menucolorhotkey7``#ffffffff#ff000000``menucolorscrollbar0``#ffffffff#00000000``labellinux````menulabel^Installorupgradeanexistingsystem````menudefault````kernelvmlinuz````appendinitrd=initrd.imgks=cdrom:``/isolinux/ks``.cfg``#仅修改这里即可``labelvesa````menulabelInstallsystemwith^basicvideodriver````kernelvmlinuz````appendinitrd=initrd.imgxdriver=vesanomodeset``labelrescue````menulabel^Rescueinstalledsystem````kernelvmlinuz````appendinitrd=initrd.imgrescue``label``local````menulabelBootfrom^``local``drive````localboot0xffff``labelmemtest86````menulabel^Memory``test````kernelmemtest````append-

2、创建临时目录

五、生成iso镜像,并生成 MD5校验码

##注意所在的目录``[[email protected]~]``#pwd``/root``[[email protected]~]``#cdiso``[[email protected]]``#pwd``/root/iso``[[email protected]]``#mkisofs-oCentOS-6.4_64.iso-input-charsetutf-8-bisolinux/isolinux.bin-cisolinux/boot.cat-no-emul-boot-boot-load-size4-boot-info-table-R-J-v-T-joliet-long/root/iso``genisoimage1.1.9(Linux)``Scanning``/root/iso``Excluded:``/root/iso/TRANS``.TBL``Scanning``/root/iso/repodata``Scanning``/root/iso/isolinux``Excluded:``/root/iso/isolinux/TRANS``.TBL``Excludedbymatch:``/root/iso/isolinux/boot``.``cat``Scanning``/root/iso/EFI``Excluded:``/root/iso/EFI/TRANS``.TBL``Scanning``/root/iso/EFI/BOOT``Excluded:``/root/iso/EFI/BOOT/TRANS``.TBL``Scanning``/root/iso/images``Excluded:``/root/iso/images/TRANS``.TBL``Scanning``/root/iso/images/pxeboot``Excluded:``/root/iso/images/pxeboot/TRANS``.TBL``Scanning``/root/iso/Packages``UsingRPM_G000.;1``for``/RPM-GPG-KEY-CentOS-Debug-6``(RPM-GPG-KEY-CentOS-Security-6)``UsingRPM_G001.;1``for``/RPM-GPG-KEY-CentOS-Security-6``(RPM-GPG-KEY-CentOS-6)``UsingRPM_G002.;1``for``/RPM-GPG-KEY-CentOS-6``(RPM-GPG-KEY-CentOS-Testing-6)``UsingCE2D6000.GZ;1``for``/root/iso/repodata/ce2d698b9fb1413b668443e88835a0642cea8f387c7f25cc946f56dd93f109bb-34bae2d3c9c78e04ed2429923bc095005af1b166d1a354422c4c04274bae0f59-minimal-x86_64``.xml.gz(ce2d698b9fb1413b668443e88835a0642cea8f387c7f25cc946f56dd93f109bb-minimal-x86_64.xml.gz)``UsingNSS_S000.RPM;1``for``/root/iso/Packages/nss-softokn-freebl-3``.14.3-9.el6.x86_64.rpm(nss-softokn-3.14.3-9.el6.x86_64.rpm)``UsingOPENS000.RPM;1``for``/root/iso/Packages/openssh-5``.3p1-94.el6.x86_64.rpm(openssh-clients-5.3p1-94.el6.x86_64.rpm)``UsingDEVIC000.RPM;1``for``/root/iso/Packages/device-mapper-persistent-data-0``.2.8-2.el6.x86_64.rpm(device-mapper-event-libs-1.02.79-8.el6.x86_64.rpm)``UsingFIPSC000.RPM;1``for``/root/iso/Packages/fipscheck-1``.2.0-7.el6.x86_64.rpm(fipscheck-lib-1.2.0-7.el6.x86_64.rpm)``UsingDEVIC001.RPM;1``for``/root/iso/Packages/device-mapper-event-libs-1``.02.79-8.el6.x86_64.rpm(device-mapper-multipath-libs-0.4.9-72.el6.x86_64.rpm)``UsingCRYPT000.RPM;1``for``/root/iso/Packages/cryptsetup-luks-1``.2.0-7.el6.x86_64.rpm(cryptsetup-luks-libs-1.2.0-7.el6.x86_64.rpm)``UsingDEVIC002.RPM;1``for``/root/iso/Packages/device-mapper-multipath-libs-0``.4.9-72.el6.x86_64.rpm(device-mapper-libs-1.02.79-8.el6.x86_64.rpm)``UsingIPTAB000.RPM;1``for``/root/iso/Packages/iptables-1``.4.7-11.el6.x86_64.rpm(iptables-ipv6-1.4.7-11.el6.x86_64.rpm)``UsingLIBSE000.RPM;1``for``/root/iso/Packages/libselinux-utils-2``.0.94-5.3.el6_4.1.x86_64.rpm(libselinux-2.0.94-5.3.el6_4.1.x86_64.rpm)``UsingNCURS000.RPM;1``for``/root/iso/Packages/ncurses-libs-5``.7-3.20090208.el6.x86_64.rpm(ncurses-5.7-3.20090208.el6.x86_64.rpm)``UsingDEVIC003.RPM;1``for``/root/iso/Packages/device-mapper-libs-1``.02.79-8.el6.x86_64.rpm(device-mapper-event-1.02.79-8.el6.x86_64.rpm)``UsingDEVIC004.RPM;1``for``/root/iso/Packages/device-mapper-event-1``.02.79-8.el6.x86_64.rpm(device-mapper-multipath-0.4.9-72.el6.x86_64.rpm)``UsingNCURS001.RPM;1``for``/root/iso/Packages/ncurses-5``.7-3.20090208.el6.x86_64.rpm(ncurses-base-5.7-3.20090208.el6.x86_64.rpm)``UsingSELIN000.RPM;1``for``/root/iso/Packages/selinux-policy-3``.7.19-231.el6.noarch.rpm(selinux-policy-targeted-3.7.19-231.el6.noarch.rpm)``UsingE2FSP000.RPM;1``for``/root/iso/Packages/e2fsprogs-libs-1``.41.12-18.el6.x86_64.rpm(e2fsprogs-1.41.12-18.el6.x86_64.rpm)``UsingCOREU000.RPM;1``for``/root/iso/Packages/coreutils-8``.4-31.el6.x86_64.rpm(coreutils-libs-8.4-31.el6.x86_64.rpm)``UsingCYRUS000.RPM;1``for``/root/iso/Packages/cyrus-sasl-2``.1.23-13.el6_3.1.x86_64.rpm(cyrus-sasl-lib-2.1.23-13.el6_3.1.x86_64.rpm)``UsingP11_K000.RPM;1``for``/root/iso/Packages/p11-kit-trust-0``.18.5-2.el6.x86_64.rpm(p11-kit-0.18.5-2.el6.x86_64.rpm)``UsingOPENS001.RPM;1``for``/root/iso/Packages/openssh-clients-5``.3p1-94.el6.x86_64.rpm(openssh-server-5.3p1-94.el6.x86_64.rpm)``UsingPLYMO000.RPM;1``for``/root/iso/Packages/plymouth-core-libs-0``.8.3-27.el6.centos.x86_64.rpm(plymouth-0.8.3-27.el6.centos.x86_64.rpm)``UsingCRACK000.RPM;1``for``/root/iso/Packages/cracklib-dicts-2``.8.16-4.el6.x86_64.rpm(cracklib-2.8.16-4.el6.x86_64.rpm)``UsingDEVIC005.RPM;1``for``/root/iso/Packages/device-mapper-multipath-0``.4.9-72.el6.x86_64.rpm(device-mapper-1.02.79-8.el6.x86_64.rpm)``UsingPLYMO001.RPM;1``for``/root/iso/Packages/plymouth-0``.8.3-27.el6.centos.x86_64.rpm(plymouth-scripts-0.8.3-27.el6.centos.x86_64.rpm)``Writing:InitialPadblockStartBlock0``Donewith:InitialPadblockBlock(s)16``Writing:PrimaryVolumeDescriptorStartBlock16``Donewith:PrimaryVolumeDescriptorBlock(s)1``Writing:EltoritoVolumeDescriptorStartBlock17``Sizeofbootimageis4sectors->Noemulation``Donewith:EltoritoVolumeDescriptorBlock(s)1``Writing:JolietVolumeDescriptorStartBlock18``Donewith:JolietVolumeDescriptorBlock(s)1``Writing:EndVolumeDescriptorStartBlock19``Donewith:EndVolumeDescriptorBlock(s)1``Writing:VersionblockStartBlock20``Donewith:VersionblockBlock(s)1``Writing:PathtableStartBlock21``Donewith:PathtableBlock(s)4``Writing:JolietpathtableStartBlock25``Donewith:JolietpathtableBlock(s)4``Writing:DirectorytreeStartBlock29``Donewith:DirectorytreeBlock(s)27``Writing:JolietdirectorytreeStartBlock56``Donewith:JolietdirectorytreeBlock(s)18``Writing:DirectorytreecleanupStartBlock74``Donewith:DirectorytreecleanupBlock(s)0``Writing:ExtensionrecordStartBlock74``Donewith:ExtensionrecordBlock(s)1``Writing:TheFile(s)StartBlock75````2.48%``done``,estimatefinishSatApr423:51:322015````4.95%``done``,estimatefinishSatApr423:51:122015````7.43%``done``,estimatefinishSatApr423:51:052015````9.90%``done``,estimatefinishSatApr423:51:022015````12.37%``done``,estimatefinishSatApr423:51:082015````14.85%``done``,estimatefinishSatApr423:51:052015````17.32%``done``,estimatefinishSatApr423:51:032015````19.80%``done``,estimatefinishSatApr423:51:072015````22.28%``done``,estimatefinishSatApr423:51:092015````24.75%``done``,estimatefinishSatApr423:51:082015````27.22%``done``,estimatefinishSatApr423:51:062015````29.69%``done``,estimatefinishSatApr423:51:052015````32.17%``done``,estimatefinishSatApr423:51:072015````34.64%``done``,estimatefinishSatApr423:51:062015````37.12%``done``,estimatefinishSatApr423:51:082015````39.59%``done``,estimatefinishSatApr423:51:072015````42.07%``done``,estimatefinishSatApr423:51:082015````44.54%``done``,estimatefinishSatApr423:51:072015````47.02%``done``,estimatefinishSatApr423:51:062015````49.49%``done``,estimatefinishSatApr423:51:082015````51.97%``done``,estimatefinishSatApr423:51:092015````54.44%``done``,estimatefinishSatApr423:51:082015````56.91%``done``,estimatefinishSatApr423:51:092015````59.39%``done``,estimatefinishSatApr423:51:082015````61.86%``done``,estimatefinishSatApr423:51:092015````64.34%``done``,estimatefinishSatApr423:51:092015````66.81%``done``,estimatefinishSatApr423:51:082015````69.29%``done``,estimatefinishSatApr423:51:072015````71.76%``done``,estimatefinishSatApr423:51:072015````74.24%``done``,estimatefinishSatApr423:51:062015````76.71%``done``,estimatefinishSatApr423:51:062015````79.18%``done``,estimatefinishSatApr423:51:052015````81.66%``done``,estimatefinishSatApr423:51:052015````84.14%``done``,estimatefinishSatApr423:51:052015````86.61%``done``,estimatefinishSatApr423:51:052015````89.09%``done``,estimatefinishSatApr423:51:052015````91.56%``done``,estimatefinishSatApr423:51:062015````94.04%``done``,estimatefinishSatApr423:51:052015````96.51%``done``,estimatefinishSatApr423:51:052015````98.98%``done``,estimatefinishSatApr423:51:052015``Totaltranslationtablesize:63812``Totalrockridgeattributesbytes:28361``Totaldirectorybytes:49152``Pathtablesize(bytes):112``Donewith:TheFile(s)Block(s)201838``Writing:EndingPadblockStartBlock201913``Donewith:EndingPadblockBlock(s)150``Maxbrkspaceused5e000``202063extentswritten(394MB)``##OK,此时会在/root/iso目录创建一个名为CentOS-6.4_64.iso的镜像文件``[[email protected]]``#ls*.iso``CentOS-6.4_64.iso``###MD5校验码``[[email protected]]``#pwd``/root/iso``[[email protected]]``#ls``CentOS-6.4_64.isoEULAisolinuxrepodataRPM-GPG-KEY-CentOS-Security-6``CentOS_BuildTagGPLPackagesRPM-GPG-KEY-CentOS-6RPM-GPG-KEY-CentOS-Testing-6``EFIimagesRELEASE-NOTES-en-US.htmlRPM-GPG-KEY-CentOS-Debug-6TRANS.TBL``[[email protected]]``#/usr/bin/implantisomd5CentOS-6.4_64.iso``Insertingmd5sumintoisoimage...``md5=90d069e78dddfb79877b4ab346ff2d50``Insertingfragmentmd5sumsintoisoimage...``fragmd5=16b043bf617895ecdee76fae52dfa8c926525e3a645ae1bf96f259a5e895``frags=20``Settingsupportedflagto0``[[email protected]]``#

mkdir  -p /root/iso/CentOS

六、安装测试

可以通过 Filezilla ,winscp 等软件把 iso 镜像传出来。然后可以通过虚拟机安装测试,如果测试没有问题,那么就可以刻录成光盘了。

通过 VMware Workstation 创建虚拟机,然后使用刚才我们创建的镜像。然后启动虚拟机,就会自动安装了。是不是 so easy ...

图片 2

本文出自 “Share your knowledge” 博客,请务必保留此出处

6.5系统定制自动化部署 一、制作环境准备 实验环境: VMware Workstation CentOS-6.5-x86_64-minimal 最小化安装 安装后,我们会使用系统 /root 目...

3、提取需要的RPM包,正常安装好操作系统在/root目录下会有install.log文件,这个就是操作系统安装RPM包的记录,我们从这些记录中,将所需的RPM包从/mnt/CentOS中复制到/root/iso/CentOS里面去

#!/bin/bash
cd /root
awk '/Installing/{print $2}' install.log | sed 's/^[0-9]*://g' >package.txt
DVD='/mnt/CentOS'   
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
rm -f package.txt

4、把原镜像除了CentOS目录外的文件全部复制至/root/iso目录下

cd /mnt 
ls | grep -v CentOS | xargs -i cp -Rp {} /home/test/

5、把/root目录下的anaconda-ks.cfg复制至/root/iso目录下,并根据自己实际需要修改安装要求

 # Kickstart file automatically generated by anaconda.

install
cdrom
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp
rootpw --iscrypted $1$fupKhGiH$sx2TexUjriSyu..IZUwT9.
firewall --disabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --disabled
timezone --utc Asia/Shanghai
bootloader --location=mbr --driveorder=sda
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --linux
part /boot --fstype ext3 --size=100
part swap --size=512
part / --fstype ext3 --size=100 --grow

%packages
@base
@core
@development-tools
@dialup
@editors
@text-internet
keyutils
openCryptoki
libhbaapi
brltty
dmraid-events-logwatch
libhbalinux
aide
kexec-tools
nfs4-acl-tools
tpm-tools
iscsi-initiator-utils
trousers
bridge-utils
authd
fipscheck
squashfs-tools
star
sssd
hardlink
freeipmi
x86info
device-mapper-multipath
hfsutils
fcoe-utils
edac-utils
hesinfo
fuse-libs
convmv
fuse
cpufreq-utils
openswan
freeipmi
gcc44-c
gcc44-gfortran
pexpect
dejagnu
imake
java-1.6.0-openjdk-devel
gcc-objc
ElectricFence
memtest86
gcc-gnat
libgfortran44
gcc44
expect
java-1.6.0-openjdk
unifdef
nasm

%post
# Disable unused service
chkconfig NetworkManager off
chkconfig acpid off
chkconfig anacron off
chkconfig atd off
chkconfig auditd off
chkconfig autofs off
chkconfig avahi-daemon off
chkconfig avahi-dnsconfd off
chkconfig bluetooth off
chkconfig capi off
chkconfig conman off
chkconfig cpuspeed off
chkconfig dnsmasq off
chkconfig dund off
chkconfig edac off
chkconfig fcoe off
chkconfig firstboot off
chkconfig gpm off
chkconfig haldaemon off
chkconfig hidd off
chkconfig ip6tables off
chkconfig ipsec off
chkconfig iptables off
chkconfig irda off
chkconfig iscsi off
chkconfig iscsid off
chkconfig isdn off
chkconfig kdump off
chkconfig kudzu off
chkconfig mcstrans off
chkconfig mdmonitor off
chkconfig mdmpd off
chkconfig messagebus off
chkconfig multipathd off
chkconfig netconsole off
chkconfig netfs off
chkconfig netplugd off
chkconfig nfs off
chkconfig nfslock off
chkconfig nscd off
chkconfig oddjobd off
chkconfig pand off
chkconfig pcscd off
chkconfig portmap off
chkconfig psacct off
chkconfig rawdevices off
chkconfig rdisc off
chkconfig readahead_early off
chkconfig readahead_later off
chkconfig restorecond off
chkconfig rpcgssd off
chkconfig rpcidmapd off
chkconfig rpcsvcgssd off
chkconfig saslauthd off
chkconfig sendmail off
chkconfig smartd off
chkconfig sssd off
chkconfig svnserve off
chkconfig tcsd off
chkconfig wpa_supplicant off
chkconfig xfs off
chkconfig xinetd off
chkconfig ypbind off
chkconfig yum-updatesd off

6、让ISO按照anaconda-ks.cfg文件来执行安装

 vi /root/iso/isolinux/isolinux.cfg

Default  linux   修改成default linux  ks=cdrom:/anaconda-ks.cfg

7、生成comps.xml文件

yum -y install createrepo mkisofs
cd /root/iso
createrepo -g repodata/*comps.xml /root/iso/

8、制作ISO

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/

然后下次需要重装系统的时候就直接使用这个ISO啦,方便快捷!有个缺点就是密码是按照anaconda-ks.cfg中设定的执行,再研究一下看看能不能设定密码跟用户交互的模式。

图片 3

本文由bifa688.com发布,转载请注明来源:5自行安装光盘,简单定制二个符合本身用的Cen