RHCE之PXE+DHCP+TFTP+FTP/HTTP+KICKSTART用於PXE安裝RHEL7

來源:互聯網
上載者:User

標籤:rhce   rhel   pxe   dhcp   tftp   

最近在學習RHCE課程,上一篇簡單的講一下如何用FTP+HTTP+KickStart來作為KVM的VM網路安裝過程,請閱讀:http://gshao.blog.51cto.com/3512873/1882392

今天講到PXE安裝RHEL7

環境:

虛擬宿主機:RHEL 7.0

硬體:4vCPU+8G+40Gdisk

IP地址:172.16.38.10

 

1.製作本地源

[[email protected] ~]# mkdir /mnt/dvd   #建立/mnt/dvd目錄,用於掛載cdrom[[email protected] ~]# mount /dev/sr0 /mnt/dvd  #掛載光碟片

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8B/B5/wKiom1hV_bKCHfLTAAAvreWKH7o596.png" height="124" />

[[email protected] ~]# vim /etc/yum.repos.d/rhel.repo   #建立本地源設定檔[[email protected] ~]# cat /etc/yum.repos.d/rhel.repo   #顯示本地源設定檔  [rhel7]    name=rhel7    baseurl=file:///mnt/dvd    enabled=1    gpgcheck=0

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8B/B1/wKioL1hV_bLCPeHwAAAahOSqhpE024.png" height="114" />

2.安裝FTP服務,發布KS檔案;

[[email protected] ~]# yum install vsftpd -y   #安裝vsftpd服務

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/8B/B5/wKiom1hV_bPCw44sAABBxCcVcVI675.png" height="424" />

啟動服務;

[[email protected] ~]# systemctl restart vsftpd   #啟動服務[[email protected] ~]# systemctl enable vsftpd    #啟用服務ln -s ‘/usr/lib/systemd/system/vsftpd.service‘ ‘/etc/systemd/system/multi-user.target.wants/vsftpd.service‘    [[email protected] ~]# systemctl status vsftpd   #查看服務狀態

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8B/B5/wKiom1hV_bPQKWLOAABJFZqG8Vo652.png" height="194" />

3.其實我們可以用我們第一次安裝系統後的ks.cfg檔案,我在這裡就不多講Kickstart服務了;

[[email protected] ~]# cp /root/anaconda-ks.cfg /var/ftp/pub/ks.cfg  #複製ks檔案

從可以看到我們把光碟片安裝變成http方式安裝,並填寫對應的url地址;

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/8B/B5/wKiom1hV_bTDS7piAAA2UoYDlXs227.png" height="245" />

4.安裝http

[[email protected] ~]# yum install httpd -y  #安裝httpd服務

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/8B/B1/wKioL1hV_bSSzd8-AABUa-O1zo8298.png" height="381" />    

[[email protected] ~]# systemctl restart httpd    #重啟服務[[email protected] ~]# systemctl enable httpd      #啟用服務[[email protected] ~]# systemctl status httpd.service  #查看服務狀態

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8B/B5/wKiom1hV_bXBn4wCAABdSHF3hHQ527.png" height="249" />

[[email protected] ~]# mkdir /var/www/html/dvd   #建立dvd目錄,用於http的安裝源[[email protected] ~]# mount /dev/sr0 /var/www/html/dvd   #掛載光碟片

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/8B/B1/wKioL1hV_bXiRWeyAAB42A8i3bo622.png" height="579" />

5.安裝DHCP

[[email protected] ~]# yum install dhcp -y  #安裝DHCP服務

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/8B/B5/wKiom1hV_baRForPAAA7de66eCs138.png" height="419" />

[[email protected] ~]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf #複製配置模板到/etc/dhcp/dhcpd.conf[[email protected] ~]# vim /etc/dhcp/dhcpd.conf   #編輯dhcpd設定檔 [[email protected] ~]# cat /etc/dhcp/dhcpd.conf     #顯示dhcpd.conf檔案資訊subnet 172.16.38.0 netmask 255.255.255.0 {      range 172.16.38.20 172.16.38.25;      next-server 172.16.38.10;      filename "pxelinux.0";    }

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8B/B1/wKioL1hV_bbBlZTeAAAYcRuefvo141.png" height="107" />

[[email protected] ~]# systemctl restart dhcpd   #重啟服務[[email protected] ~]# systemctl status dhcpd.service #查看服務狀態

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/8B/B1/wKioL1hV_bfCoAzNAABzE7tizdY694.png" height="347" />

6.安裝TFTP服務;

[[email protected] ~]# yum install tftp-server –y  #安裝tftp服務

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/8B/B5/wKiom1hV_bjj43T_AAA24FMbWN4826.png" height="291" />

[[email protected] ~]# vim /etc/xinetd.d/tftp   #修改保護進程檔案,讓tftp啟動

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/8B/B1/wKioL1hV_biSMQrWAAAlJjAykcI022.png" height="191" />

[[email protected] ~]# systemctl restart xinetd.service #重啟服務

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8B/B1/wKioL1hV_biBsUogAAAYPX92xQg120.png" height="58" />

7.安裝syslinux服務;

[[email protected] ~]# yum install syslinux -y   #安裝syslinux服務,提供引導檔案、核心、鏡像等

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/8B/B1/wKioL1hV_bmTqCwqAAA8KpiDYoo574.png" height="412" />

[[email protected] ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/   #複製檔案[[email protected] ~]# ll /mnt/dvd/isolinux/  #查看檔案

total 72811    
-r--r--r--. 1 gsh gsh     2048 May  7  2014 boot.cat    
-r--r--r--. 1 gsh gsh       84 May  7  2014 boot.msg    
-r--r--r--. 1 gsh gsh      321 May  7  2014 grub.conf    
-r--r--r--. 2 gsh gsh 35544564 May  7  2014 initrd.img    
-r--r--r--. 1 gsh gsh    24576 May  7  2014 isolinux.bin    
-r--r--r--. 1 gsh gsh     3166 May  7  2014 isolinux.cfg    
-r--r--r--. 1 gsh gsh   176500 Jan  2  2014 memtest    
-r--r--r--. 1 gsh gsh      186 Mar  3  2014 splash.png    
-r--r--r--. 1 gsh gsh     2438 May  7  2014 TRANS.TBL    
-r--r--r--. 2 gsh gsh 33744152 May  7  2014 upgrade.img    
-r--r--r--. 1 gsh gsh   155792 Feb 28  2014 vesamenu.c32    
-r-xr-xr-x. 2 gsh gsh  4902000 May  5  2014 vmlinuz    

[[email protected] ~]# cd /mnt/dvd/isolinux/    #切換目錄[[email protected] isolinux]# cp isolinux.cfg vesamenu.c32 vmlinuz initrd.img /var/lib/tftpboot/  #複製檔案
[[email protected] isolinux]# ls /var/lib/tftpboot/    #查看檔案initrd.img  isolinux.cfg  pxelinux.0  vesamenu.c32  vmlinuz

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/8B/B1/wKioL1hV_brx0QHCAABuvR0hDh0200.png" height="314" />

[[email protected] tftpboot]# mkdir pxelinux.cfg   #建立目錄[[email protected] tftpboot]# cp isolinux.cfg pxelinux.cfg/default    #複製檔案[[email protected] tftpboot]# vim pxelinux.cfg/default  #修改檔案

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8B/B1/wKioL1hV_brwcz6lAAA0aRGnfII234.png" height="192" />

8.建立虛擬機器,通過pxe方式安裝rhel系統;

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/8B/B1/wKioL1hV_bvD0FSrAAAwv8Qdu-U961.png" height="561" />

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/8B/B5/wKiom1hV_buQBecSAAAedOJ6Log467.png" height="402" />

650) this.width=650;" title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px;" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8B/B5/wKiom1hV_bzjQhuhAAHp1f1MPR0915.png" height="645" />

本文出自 “gs_hao” 部落格,謝絕轉載!

RHCE之PXE+DHCP+TFTP+FTP/HTTP+KICKSTART用於PXE安裝RHEL7

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.