制作iso光盘
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了制作iso光盘相关的知识,希望对你有一定的参考价值。
今天给大家带来的是如何制作一个完整的ISO,包括KS应达文件和rpm包。制作完成后拷贝到U盘里面,就可以直接在别的机器上安装centos系统。
一、cp光盘内容
cp -rv /misc/cd /app/centos6iso
二、删除TRANS.TBL
find /app/centos6iso/ -name TRANS.TBL -ok rm {} \;
现在还不需要TRANS.TBL文件,如果不删除,启动会失败
三、删除repodata
rm -rf /app/centos6iso/repodata
四、还原repodata
createrepo -g /misc/cd/repodata/43d8fd068164b0f042845474d6a22262798b9f0d1f49ad1bf9f95b953089777d-c6-x86_64-comps.xml /app/centos6iso/
repodata里面记录了yum源
五、创建KS应达文件
mkdir /app/centos6iso/ksdir
1、创建ks-mini.cfg文件
cp anaconda-ks.cfg ks-mini.cfg
vim ks-mini.cfg内容如下:
# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
url --url="http://172.17.0.1/centos/6"
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth1 --bootproto dhcp --noipv6
rootpw --iscrypted $6$tXmSEQTX.96Oxlwf$CS6RX80cUp/M/ME7NudrGH8uMtQA32fq9qWHGpda
VOyFExQGZtG3aBGcbHikxZ5Q69YR5pDJaF98C3MtCDU5b1
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet
"
# 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 --none
part /boot --fstype=ext4 --size=1024
part / --fstype=ext4 --size=51200
part swap —size=2048
repo --name="CentOS" --baseurl=cdrom:sr0 --cost=100
%packages
@core
@server-policy
@workstation-policy
autofs
%end
%post
rm -rf /etc/yum.repos.d/*
cat > /etc/yum.repos.d/base.repo <<EOF
[base]
name=base
baseurl=http://172.17.0.1/centos/6
gpgcheck=0
EOF
useradd wang
echo magedu |passwd --stdin wang
%end
2、创建ks-desktop.cfg文件
cp anaconda-ks.cfg ks-desktop.cfg
vim ks-desktop.cfg内容如下:
# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
url --url="http://172.17.0.1/centos/6"
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth1 --bootproto dhcp --noipv6
rootpw --iscrypted $6$tXmSEQTX.96Oxlwf$CS6RX80cUp/M/ME7NudrGH8uMtQA32fq9qWHGpda
VOyFExQGZtG3aBGcbHikxZ5Q69YR5pDJaF98C3MtCDU5b1
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet
"
# 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 --none
part /boot --fstype=ext4 --size=1024
part / --fstype=ext4 --size=51200
part /app --fstype=ext4 --size=51200
part swap —size=2048
repo --name="CentOS" --baseurl=cdrom:sr0 --cost=100
%packages
@core
@server-policy
@workstation-policy
autofs
@desktop
%end
%post
rm -rf /etc/yum.repos.d/*
cat > /etc/yum.repos.d/base.repo <<EOF
[base]
name=base
baseurl=http://172.17.0.1/centos/6
gpgcheck=0
EOF
useradd wang
echo magedu |passwd --stdin wang
%end
cp /root/ks-mini.cfg /app/centos6iso/ksdir
cp /root/ks-desktop /app/centos6iso/ksdir
七、制作菜单文件/app/centos6iso/isolinux/isolinux.cfg
default vesamenu.c32
#prompt 1
timeout 600
display boot.msg
menu background splash.jpg
menu title Welcome to CentOS Autoinstall!
label desktop
menu label Auto Install a ^desktop system
kernel vmlinuz
append initrd=initrd.img ks=cdrom:/ksdir/ks-desktop.cfg
label mini
menu label ^Auto Install a mini system
kernel vmlinuz
append initrd=initrd.img ks=cdrom:/ksdir/ks-mini.cfg
label manual
menu label ^Manual Install a system
kernel vmlinuz
append initrd=initrd.img
label local
menu default
menu label Boot from ^local drive
localboot 0xffff
八、制作光盘
mkisofs -R -J -T -v --no-emul-boot --boot-load-size 4 - -boot-info-table -V "Autoinstall centosboot" -b isolinux/isolinux.bin -c isolinux/boot.cat -o /root/centos6boot.iso /app/centos6iso
到此为止一个光盘就安装成功
以上是关于制作iso光盘的主要内容,如果未能解决你的问题,请参考以下文章