快速业务通道

简单定制一个适合自己用的CentOS系统

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-03-24

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

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

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

1、挂载光驱

mount /dev/cdrom /mnt

2、创建临时目录

mkdir -p /root/iso/CentOS

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

Empire CMS,phome.net

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

Empire CMS,phome.net
%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

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号