linux Centos光盘定制
时间:2016-05-30 17:37 来源:linux.it.net.cn 作者:IT
公司来了一批同配置的机器,需要安装的东西都是一样的,R710用U盘安装没有问题,R720就开始各种问题,所以采取了光盘安装,一步一步又太麻烦 。。就自己定制下。。
[root@localhost ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-*
[root@localhost ~]# yum -y install anaconda anaconda-runtime
[root@localhost ~]# yum -y install createrepo
[root@localhost ~]# mkdir /Centos6/
[root@localhost ~]# mkdir /RPM
[root@localhost ~]# mount -o loop CentOS-6.3-x86_64-bin-DVD1.iso /mnt/
[root@localhost mnt]# tar -cf - .|(cd /Centos6; tar -xvpf -)
[root@localhost mnt]# cat install.log | grep Installing | sed 's/Installing //g' > packages.list
[root@aca700fc ~]# vi cprpm.sh
#!/bin/bash
DEBUG=0
DVD_CD=/mnt
ALL_RPMS_DIR=/mnt/Packages
DVD_RPMS_DIR=/RPM
packages_list=/root/packages.list
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* $DVD_RPMS_DIR/"
cp $ALL_RPMS_DIR/$name-$version* $DVD_RPMS_DIR/
# in case the copy failed
if [ $? -ne 0 ] ; then
echo "cp $ALL_RPMS_DIR/$name-$version* "
cp $ALL_RPMS_DIR/$name* $DVD_RPMS_DIR/
fi
fi
i=`expr $i + 1`
done
[root@localhost mnt]# sh cprpm.sh
[root@aca700fc ~]# rm -rf /Centos6/Packages/
[root@localhost mnt]# cp -a RPM/* Centos6/Packages/
[root@localhost mnt]# cd Centos6/
[root@localhost Centos6]# createrepo -g repodata/repomd.xml .
[root@aca700fc isolinux]# vi isolinux.cfg
default vesamenu.c32
#prompt 1
timeout 600
display boot.msg
menu background splash.jpg
menu title Welcome to CentOS 6.3!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append ks=cdrom:/isolinux/ks1.cfg initrd=initrd.img
label vesa
menu label Install system with ^basic video driver
kernel vmlinuz
append initrd=initrd.img xdriver=vesa nomodeset
label rescue
menu label ^Rescue installed system
kernel vmlinuz
append initrd=initrd.img rescue
label local
menu label Boot from ^local drive
localboot 0xffff
label memtest86
menu label ^Memory test
kernel memtest
append -
[root@aca700fc isolinux]# vi ks1.cfg
# Kickstart file automatically generated by anaconda.
#version=RHEL6
install
cdrom
lang en_US.UTF-8
keyboard us
text
rootpw tarena
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512 --enablefingerprint
selinux --enforcing
timezone --utc Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="nomodeset 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 --linux
part swap --size=1000
part / --fstype=ext4 --size=1 --grow
%packages
@base
@development
@emacs
@compat-libraries
@hardware-monitoring
@large-systems
@network-tools
@performance
@perl-runtime
@system-management-snmp
@system-management
@system-admin-tools
%end
[root@localhost Centos6]# mkisofs -R -J -T -r -l -d -allow-multidot -allow-leading-dots -no-bak -o ../home/CentOS.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .
(责任编辑:IT)
公司来了一批同配置的机器,需要安装的东西都是一样的,R710用U盘安装没有问题,R720就开始各种问题,所以采取了光盘安装,一步一步又太麻烦 。。就自己定制下。。 [root@localhost ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-* [root@localhost ~]# yum -y install anaconda anaconda-runtime [root@localhost ~]# yum -y install createrepo [root@localhost ~]# mkdir /Centos6/ [root@localhost ~]# mkdir /RPM [root@localhost ~]# mount -o loop CentOS-6.3-x86_64-bin-DVD1.iso /mnt/ [root@localhost mnt]# tar -cf - .|(cd /Centos6; tar -xvpf -) [root@localhost mnt]# cat install.log | grep Installing | sed 's/Installing //g' > packages.list [root@aca700fc ~]# vi cprpm.sh #!/bin/bash DEBUG=0 DVD_CD=/mnt ALL_RPMS_DIR=/mnt/Packages DVD_RPMS_DIR=/RPM packages_list=/root/packages.list 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* $DVD_RPMS_DIR/" cp $ALL_RPMS_DIR/$name-$version* $DVD_RPMS_DIR/ # in case the copy failed if [ $? -ne 0 ] ; then echo "cp $ALL_RPMS_DIR/$name-$version* " cp $ALL_RPMS_DIR/$name* $DVD_RPMS_DIR/ fi fi i=`expr $i + 1` done [root@localhost mnt]# sh cprpm.sh [root@aca700fc ~]# rm -rf /Centos6/Packages/ [root@localhost mnt]# cp -a RPM/* Centos6/Packages/ [root@localhost mnt]# cd Centos6/ [root@localhost Centos6]# createrepo -g repodata/repomd.xml . [root@aca700fc isolinux]# vi isolinux.cfg default vesamenu.c32 #prompt 1 timeout 600 display boot.msg menu background splash.jpg menu title Welcome to CentOS 6.3! menu color border 0 #ffffffff #00000000 menu color sel 7 #ffffffff #ff000000 menu color title 0 #ffffffff #00000000 menu color tabmsg 0 #ffffffff #00000000 menu color unsel 0 #ffffffff #00000000 menu color hotsel 0 #ff000000 #ffffffff menu color hotkey 7 #ffffffff #ff000000 menu color scrollbar 0 #ffffffff #00000000 label linux menu label ^Install or upgrade an existing system menu default kernel vmlinuz append ks=cdrom:/isolinux/ks1.cfg initrd=initrd.img label vesa menu label Install system with ^basic video driver kernel vmlinuz append initrd=initrd.img xdriver=vesa nomodeset label rescue menu label ^Rescue installed system kernel vmlinuz append initrd=initrd.img rescue label local menu label Boot from ^local drive localboot 0xffff label memtest86 menu label ^Memory test kernel memtest append - [root@aca700fc isolinux]# vi ks1.cfg # Kickstart file automatically generated by anaconda. #version=RHEL6 install cdrom lang en_US.UTF-8 keyboard us text rootpw tarena firewall --service=ssh authconfig --enableshadow --passalgo=sha512 --enablefingerprint selinux --enforcing timezone --utc Asia/Shanghai bootloader --location=mbr --driveorder=sda --append="nomodeset 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 --linux part swap --size=1000 part / --fstype=ext4 --size=1 --grow %packages @base @development @emacs @compat-libraries @hardware-monitoring @large-systems @network-tools @performance @perl-runtime @system-management-snmp @system-management @system-admin-tools %end [root@localhost Centos6]# mkisofs -R -J -T -r -l -d -allow-multidot -allow-leading-dots -no-bak -o ../home/CentOS.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table . (责任编辑:IT) |