Kickstart 同时push多个linux操作系统

 在生产环境中,经常要安装不同版本的linux操作系统,以及各种安装需求;每次安装操作系统的时候如果用传统的光盘方式安装,费时又费力!下面介绍下如何在同一个时刻,使用kickstart push不同的版本的linux,主要有三个版本centos4.8,rhel5.4,rhel6.0和一个linux rescue环境!

一:配置dhcp服务,ks服务器地址为192.168.50.7/24

 
 
  1. [root@rhel5 ~]# rpm -qa |grep dhcp  
  2. dhcpv6-client-1.0.10-17.el5  
  3. dhcp-3.0.5-23.el5_5.2  
  4.  
  5. [root@rhel5 ~]# cat /etc/dhcpd.conf  
  6. option domain-name "766.com";  
  7. default-lease-time 6000;  
  8. max-lease-time 11400;  
  9. authourtative;  
  10. next-server 192.168.50.7;  
  11. ddns-update-style ad-hoc;  
  12. log-facility local7;  
  13. subnet 192.168.50.0 netmask 255.255.255.0{  
  14. range 192.168.50.150 192.168.50.195;  
  15. option domain-name-servers 192.168.50.254;  
  16. option domain-name "766.com";  
  17. option netbios-name-servers 192.168.50.254;  
  18. option routers 192.168.50.254;  
  19. option broadcast-address 192.168.50.255;  
  20. default-lease-time 6000;  
  21. max-lease-time 11400;  
  22. filename "/kickstart/ks.cfg";  
  23. }  
  24.  
  25. option space PXE;  
  26.  
  27. class "PXE" {  
  28.     match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";  
  29.     option vendor-encapsulated-options 01:04:00:00:00:00:ff;  
  30.     option boot-size 0x1;  
  31.     filename "pxelinux.0";  
  32.     option tftp-server-name "192.168.50.7";  
  33.     option vendor-class-identifier "PXEClient";  
  34.     vendor-option-space PXE;  

二:配置tftp-server,准备vmlinz和initrd.img文件

 
 
  1. [root@rhel5 ~]# rpm -qa |egrep 'tftp|xinetd'  
  2. tftp-0.49-2.el5.centos  
  3. tftp-server-0.49-2.el5.centos  
  4. xinetd-2.3.14-10.el5  
  5.  
  6. [root@rhel5 ~]# cat /etc/xinetd.d/tftp   
  7. # default: off  
  8. # description: The tftp server serves files using the trivial file transfer \  
  9. #       protocol.  The tftp protocol is often used to boot diskless \  
  10. #       workstations, download configuration files to network-aware printers, \  
  11. #       and to start the installation process for some operating systems.  
  12. service tftp  
  13. {  
  14.         socket_type             = dgram 
  15.         protocol                = udp 
  16.         wait                    = yes 
  17.         user                    = root 
  18.         server                  = /usr/sbin/in.tftpd  
  19.         server_args             = -s /tftpboot  
  20.         disable                 = no   
  21.         per_source              = 11 
  22.         cps                     = 100 2  
  23.         flags                   = IPv4 
  24. }  
  25.  
  26. 这些文件可以在对应的系统光盘或者ISO文件下的isolinux目录下找到  
  27. [root@rhel5 ~]# ls /tftpboot/rhel5.4_64/  
  28. initrd.img  vmlinuz  
  29. [root@rhel5 ~]# ls /tftpboot/rhel6_64/  
  30. initrd.img  vmlinuz  
  31. [root@rhel5 ~]# ls /tftpboot/centos4.8_64/  
  32. 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目录下的isolinux.cfg文件移到到该目录,重命名为default;KS文件可以在安装好的linux上使用system-config-kickstart命令生成

 
 
  1. [root@rhel5 ~]# ls /tftpboot/  
  2. boot.cat  centos4.8_64  isolinux.bin  memtest      param.msg   pxelinux.cfg  rhel5.4_64  splash.lss  
  3. boot.msg  general.msg   isolinux.cfg  options.msg  pxelinux.0  rescue.msg    rhel6_64    TRANS.TBL  
  4.  
  5. [root@rhel5 ~]# cat /tftpboot/pxelinux.cfg/default   
  6. default rhel5_rescue  
  7. prompt 1  
  8. timeout 600  
  9. display boot.msg  
  10. F1 boot.msg  
  11. F2 options.msg  
  12. F3 general.msg  
  13. F4 param.msg  
  14. F5 rescue.msg  
  15.  
  16. label rhel5_rescue  
  17.  kernel rhel5.4_64/vmlinuz   
  18.  append ksdevice=eth0 load_ramdisk=1 initrd=rhel5.4_64/initrd.img noipv6  
  19.  
  20.  
  21. label rhel5.4_64  
  22.   kernel rhel5.4_64/vmlinuz  
  23.   append ksdevice=eth0 load_ramdisk=1 initrd=rhel5.4_64/initrd.img ks=ftp://192.168.50.7/ks/ks5_64.cfg noipv6  
  24.  
  25. label rhel6_64  
  26.   kernel rhel6_64/vmlinuz  
  27.   append ksdevice=eth0 load_ramdisk=1 initrd=rhel6_64/initrd.img   ks=ftp://192.168.50.7/ks/ks6_64.cfg  noipv6  
  28.  
  29.  
  30. label centos4.8_64  
  31.   kernel centos4.8_64/vmlinuz  
  32.   append ksdevice=eth0 load_ramdisk=1 initrd=centos4.8_64/initrd.img   ks=ftp://192.168.50.7/ks/ks4.8_64.cfg  noipv6  
  33.  
  34. [root@rhel5 ~]# cat /tftpboot/boot.msg   
  35. #To decide  install  os type and enter command to continue  
  36.  
  37. linux resuce       --->     rhel5_rescue  rescue  
  38.  
  39. rhel5.4 64bit      --->     rhel5.4_64  
  40.  
  41. rhel6.0 64bit      --->     rhel6_64  
  42.  
  43. centos4.8 64bit    --->     centos4.8_64   

四:配置FTP和autofs,这里将利用ftp和autofs为安装提供光盘源镜像

 
 
  1. [root@rhel5 ~]# rpm -qa |egrep 'vsftpd|autofs'  
  2. vsftpd-2.0.5-16.el5_5.1  
  3. autofs-5.0.1-0.rc2.131.el5  
  4.  
  5. [root@rhel5 ~]# tail -1 /etc/auto.master   
  6. /var/ftp/pub /etc/auto.ftp  
  7. [root@rhel5 ~]# cat /etc/auto.ftp   
  8. iso5        -fstype=iso9660,ro,loop :/data/ISO/rhel-server-5.4-x86_64-dvd.iso  
  9. iso4.8      -fstype=iso9660,ro,loop :/data/ISO/CentOS-4.8-x86_64-binDVD.iso  
  10. iso6        -fstype=iso9660,ro,loop :/data/ISO/rhel6.iso 

五:启动服务和测试 

 
 
  1. [root@rhel5 ~]# service dhcpd restart  
  2. Shutting down dhcpd: [  OK  ]  
  3. Starting dhcpd: [  OK  ]  
  4.  
  5. [root@rhel5 ~]# service vsftpd restart  
  6. Shutting down vsftpd: [  OK  ]  
  7. Starting vsftpd for vsftpd: [  OK  ]  
  8.  
  9. [root@rhel5 ~]# service autofs restart  
  10. Stopping automount: [  OK  ]  
  11. Starting automount: [  OK  ]  
  12.  
  13. [root@rhel5 ~]# service xinetd restart  
  14. Stopping xinetd: [  OK  ]  
  15. Starting xinetd: [  OK  ]  
  16.  
  17. [root@rhel5 ~]# tail -f /var/log/messages  
  18. Jun 13 17:40:42 rhel5 dhcpd: DHCPDISCOVER from 00:0c:29:4c:0f:d5 via br0  
  19. Jun 13 17:40:43 rhel5 dhcpd: DHCPOFFER on 192.168.50.184 to 00:0c:29:4c:0f:d5 via br0  
  20. Jun 13 17:40:44 rhel5 dhcpd: DHCPREQUEST for 192.168.50.184 (192.168.50.7) from 00:0c:29:4c:0f:d5 via br0  
  21. Jun 13 17:40:44 rhel5 dhcpd: DHCPACK on 192.168.50.184 to 00:0c:29:4c:0f:d5 via br0  
  22. Jun 13 17:40:44 rhel5 xinetd[1794]: START: tftp pid=2829 from=192.168.50.184  
  23.  
  24. [root@rhel5 ~]# tail -f /var/log/xferlog  
  25. Mon Jun 13 08:46:25 2011 1 192.168.50.184 0 /pub/iso5/RELEASE-NOTES-en_US.UTF-8.html b _ o a anonymous@ ftp 0 * i  
  26. Mon Jun 13 08:46:25 2011 1 192.168.50.184 0 /pub/iso5/RELEASE-NOTES.en_US.UTF-8 b _ o a anonymous@ ftp 0 * i  
  27. Mon Jun 13 08:46:25 2011 1 192.168.50.184 0 /pub/iso5/RELEASE-NOTES-en_US.html b _ o a anonymous@ ftp 0 * i  
  28. Mon Jun 13 08:46:25 2011 1 192.168.50.184 0 /pub/iso5/RELEASE-NOTES.en_US b _ o a anonymous@ ftp 0 * i  
  29. Mon Jun 13 08:46:26 2011 1 192.168.50.184 80344 /pub/iso5/RELEASE-NOTES-en.html b _ o a anonymous@ ftp 0 * c  
  30. Mon Jun 13 08:49:48 2011 1 192.168.50.184 0 /pub/iso5/images/updates.img b _ o a rhinstall@ ftp 0 * i  
  31. Mon Jun 13 08:49:48 2011 1 192.168.50.184 0 /pub/iso5/disc1/images/updates.img b _ o a rhinstall@ ftp 0 * i  
  32. Mon Jun 13 08:49:48 2011 1 192.168.50.184 0 /pub/iso5/images/product.img b _ o a rhinstall@ ftp 0 * i  
  33. Mon Jun 13 08:49:48 2011 1 192.168.50.184 0 /pub/iso5/disc1/images/product.img b _ o a rhinstall@ ftp 0 * i  
  34. Mon Jun 13 08:49:56 2011 8 192.168.50.184 91160576 /pub/iso5/images/stage2.img b _ o a rhinstall@ ftp 0 * c 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值