CentOS下kickstart安装笔记
CentOS 5.2,因为是测试机,没删减内容,标准安装。
关闭iptables和selinux,安装系统时已经配置好
1. 如果没有关闭,关闭的方法是:
/etc/init.d/iptables stop
Chkconfig iptables off
Vi /etc/selinux/config,修改
SELINUX=disabled
2. 安装NFS, sftp, dhcp服务器
yum –y install nfs-utils nfs-utils-lib nfs-utils-lib-devel dhcp
3. 安装kickstart
Yum –y system-config-kickstart
4.配置dhcp服务器
vi /etc/dhcpd.conf
ddns-update-style interim ;
ignore client-updates ;
allow booting ;
allow bootp ;
# A slightly different configuration for an internal subnet.
subnet 192.168.254.0 netmask 255.255.255.0 {
range 192.168.254.31 192.168.254.50 ;
option domain-name-servers 192.168.254.2;
#option domain-name "internal.example.org";
option routers 192.168.254.2 ;
option subnet-mask 255.255.255.0 ;
option broadcast-address 192.168.254.255 ;
filename "pxelinux.0" ;
default-lease-time 172800 ;
max-lease-time 1209000 ;
}
备注:服务器配置ipaddr:192.168.254.21/24
/etc/init.d/dhcpd start
Chkconfig dhcpd on
5. sftp服务器配置
vi /etc/xinetd.d/tftp
service tftp
{
socket_type= dgram
protocol= udp
wait= yes
user= root
server= /usr/sbin/in.tftpd
server_args= -s /tftpboot
disable= no
per_source= 11
cps= 100 2
flags= IPv4
/etc/init.d/xinetd start
Chkconfig xinetd on
6. nfs服务器的配置
Vi /etc/exports
/share/admins 192.168.254.111/24(async,rw,no_subtree_check)
Mkdir –p /share/admins
/etc/init.d/nfs start
Chkconfid nfs on
7. PXE设置
7.1 拷贝安装光盘到nfs目录
Mount –o loop /dev/dvd /mnt/
Mkdir –p /share/admins/centos52
Cp –Rf /mnt/* /share/admins/centos52
7.2 创建pxe启动选项
Yum –y install syslinux
Mkdir –p /tftpboot/centos52
Mkdir –p /tftpboot/pxelinux.cfg
Cd /tftpboot
;/ 复制以下文件及文件夹
Cp /usr/share/syslinux/mboot.c32 .
Cp /usr/share/syslinux/chain.c32 .
Cp /usr/share/syslinux/menu.c32 .
Cp /usr/share/syslinux/pxelinux.0 .
Cp /usr/share/syslinux/memdis .
Cp –R /mnt/isolinux cenos52/.
;/ pxe菜单编辑
vi pxeconfig.cfg/default
Default centos52
prompt 0
timeout 100
ONTIMEOUT local
#MENU TITLE Main Menu
#MENU INCLUDE pxelinux.cfg/graphics.conf
#MENU AUTOBOOT Starting Local System in 300 seconds
LABEL centos52
MENU LABEL ^Start install CentOS5.2
KERNEL menu.c32
APPEND pxelinux.cfg/centos52
Vi centos52
default default
prompt 1
label centos52
MENU LABEL ^Startdard mode install CentOS5.2
kernel /centos52/isolinux/vmlinuz
append initrd=/centos52/isolinux/initrd.img ramdisk_size=8192 ks=nfs:192.168.254.21:/share/admins/centos52/ks.cfg
label default
MENU LABEL ^Return to Main Menu
APPEND pxelinux.cfg/default
8. kickstat 配置
可以在图形终端下运行system-config-kickstart,如图:生成ks.cfg文件
<a href="http://blog.51cto.com/attachment/201311/103541449.png" target="_blank"></a>
拷贝ks.cfg到nfs目录(centos52菜单对应的路径)
开台机器测试!
配置完成,贴个ks.cfg配置菜单
#platform=x86, AMD64, 或Intel EM64T
# System authorization information
auth--useshadow--enablemd5
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --linux --initlabel
#skip key enter
key --skip
# Use graphical install
graphical
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang zh_CN
# Installation logging level
logging --level=info
# Use NFS installation media
nfs --server=192.168.254.21 --dir=/share/admins/centos52
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $1$PYNuUfV6$WdL1kAbFQQYNnliJgczz3.
# SELinux configuration
selinux --disabled
# System timezone
timezone --isUtc Asia/Chongqing
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig--defaultdesktop=GNOME --depth=24 --resolution=640x480
# Disk partitioning information
part /boot --bytes-per-inode=4096 --fstype="ext2" --size=100
part swap --bytes-per-inode=4096 --fstype="swap" --size=1024
part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=15000
%packages
@base-x
@gnome-desktop
@office
@editors
@text-internet
@dialup
@core
@base
@games
@chinese-support
@graphics
@printing
@sound-and-video
@graphical-internet
Deployment_Guide-en-US
device-mapper-multipath
xorg-x11-server-Xnest
libsane-hpaio
-sysreport
part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=1
本文转自 chengchow 51CTO博客,原文链接:http://blog.51cto.com/chengchow/1329910,如需转载请自行联系原作者