歡迎您光臨本站 註冊首頁

Kickstart 同時push多個linux操作系統

←手機掃碼閱讀     火星人 @ 2014-03-09 , reply:0

在生產環境中,經常要安裝不同版本的linux操作系統,以及各種安裝需求;每次安裝操作系統的時候如果用傳統的光碟方式安裝,費時又費力!下面介紹下如何在同一個時刻,使用kickstart push不同的版本的linux,主要有三個版本centos4.8,rhel5.4,rhel6.0和一個linux rescue環境!

一:配置dhcp服務,ks伺服器地址為192.168.50.7/24

  1. [[email protected] ~]# rpm -qa |grep dhcp
  2. dhcpv6-client-1.0.10-17.el5
  3. dhcp-3.0.5-23.el5_5.2
  4. [[email protected] ~]# cat /etc/dhcpd.conf
  5. option domain-name "766.com";
  6. default-lease-time 6000;
  7. max-lease-time 11400;
  8. authourtative;
  9. next-server 192.168.50.7;
  10. ddns-update-style ad-hoc;
  11. log-facility local7;
  12. subnet 192.168.50.0 netmask 255.255.255.0{
  13. range 192.168.50.150 192.168.50.195;
  14. option domain-name-servers 192.168.50.254;
  15. option domain-name "766.com";
  16. option netbios-name-servers 192.168.50.254;
  17. option routers 192.168.50.254;
  18. option broadcast-address 192.168.50.255;
  19. default-lease-time 6000;
  20. max-lease-time 11400;
  21. filename "/kickstart/ks.cfg";
  22. }
  23. option space PXE;
  24. class "PXE" {

  25. match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
  26. option vendor-encapsulated-options 01:04:00:00:00:00:ff;
  27. option boot-size 0x1;
  28. filename "pxelinux.0";
  29. option tftp-server-name "192.168.50.7";
  30. option vendor-class-identifier "PXEClient";
  31. vendor-option-space PXE;
  32. }

二:配置tftp-server,準備vmlinz和initrd.img文件

  1. [[email protected] ~]# 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. [[email protected] ~]# cat /etc/xinetd.d/tftp
  6. # default: off
  7. # description: The tftp server serves files using the trivial file transfer
  8. # protocol. The tftp protocol is often used to boot diskless
  9. # workstations, download configuration files to network-aware printers,
  10. # and to start the installation process for some operating systems.
  11. service tftp
  12. {
  13. socket_type = dgram
  14. protocol = udp
  15. wait =

    yes
  16. user = root
  17. server = /usr/sbin/in.tftpd
  18. server_args = -s /tftpboot
  19. disable = no
  20. per_source = 11
  21. cps = 100 2
  22. flags = IPv4
  23. }
  24. 這些文件可以在對應的系統光碟或者ISO文件下的isolinux目錄下找到
  25. [[email protected] ~]# ls /tftpboot/rhel5.4_64/
  26. initrd.img vmlinuz
  27. [[email protected] ~]# ls /tftpboot/rhel6_64/
  28. initrd.img vmlinuz
  29. [[email protected] ~]# ls /tftpboot/centos4.8_64/
  30. initrd.img vmlinuz

三:配置相關文件
複製pxelinux.0文件至/tftpboot目錄下,該文件由syslinux軟體包提供,用來pxe啟動linux使用
[[email protected] ~]# rpm -qf /usr/lib/syslinux/pxelinux.0
syslinux-3.11-4

複製rhel5光碟下的isolinux目錄下的文件至/tftpboot目錄下,其中vmlinuz和initrd.img文件可以不用複製,在/tftpboot目錄下創建一個名為pxelinux.cfg的目錄,並將/tftpboot目錄下的pxelinux.cfg文件移到到該目錄,重命名為default;KS文件可以在安裝好的linux上使用system-config-kickstart命令生成

  1. [[email protected] ~]# 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. [[email protected] ~]# cat /tftpboot/pxelinux.cfg/default
  5. default rhel5_rescue
  6. prompt 1
  7. timeout 600
  8. display boot.msg
  9. F1 boot.msg
  10. F2 options.msg
  11. F3 general.msg
  12. F4 param.msg
  13. F5 rescue.msg
  14. label rhel5_rescue
  15. kernel rhel5.4_64/vmlinuz
  16. append ksdevice=eth0 load_ramdisk=1 initrd=rhel5.4_64/initrd.img noipv6
  17. label rhel5.4_64
  18. kernel rhel5.4_64/vmlinuz
  19. append ksdevice=eth0 load_ramdisk=1 initrd=rhel5.4_64/initrd.img ks

    =ftp://192.168.50.7/ks/ks5_64.cfg noipv6
  20. label rhel6_64
  21. kernel rhel6_64/vmlinuz
  22. append ksdevice=eth0 load_ramdisk=1 initrd=rhel6_64/initrd.img ks=ftp://192.168.50.7/ks/ks6_64.cfg noipv6
  23. label centos4.8_64
  24. kernel centos4.8_64/vmlinuz
  25. append ksdevice=eth0 load_ramdisk=1 initrd=centos4.8_64/initrd.img ks=ftp://192.168.50.7/ks/ks4.8_64.cfg noipv6
  26. [[email protected] ~]# cat /tftpboot/boot.msg
  27. #To decide install os type and enter command to continue
  28. linux resuce ---> rhel5_rescue rescue
  29. rhel5.4 64bit ---> rhel5.4_64
  30. rhel6.0 64bit ---> rhel6_64
  31. centos4.8 64bit ---> centos4.8_64

四:配置FTP和autofs,這裡將利用ftp和autofs為安裝提供光碟源鏡像

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

五:啟動服務和測試

  1. [[email protected] ~]# service dhcpd restart
  2. Shutting down dhcpd: [ OK ]
  3. Starting dhcpd: [ OK ]
  4. [[email protected] ~]# service vsftpd restart
  5. Shutting down vsftpd: [ OK ]
  6. Starting vsftpd for vsftpd: [ OK ]
  7. [[email protected] ~]# service autofs restart

  8. Stopping automount: [ OK ]
  9. Starting automount: [ OK ]
  10. [[email protected] ~]# service xinetd restart
  11. Stopping xinetd: [ OK ]
  12. Starting xinetd: [ OK ]
  13. [[email protected] ~]# tail -f /var/log/messages
  14. Jun 13 17:40:42 rhel5 dhcpd: DHCPDISCOVER from 00:0c:29:4c:0f:d5 via br0
  15. Jun 13 17:40:43 rhel5 dhcpd: DHCPOFFER on 192.168.50.184 to 00:0c:29:4c:0f:d5 via br0
  16. 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
  17. Jun 13 17:40:44 rhel5 dhcpd: DHCPACK on 192.168.50.184 to 00:0c:29:4c:0f:d5 via br0
  18. Jun 13 17:40:44 rhel5 xinetd[1794]: START: tftp pid=2829 from=192.168.50.184
  19. [[email protected] ~]# tail -f /var/log/xferlog
  20. 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 [email protected] ftp 0 * i
  21. Mon Jun 13 08:46:25 2011 1 192.168.50.184 0 /pub/iso5/RELEASE-NOTES.en_US.UTF-8 b _ o a [email protected] ftp 0 * i
  22. Mon Jun 13 08:46:25 2011 1 192.168.50.184 0 /pub/iso5/RELEASE-NOTES-en_US.html b _ o a [email protected] ftp 0 * i
  23. Mon Jun 13 08:46:25 2011 1 192.168.50.184 0 /pub/iso5/RELEASE-NOTES.en_US b _ o a [email protected] ftp 0 * i
  24. Mon Jun 13 08:46:26 2011 1 192.168.50.184 80344 /pub/iso5/RELEASE-NOTES-en.html b _ o a [email protected] ftp 0 * c
  25. Mon Jun 13 08:49:48 2011 1 192.168.50.184 0 /pub/iso5/images/updates.img b _ o a [email protected] ftp 0 * i
  26. Mon Jun 13 08:49:48 2011 1 192.168.50.184 0 /pub/iso5/disc1/images/updates.img b _ o a [email protected] ftp 0 * i
  27. Mon Jun 13 08:49:48 2011 1 192.168.50.184 0 /pub/iso5/images/product.img b _ o a [email protected] ftp 0 * i
  28. Mon Jun 13 08:49:48 2011 1 192.168.50.184 0 /pub/iso5/disc1/images/product.img b _ o a [email protected] ftp 0 * i
  29. Mon Jun 13 08:49:56 2011 8 192.168.50.184 91160576 /pub/iso5/images/stage2.img b _ o a [email protected] ftp 0 * c

本文出自 「月牙天沖」 博客,謝絕轉載!


[火星人 ] Kickstart 同時push多個linux操作系統已經有745次圍觀

http://coctec.com/docs/linux/show-post-48329.html