在生产环境中,经常要安装不同版本的linux操作系统,以及各种安装需求;每次安装操作系统的时候如果用传统的光盘方式安装,费时又费力!下面介绍下如何在同一个时刻,使用kickstart push不同的版本的linux,主要有三个版本centos4.8,rhel5.4,rhel6.0和一个linux rescue环境!
一:配置dhcp服务,ks服务器地址为192.168.50.7/24
- [root@rhel5 ~]# rpm -qa |grep dhcp
- dhcpv6-client-1.0.10-17.el5
- dhcp-3.0.5-23.el5_5.2
-
- [root@rhel5 ~]# cat /etc/dhcpd.conf
- option domain-name "766.com";
- default-lease-time 6000;
- max-lease-time 11400;
- authourtative;
- next-server 192.168.50.7;
- ddns-update-style ad-hoc;
- log-facility local7;
- subnet 192.168.50.0 netmask 255.255.255.0{
- range 192.168.50.150 192.168.50.195;
- option domain-name-servers 192.168.50.254;
- option domain-name "766.com";
- option netbios-name-servers 192.168.50.254;
- option routers 192.168.50.254;
- option broadcast-address 192.168.50.255;
- default-lease-time 6000;
- max-lease-time 11400;
- filename "/kickstart/ks.cfg";
- }
-
- option space PXE;
-
- class "PXE" {
- match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
- option vendor-encapsulated-options 01:04:00:00:00:00:ff;
- option boot-size 0x1;
- filename "pxelinux.0";
- option tftp-server-name "192.168.50.7";
- option vendor-class-identifier "PXEClient";
- vendor-option-space PXE;
- }
二:配置tftp-server,准备vmlinz和initrd.img文件
- [root@rhel5 ~]# rpm -qa |egrep ''tftp|xinetd''
- tftp-0.49-2.el5.centos
- tftp-server-0.49-2.el5.centos
- xinetd-2.3.14-10.el5
-
- [root@rhel5 ~]# cat /etc/xinetd.d/tftp
- # default: off
- # description: The tftp server serves files using the trivial file transfer
- # protocol. The tftp protocol is often used to boot diskless
- # workstations, download configuration files to network-aware printers,
- # and to start the installation process for some operating systems.
- 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
- }
-
- 这些文件可以在对应的系统光盘或者ISO文件下的isolinux目录下找到
- [root@rhel5 ~]# ls /tftpboot/rhel5.4_64/
- initrd.img vmlinuz
- [root@rhel5 ~]# ls /tftpboot/rhel6_64/
- initrd.img vmlinuz
- [root@rhel5 ~]# ls /tftpboot/centos4.8_64/
- initrd.img vmlinuz
三:配置相关文件
复制pxelinux.0文件至/tftpboot目录下,该文件由syslinux软件包提供,用来pxe启动linux使用
[root@rhel5 ~]# rpm -qf /usr/lib/syslinux/pxelinux.0
syslinux-3.11-4
复制rhel5光盘下的isolinux目录下的文件至/tftpboot目录下,其中vmlinuz和initrd.img文件可以不用复制,在/tftpboot目录下创建一个名为pxelinux.cfg的目录,并将/tftpboot目录下的pxelinux.cfg文件移到到该目录,重命名为default |