kickstart安装教程
pxe概念介绍:
pxe
技术与rpl技术不同之处为rpl是静态路由,pxe是动态路由。rpl是根据网卡上的id号加上其他记录组成的一个frame(帧)向服务器发出请求。
而服务器中已有这个id数据,匹配成功则进行远程启动。pxe则是根据服务器端收到的工件站mac地址,使用dhcp服务为这个mac地址指定个ip地
址。每次启动可能同一台工作站有与上次启动有不同的ip,即动态分配地址。下以客户端引导过程说明pxe的原理。
(1)客户端开机后,pxe bootrom(自启动芯片)获得控制权之前执行自我测试,然后以广播形式发出一个请求find帧。
(2)如果服务器收到客户端所送出的要求,就会送回dhcp回应,包括用户端的ip地址、预设通信通道,以及开机映像文件;否则服务器会忽略这个要求。
(3)客户端收到服务器发回的响应后则会回应一个帧,以请求传送启动所需文件,并把自己的mac地址写到服务器端的netnames.db文件中。
(4)将有更多的消息在客户端与服务器之间应答,用于决定启动参数。bootrom由tftp通信协议从服务器下载开机映像文档。客户端使用tftp协议接收启动文件后,将控制权转交启动块以引导操作系统,完成远程启动。
kickstart概念介绍:
kickstart
是一种无人职守安装方式。kickstart的工作原理是通过记录典型的安装过程中所需人工干预填写的各种参数,并生成一个名为ks.cfg的文件;在其
后的安装过程中(不只局限于生成kickstart安装文件的机器)当出现要求填写参数的情况时,安装程序会首先去查找kickstart生成的文件,当
找到合适的参数时,就采用找到的参数,当没有找到合适的参数时,才需要安装者手工干预。这样,如果kickstart文件涵盖了安装过程中出现的所有需要
填写的参数时,安装者完全可以只告诉安装程序从何处取ks.cfg文件,然后去忙自己的事情。等安装完毕,安装程序会根据ks.cfg中设置的重启选项来
重启系统,并结束安装。
kickstart流程:
大体流程:dhcp(获取ip,寻找tftp)>tftp(交换获取开机启动文件 /tftpboot即此文件夹)>http(加载安装文件)>本地安装
详细流程图:

安装过程:
一、关闭了selinux iptables
vim /etc/sysconfig/selinux
更改成 selinux=disabled
service iptables stop
chkconfig iptables off
二、配置yum源以及用yum安装
yum install -y httpd ftpd tftp-server xinetd system-config-kickstart syslinux dhcpd
dhcp-comon dhcp-devel
service httpd start
mkdir /var/www/html/centos65
http://192.168.11.125/centos65
挂载linxu iso镜像
mount /dev/cdrom /mnt
cp -rf /mnt/* /var/www/html/centos65
三、配置tftp加载文件
tftp-server依赖于xinetd服务
开机启动修改:
vim /etc/xinetd.d/tftp
disable = no
#disable的直由yes变为no,开启tftp
service xinetd start
加载ftp文件,tftp目录/var/lib/tftpboot下 :
rpm -ql syslinux | grep pxelinux.0
进入光盘挂载目录,p_w_picpaths/pxeboot/initrd.img
p_w_picpaths/pxeboot/vmlinux
isolinux/isolinux.cfg
isolinux/boot.msg
cd /tftpboot/cp /usr/share/syslinux/pxelinux.0 /tftpboot
cp /var/www/html/p_w_picpaths/pxeboot/initrd.img /tftpboot
cp /var/www/html/p_w_picpaths/pxeboot/vmlinux /tftpboot
mkdir pxelinux.cfg tftp-server配置文件
cp /var/www/html/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
chmod u+w /var/lib/tftpboot/pxelinux.cfg/default
cp /var/www/html/isolinux/boot.msg /var/lib/tftpboot/
chmod u+w /var/lib/tftpboot/boot.msg
四、配置dhcp文件
vim /etc/dhcpd.conf
# # dhcp server configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
ddns-update-style interim;
ignore client-updates;
subnet 192.168.10.0 netmask 255.255.255.0 {
option routers 192.168.10.1;
option subnet-mask 255.255.255.0;
range 192.168.10.100 192.168.10.200;
next-server 192.168.10.85;
filename "pxelinux.0";
allow booting;
allow bootp;
}
五、配置kicksyack自动安装配置文件
图形界面配置:
#system-config-kickstart
shell配置:参考代码区进行修改。
六、后续工作重启服务以及开机启动
service httpd restart
service xinetd restart
service dhcpd restart
chkconfig httpd on
chkconfig xinetd on
chkconfig dhcpd on
代码:
[root@wh-kickstart-100-60 ~]# vim /tftpboot/pxelinux.cfg/default
default linux
prompt 0
timeout 10
display boot.msg
f1 boot.msg
f2 options.msg
f3 general.msg
f4 param.msg
f5 rescue.msg
label linux
kernel vmlinuz
append initrd=initrd.img ks=http://192.168.100.60/ks.cfg
label text
append initrd=initrd.img text
label ks
append ks initrd=initrd.img
label local
localboot 1
label memtest86
kernel memtest
append -
[root@wh-kickstart-100-60 ~]# vim /etc/dhcpd.conf
#
# dhcp server configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
subnet 192.168.100.0 netmask 255.255.255.0 {
option routers 192.168.100.1;
range 192.168.100.100 192.168.100.200;
next-server 192.168.100.60;
[root@wh-kickstart-100-60 ~]# vim /var/www/html/ks.cfg
#platform=x86, amd64, or intel em64t
# system authorization information
auth --useshadow --enablemd5
# system bootloader configuration
bootloader --location=mbr
# partition clearing information
clearpart --none
# use graphical install
graphical
# firewall configuration
firewall --enabled
# run the setup agent on first boot
firstboot --disable
# system keyboard
keyboard us
# system language
lang en_us
# installation logging level
logging --level=info
# use network installation
url --url=http://192.168.100.60/
# network information
network --bootproto=dhcp --device=eth0 --onboot=on
#root password
rootpw --iscrypted $1$vrakvwxt$xevnz205xckgz8pnf43bv1
# selinux configuration
selinux --disabled
# system timezone
timezone asia/shanghai
# install os instead of upgrade
install
# x window system configuration information
xconfig --defaultdesktop=gnome --depth=8 --resolution=640x480
# disk partitioning information
part / --bytes-per-inode=4096 --fstype="ext3" --size=4096
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
part swap --bytes-per-inode=4096 --fstype="swap" --size=1024
part /home --bytes-per-inode=4096 --fstype="ext3" --grow --size=1
%packages
@gnome-desktop
faq:
问1:第一段提示硬盘空间不够。
答1:升级空间即可。
问2:提示虚拟磁盘空间无法读取。
答2:需要点击确定就ok,物理硬盘不存在此问题。
dhcp介绍:
ddns-update-style interim:这个是动态获取ip地址啦。必须放在第一项哇。
ignore client-updates:服务端与客户端传输相关
subnet:获取ip段,要配置正确。
routers:是路由地址
range:dhcp分配ip段。
next-server:是tftp地址。
allow booting bootp:放行传输和协议。
tftp介绍:
default:用在于tftp建立传输入协议后会去tftpboot里找文件,啥都找不着之后就会找default。
tftp-server :这个是用来传送引导文件的,
initrd.img/vmlinux: 看用来安装前的一些工作。但tftp是用来传输这些文件的协议。
网络结构:
如图为网络安装环境的一个原理示意,安装环境由一个局域网和连接到该局域网的启动服务器、安装服务器和待安装客户端,其中启动服务器和安装服务器可以部署在同一台物理机上。
服务相关作用:
dhcpd: 分发ip地址。
tftpd: 分发启动文件安装。
httpd:分发系统文件安装。
参考地址:
http://os.51cto.com/art/201009/223294.htm
http://blog.sina.com.cn/s/blog_94717ebc01010wio.html
转载地址:http://cwtea.blog.51cto.com/4500217/834991/