6、制作kf.cfg文件 用于自动化安装
下面是我自己制作的ks.cfg,可根据自己的需求做改动 root密码是CentOS6,这个文件存放的位置需要在系统安装的时候被获取到,我这里存放在我物理机上的FTP下
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="ftp://lookback:lookback@192.168.1.20/centos/6/x86_64/base"
repo --name="CentOS" --baseurl=ftp://lookback:lookback@192.168.1.20/centos/6/x86_64/base
#repo --name="Fedora EPEL" --baseurl=ftp://lookback:lookback@192.168.1.20/fedora-epel/6/x86_64/ --cost=1000
# Root password
rootpw --iscrypted $6$W6.dzk.2$fqenuNv62I4SF64gAie0OTQK5WdjUOxGbDPkIq/z/xlG42oUh7khkVhfWYDI8U0FmsIofmQtGSq9ruWuoHvy30
#root密码为centos6
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --append="crashkernel=auto crashkernel=auto rhgb rhgb quiet quiet" --location=mbr --driveorder="sda"
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="ext4" --size=200
part pv.001 --size=61440
volgroup vg0 --pesize=8192 pv.001
logvol / --fstype=ext4 --vgname=vg0 --size=20480 --name=root
logvol /var --fstype=ext4 --vgname=vg0 --size=20480 --name=var
logvol swap --name=swap --vgname=vg0 --size=2048
logvol /usr --fstype=ext4 --vgname=vg0 --size=10240 --name=usr
%post
echo -e 'TEST Centos6\nhttp://www.000.org\n' >> /etc/issue
sed -i '1,$s@id:[0-9]:initdefault:@id:3:initdefault:@g' /etc/inittab
[ ! -d /root/.ssh ] && mkdir /root/.ssh && chmod og=--- /root/.ssh
#下面是我自己为了方便自己使用对自动安装的系统做了免密码登录
cat >> /root/.ssh/authorized_keys << EOF
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDfhGitgDKxQidZXLHS3DFalTvmzTwQ4UH3etQJUE7/iPNwLs6ZDzbR5pqTPfK1YdhUTuJOoNQZ71Fr9qwLtF6aLdgO+ybmK/8sNrMeTvGmKyr4YQ5k02vVIbBnQIEr08eXpV1y206CMWQ7FiiMlFvaeFZhj8trchiffhAUJdZOjl/BikzDJcYdp/sRXrFA4G21yXU0ffOn9aAAvqOqRBRoDhpLnSWaovGjd419Cy/pdhu4Vuispz1x834l975fLv4PIh+3nW9WMbhrmIXzWoTsxnc8OUbT4FnRdA33G8T3JXQc1n1UjX7H4BGfzKA6eax574rspAk51cslaydby2vX== root@lookback.dwhd.org
EOF
# Enable funcd
sed -i 's@certmaster =.*@certmaster = 172.16.0.1@g' /etc/certmaster/minion.conf
/sbin/chkconfig funcd off
# Set the hostname
ClientName=`ifconfig eth0 | awk '/inet addr:/{print $2}' | awk -F. '{print $NF}'`
sed -i "s@HOSTNAME=.*@HOSTNAME=client$ClientName.dwhd.org@g" /etc/sysconfig/networks
# set puppet agent
sed -i '/\[main\]/a server=server.dwhd.org' /etc/puppet/puppet.conf
/sbin/chkconfig puppet off
# set hosts
echo '172.16.0.1 server.dwhd.org server' >> /etc/hosts
# yum repo
%end
%packages
@base
@basic-desktop
@chinese-support
@client-mgmt-tools
@core
@desktop-platform
@development
@fonts
@general-desktop
@graphical-admin-tools
@legacy-x
@network-file-system-client
@perl-runtime
@remote-desktop-clients
@server-platform-devel
@x11
%end
现在来修改下PXE启动后引导菜单
vi /var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32
#prompt 1
timeout 60
display boot.msg
menu background splash.jpg
menu title Welcome to CentOS 6.5! This is test PXE Auto Install
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 pxelinux
menu label ^Auto Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd=initrd.img ks=ftp://lookback:lookback@192.168.1.20/centos/6/ks.cfg
label linux
menu label ^Install or upgrade an existing system
kernel vmlinuz
append 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 -






更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14
本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-07/104881.htm
