centos6.5 kickstart +pxe+apache+dhcp+tftp+xinetd
Kickstart-Server ip:192.168.137.188(后面的192.168.137.188就是指kickstart服务器地址,自己做实验需要改下ip地址)
关闭selinux
setenforce0
关闭防火墙
serviceiptables stop
安装dhcp
1.配置dhcp服务器
yuminstall dhcp
修改dhcpd.conf文件
vim/etc/dhcp/dhcpd.conf
ddns-update-styleinterim;
ignoreclient-updates;
allowbooting;
allowbootp;
subnet 192.168.137.0netmask 255.255.255.0 {
option routers 192.168.137.254;
option subnet-mask 255.255.255.0;
option time-offset-18000;
range dynamic-bootp 192.168.137.100192.168.137.220;
next-server 192.168.137.210;
filename "pxelinux.0";
#host ns {
#hardware ethernet00:0C:29:C8:12:84;
#fixed-address 192.168.137.12;}
} service dhcpd restart
重启dhcp服务器
2.修改xinetd配置文件
yum install httpd
yum install tftp-sever tftp*
yum install xinetd
yum install syslinux
开机自动启动服务
chkconfig httpd on
chkconfig xinetd on
chkconfig dhcpd on
修改xinetd配置文件
vim/etc/xinetd.d/tftp
disable = no 只需修改此项 disable值改为no
启动各服务
servicexinetd restart
servicehttpd restart
发布光盘镜像
mount/dev/cdrom /mnt
mkdir/var/www/html/iso
cp -r/mnt/* /var/www/html/iso/
cp/usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
cp/var/www/html/iso/images/pxeboot/vmlinuz /var/lib/tftpboot/
cp/var/www/html/iso/images/pxeboot/initrd.img /var/lib/tftpboot/
cp/var/www/html/iso/isolinux/boot.msg /var/lib/tftpboot/
cp/var/www/html/iso/isolinux/vesamenu.c32 /var/lib/tftpboot/
cp/var/www/html/iso/isolinux/splash.jpg /var/lib/tftpboot/
mkdir/var/lib/tftpboot/pxelinux.cfg
cp/var/www/html/iso/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
chmod+w /var/lib/tftpboot/pxelinux.cfg/default
vim/var/lib/tftpboot/pxelinux.cfg/default
修改 default 文件
defaultlinux
#prompt1
timeout60
displayboot.msg
menubackground splash.jpg
menutitle Welcome to CentOS 6.5!
menucolor border 0 #ffffffff #00000000
menucolor sel 7 #ffffffff #ff000000
menucolor title 0 #ffffffff #00000000
menucolor tabmsg 0 #ffffffff #00000000
menucolor unsel 0 #ffffffff #00000000
menucolor hotsel 0 #ff000000 #ffffffff
menucolor hotkey 7 #ffffffff #ff000000
menucolor scrollbar 0 #ffffffff #00000000
labellinux
menu label ^Install or upgrade an existingsystem
menu default
kernel vmlinuz
append initrd=initrd.imgks=http://192.168.137.188/test/ks.cfg
labelvesa
menu label Install system with ^basic videodriver
kernel vmlinuz
append initrd=initrd.img xdriver=vesanomodeset
labelrescue
menu label ^Rescue installed system
kernel vmlinuz
append initrd=initrd.img rescue
labellocal
menu label Boot from ^local drive
localboot 0xffff
labelmemtest86
menu label ^Memory test
kernel memtest
append -
其实只需修改append 这行指定ks文件路径。然后default 后面改成linux
mkdir/var/www/html/test
cp /root/anaconda-ks.cfg /var/www/html/test/ks.cfg
chmod 777 /var/www/html/test/ks.cfg
vim/var/www/html/test/ks.cfg
# Kickstartfile automatically generated by anaconda.
install
text
url --urlhttp://192.168.137.188/iso
lang en_US.UTF-8
keyboard us
network--onboot no --device eth0 --bootproto dhcp --noipv6
rootpwjf.com
firewall--disabled
authconfig--enableshadow --passalgo=sha512
selinux--disabled
timezoneAsia/Shanghai
bootloader--location=mbr --driveorder=sda --append="crashkernel=auto rhgbquiet"
clearpart--all --initlabel
zerombr yes
part /boot--fstype=ext4 --size=200
part /--fstype=ext4 --size=20000
part /data--fstype=ext4 --size=20000
part swap--size=2000
%packages
@core
@server-policy
@workstation-policy
%end
reboot
注意:url --url http://192.168.137.188/iso这里指向的是iso下面的文件,不可写成ks.cfg路径。(我就是这里错了)
不放心可以把服务重启一遍。
service xinetd restart
service httpd restart
service dhcpd restart
页:
[1]