CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

這篇文章主要介紹“CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹”,在日常操作中,相信很多人在CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!

印江網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)!從網(wǎng)頁設計、網(wǎng)站建設、微信開發(fā)、APP開發(fā)、響應式網(wǎng)站設計等網(wǎng)站項目制作,到程序開發(fā),運營維護。創(chuàng)新互聯(lián)公司2013年成立到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗和運維經(jīng)驗,來保證我們的工作的順利進行。專注于網(wǎng)站建設就選創(chuàng)新互聯(lián)。

PXE高效批量網(wǎng)絡裝機

服務器的批量部署

  • 規(guī)?;和瑫r裝配多臺服務器

  • 自動化:安裝系統(tǒng)、配置各種服務

  • 遠程實現(xiàn):不需要光盤、U盤等安裝介質(zhì)

關于PXE網(wǎng)絡

PXE
  • 預啟動執(zhí)行環(huán)境,在操作系統(tǒng)之前運行

  • 可用于遠程安裝,構建無盤工作站

服務端
  • 運行DHCP服務,用來分配地址、定位引導程序

    • DHCP  自動分配IP地址   定位引導文件

  • 運行TFTP服務器,提供引導程序下載

    • TFTP 簡單文件傳輸協(xié)議

    • 使用UDP協(xié)議

    • 端口號69號

    • 優(yōu)點:高效率

    • 缺點:容量小

    • 用于存放:引導程序pxelinux.0syslinux軟件包),壓縮內(nèi)核vmlinuz,系統(tǒng)初始化文件initrd.img,啟動菜單default

  • 運行FTP服務,提供鏡像文件下載

    • FTPvsftpd)  文件傳輸協(xié)議

    • 優(yōu)點:安全 ,容量大

    • 缺點:傳輸速度慢

    • 使用TCP協(xié)議

    • 端口號20用于數(shù)據(jù)傳輸 ,端口號21用于連接

    • 用于存放:系統(tǒng)鏡像

  • 安裝包:dhcp,tftp-servervsftpd,syslinux

客戶端
  • 網(wǎng)卡支持PXE協(xié)議

  • 主板支持網(wǎng)絡啟動

基本部署過程
  • 準備CentOS 7安裝源(YUM倉庫)

  • 啟用TFTP服務,并提供內(nèi)核、引導程序

  • 啟用DHCP服務,用來分配地址、指出引導程序位置

  • 配置啟動菜單

TFTP服務及引導文件
  • 安裝tftp-server軟件包,啟用tftp服務

  • 準備內(nèi)核文件vmlinuz、初始化鏡像initrd.img

  • 準備引導程序文件pxelinux.0

DHCP服務的PXE設置
  • next-server     //指向TFTP路徑

  • filename           //引導程序文件位置

默認的啟動菜單文件
  • 創(chuàng)建/var/lib/tftpboot/pxelinux.cfg/default

  • 目錄名稱pxelinux.cfg不可更改

驗證PXE網(wǎng)絡安裝

  • 調(diào)整BIOS設置,以便從網(wǎng)絡引導

  • 自動獲取IP地址,并指定CentOS 7安裝源

  • 其余過程與本地安裝相同

Demo

1、首先在VMware 15虛擬機中配置一臺虛擬機,不安裝系統(tǒng),網(wǎng)卡設置處于僅主機模式,用于驗證PXE網(wǎng)絡裝機,并打開CentOS 7虛擬機,配置雙網(wǎng)卡模式,原網(wǎng)卡用于網(wǎng)絡連接,便于我們安裝服務軟件,添加的網(wǎng)卡設置為僅主機模式,使其與配置的虛擬機綁定在同一設備中,同時在添加的網(wǎng)卡中配置靜態(tài)IP地址,可以給配置的虛擬機提供IP地址。

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

[root@localhost ~]# ifconfig    //查看CentOS 7系統(tǒng)中網(wǎng)卡信息
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500     //原網(wǎng)卡信息
        inet 192.168.144.133  netmask 255.255.255.0  broadcast 192.168.144.255
        inet6 fe80::a85a:c203:e2e:3f3c  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:5b:d3:a0  txqueuelen 1000  (Ethernet)
        RX packets 26199  bytes 36984367 (35.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8391  bytes 524793 (512.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500         //添加的網(wǎng)卡信息
        inet6 fe80::deb1:3cec:3e26:5ec2  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:5b:d3:aa  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10  bytes 1308 (1.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
[root@localhost ~]# cd /etc/sysconfig/network-scripts/          //進入網(wǎng)卡配置文件目錄
[root@localhost network-scripts]# ls                            //查看信息
ifcfg-ens33  ifdown-ippp    ifdown-sit       ifup-bnep  ifup-plip    ifup-Team          network-functions-ipv6
ifcfg-lo     ifdown-ipv6    ifdown-Team      ifup-eth   ifup-plusb   ifup-TeamPort
ifdown       ifdown-isdn    ifdown-TeamPort  ifup-ib    ifup-post    ifup-tunnel
ifdown-bnep  ifdown-post    ifdown-tunnel    ifup-ippp  ifup-ppp     ifup-wireless
ifdown-eth   ifdown-ppp     ifup             ifup-ipv6  ifup-routes  init.ipv6-global
ifdown-ib    ifdown-routes  ifup-aliases     ifup-isdn  ifup-sit     network-functions
[root@localhost network-scripts]# cp -p ifcfg-ens33 ifcfg-ens36      //復制ens33配置文件為ens36
[root@localhost network-scripts]# vim ifcfg-ens36               //編輯網(wǎng)卡信息
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static               //更改dhcp為static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens36                        //更改33為36
DEVICE=ens36                      //更改33為36
ONBOOT=yes 
IPADDR=192.168.100.100            //配置IP地址
NETMASK=255.255.255.0             //配置子網(wǎng)掩碼
GATEWAY=192.168.100.1             //配置網(wǎng)關
~                                 //注意:刪除UUID條目                                                           
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
:wq
[root@localhost network-scripts]# service network restart              //重啟網(wǎng)卡服務
Restarting network (via systemctl):                        [  確定  ]
[root@localhost network-scripts]# ifconfig                               //查看網(wǎng)卡信息
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.144.133  netmask 255.255.255.0  broadcast 192.168.144.255
        inet6 fe80::a85a:c203:e2e:3f3c  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:5b:d3:a0  txqueuelen 1000  (Ethernet)
        RX packets 124487  bytes 178695031 (170.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 35758  bytes 2193524 (2.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        //獲取靜態(tài)IP地址
        inet 192.168.100.100  netmask 255.255.255.0  broadcast 192.168.100.255
        inet6 fe80::f6eb:23e3:3afb:fef4  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:5b:d3:aa  txqueuelen 1000  (Ethernet)
        RX packets 2  bytes 486 (486.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 186  bytes 32776 (32.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

2、安裝DHCP服務,并編輯DHCP服務配置文件

[root@localhost network-scripts]# yum install dhcp -y
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 dhcp.x86_64.12.4.2.5-68.el7.centos.1 將被 安裝
...//省略部分內(nèi)容...
已安裝:
  dhcp.x86_64 12:4.2.5-68.el7.centos.1                                                     

作為依賴被升級:
  dhclient.x86_64 12:4.2.5-68.el7.centos.1    dhcp-common.x86_64 12:4.2.5-68.el7.centos.1  
  dhcp-libs.x86_64 12:4.2.5-68.el7.centos.1  

完畢!
[root@localhost network-scripts]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf 
cp:是否覆蓋"/etc/dhcp/dhcpd.conf"? yes         //復制DHCP配置文件模板到配置文件中,輸入yes確認
[root@localhost network-scripts]# vim /etc/dhcp/dhcpd.conf   //編輯配置DHCP配置文件
...//省略部分內(nèi)容...
ubnet 192.168.100.0 netmask 255.255.255.0 {            //設置網(wǎng)段地址
        range 192.168.100.20 192.168.100.30;           //設置IP地址分配范圍
        option routers 192.168.100.100;                //設置網(wǎng)關,指向自己,方便服務器分配地址
        option domain-name-servers 8.8.8.8;            //設置分配DNS地址
        next-server 192.168.100.100;                   //設置指向TFTP服務器地址,也就是本機
        filename "pxelinux.0";                         //設指向引導文件位置,注意:文件名不可輸錯
}
...//省略部分內(nèi)容...
:wq                            //保存退出

3、安裝引導程序文件

[root@localhost network-scripts]# yum install syslinux -y   //安裝引導程序
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 syslinux.x86_64.0.4.05-15.el7 將被 安裝
...//省略部分內(nèi)容...
已安裝:
  syslinux.x86_64 0:4.05-15.el7                                                                                 
完畢!
[root@localhost network-scripts]# rpm -ql syslinux | grep pxelinux.0   //查看安裝的軟件中是否成功安裝引導文件
/usr/share/syslinux/gpxelinux.0
/usr/share/syslinux/pxelinux.0      //程序引導文件

4、安裝TFTP服務軟件

[root@localhost network-scripts]# yum install tftp-server -y   //安裝tftp服務
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 tftp-server.x86_64.0.5.2-22.el7 將被 安裝
...//省略部分內(nèi)容...
已安裝:
  tftp-server.x86_64 0:5.2-22.el7                                                                               
完畢!
[root@localhost network-scripts]# rpm -ql tftp-server        //查看tftp服務列表
/etc/xinetd.d/tftp                                    //tftp配置文件目錄
/usr/lib/systemd/system/tftp.service
/usr/lib/systemd/system/tftp.socket
/usr/sbin/in.tftpd
/usr/share/doc/tftp-server-5.2
/usr/share/doc/tftp-server-5.2/CHANGES
/usr/share/doc/tftp-server-5.2/README
/usr/share/doc/tftp-server-5.2/README.security
/usr/share/man/man8/in.tftpd.8.gz
/usr/share/man/man8/tftpd.8.gz
/var/lib/tftpboot                                     //tftp站點目錄

5、將引導程序文件放入tftp服務站點中,并開啟tftp服務功能

[root@localhost network-scripts]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/  //將文件復制入tftp站點中
[root@localhost network-scripts]# cd /var/lib/tftpboot/     //進入tftp站點
[root@localhost tftpboot]# ls                               //查看目錄信息
pxelinux.0                                                   //引導程序文件添加入站點
[root@localhost tftpboot]# vim /etc/xinetd.d/tftp            //進入編輯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 /var/lib/tftpboot
        disable                 = no                     //更改yes為no開啟服務功能
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
~                                                                                                             
:wq                                                    //保存退出

6、安裝ftp服務功能,并將鏡像文件CentOS 7掛載在ftp站點中,并找到系統(tǒng)初始文件與壓縮內(nèi)核文件,將其添加到的tftp站點中。

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

[root@localhost tftpboot]# yum install vsftpd -y
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 vsftpd.x86_64.0.3.0.2-25.el7 將被 安裝
...//省略部分內(nèi)容...
已安裝:
  vsftpd.x86_64 0:3.0.2-25.el7                                                                                  
完畢!
[root@localhost tftpboot]# rpm -ql vsftpd     //查看ftp服務文件列表
...//省略部分內(nèi)容...
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/share/man/man8/vsftpd.8.gz
/var/ftp                            //ftp站點位置
/var/ftp/pub
[root@localhost ~]# cd /var/ftp/       //進入ftp服務站點
[root@localhost ftp]# ls               //查看目錄
pub
[root@localhost ftp]# mkdir centos7      //創(chuàng)建目錄centos7目錄用戶掛載鏡像文件
[root@localhost ftp]# ls                 //查看
centos7  pub                             //創(chuàng)建成功
[root@localhost ftp]# mount /dev/sr0 /var/ftp/centos7/     //將鏡像文件掛載到ftp站點中centos7目錄
mount: /dev/sr0 寫保護,將以只讀方式掛載
[root@localhost ftp]# df -hT                               //查看磁盤信息
文件系統(tǒng)       類型      容量  已用  可用 已用% 掛載點
/dev/sda2      xfs        20G  3.7G   17G   19% /
devtmpfs       devtmpfs  898M     0  898M    0% /dev
tmpfs          tmpfs     912M     0  912M    0% /dev/shm
tmpfs          tmpfs     912M  9.0M  903M    1% /run
tmpfs          tmpfs     912M     0  912M    0% /sys/fs/cgroup
/dev/sda5      xfs        10G   37M   10G    1% /home
/dev/sda1      xfs       6.0G  174M  5.9G    3% /boot
tmpfs          tmpfs     183M   28K  183M    1% /run/user/0
/dev/sr0       iso9660   4.3G  4.3G     0  100% /var/ftp/centos7     //成功掛載
[root@localhost ftp]# cd centos7/           //進入centos7目錄
[root@localhost centos7]# ls                //查看掛載的鏡像信息
CentOS_BuildTag  EULA  images    LiveOS    repodata              RPM-GPG-KEY-CentOS-Testing-7
EFI              GPL   isolinux  Packages  RPM-GPG-KEY-CentOS-7  TRANS.TBL
[root@localhost centos7]# cd images/     //進入images目錄
[root@localhost images]# ls              //查看目錄信息
efiboot.img  pxeboot  TRANS.TBL
[root@localhost images]# cd pxeboot/     //進入pxeboot目錄
[root@localhost pxeboot]# ls              //查看目錄信息
initrd.img  TRANS.TBL  vmlinuz           //壓縮內(nèi)核與系統(tǒng)初始化文件
[root@localhost pxeboot]# cp initrd.img vmlinuz /var/lib/tftpboot/  //將壓縮內(nèi)核與系統(tǒng)初始化文件添加入tdtp站點
[root@localhost pxeboot]# ls /var/lib/tftpboot/     //查看tftp站點信息
initrd.img  pxelinux.0  vmlinuz                      //成功添加壓縮內(nèi)核與系統(tǒng)初始化文件

7、在tftp站點中添加啟動菜單,完成后,開啟dhcp、tftp、ftp服務,并關閉防火墻、增強性安全功能

[root@localhost pxeboot]# cd /var/lib/tftpboot/      //進入tftp站點
[root@localhost tftpboot]# ls                        //查看站點信息
initrd.img  pxelinux.0  vmlinuz                      
[root@localhost tftpboot]# mkdir pxelinux.cfg        //在站點中添加啟動菜單目錄,注意:目錄名不可寫錯
[root@localhost tftpboot]# ls                        //查看目錄
initrd.img  pxelinux.0  pxelinux.cfg  vmlinuz        //成功創(chuàng)建啟動菜單目錄
[root@localhost tftpboot]# cd pxelinux.cfg/          //進入創(chuàng)建的啟動菜單目錄
[root@localhost pxelinux.cfg]# vim default           //編輯啟動菜單文件
default auto                             //默認模式
prompt 1                                 //等待時間1秒
                                                         //編寫配置文件模板
label auto                             
        kernel vmlinuz                  //內(nèi)核信息
        append initrd=initrd.img method=ftp://192.168.100.100/centos7   
                                        //加載系統(tǒng)初始化文件,模式為ftp,存放目錄為centos7
label linux text
        kernel vmlinuz
        append text initrd=initrd.img method=ftp://192.168.100.100/centos7

label linux rescue                          //進入急救模式
        kernel vmlinuz                
        append rescue initrd=initrd.img method=ftp://192.168.100.100/centos7
~                                                                                                             
~                                                                                       
:wq         //編寫完成后保存退出
[root@localhost pxelinux.cfg]# systemctl start dhcpd           //啟動dhcp服務
[root@localhost pxelinux.cfg]# systemctl start tftp            //啟動tftp服務
[root@localhost pxelinux.cfg]# systemctl start vsftpd          //啟動ftp服務
[root@localhost pxelinux.cfg]# systemctl stop firewalld.service    //關閉防火墻功能
[root@localhost pxelinux.cfg]# setenforce 0                        //關閉增強性安全功能

8、驗證PXE網(wǎng)絡部署裝機,打開配置的虛擬機,在開機界面按ESC鍵,進入boot模式,選擇從網(wǎng)絡啟動

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

關于kickstart

kickstart無人值守技術
  • 創(chuàng)建應答文件,預先定義好各種安裝設置

  • 免去交互設置過程,從而實現(xiàn)全自動化安裝

  • 通過添加%post腳本,完成安裝后的各種配置操作

Demo

1、在CentOS 7中安裝kickstart服務軟件

[root@localhost pxelinux.cfg]# yum install system-config-kickstart -y   //安裝kickstart軟件
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 system-config-kickstart.noarch.0.2.9.7-1.el7 將被 安裝
...//省略部分內(nèi)容...
已安裝:
  system-config-kickstart.noarch 0:2.9.7-1.el7                                                                  
作為依賴被安裝:
  gnome-python2.x86_64 0:2.28.1-14.el7                   gnome-python2-canvas.x86_64 0:2.28.1-14.el7         
  libart_lgpl.x86_64 0:2.3.21-10.el7                     libgnomecanvas.x86_64 0:2.30.3-8.el7                 
  rarian.x86_64 0:0.8.1-11.el7                           rarian-compat.x86_64 0:0.8.1-11.el7                 
  system-config-date.noarch 0:1.10.6-3.el7.centos        system-config-date-docs.noarch 0:1.0.11-4.el7       
  system-config-keyboard.noarch 0:1.4.0-5.el7            system-config-keyboard-base.noarch 0:1.4.0-5.el7    
  system-config-language.noarch 0:1.4.0-9.el7            usermode-gtk.x86_64 0:1.111-5.el7                      
完畢!

2、安裝完成后在圖像化界面打開kickstart服務軟件

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

3、打開軟件后首先設置基本配置

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

4、設置安裝方法與引導裝載程序選項

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹
CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

5、設置分區(qū)信息

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

6、設置網(wǎng)卡配置

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

7、配置安裝后腳本信息

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

8、完成后將配置好的文件信息保存到FTP站點中

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

9、保存完成后關閉軟件,打開終端,進入ftp站點查看保存的文件,進入查看文件,并在模板中添加需要的組件安裝包。

[root@localhost ~]# cd /var/ftp      //進入ftp站點
[root@localhost ftp]# ls             //查看目錄信息
centos7  ks.cfg  pub
[root@localhost ftp]# vim ks.cfg      //進入編輯模式查看保存的模板信息
platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
rootpw --iscrypted $1$QnfXQpTo$2SWg34gaOZQoLWy.bGlmd/        //root用戶密鑰模板
# Use network installation
url --url="ftp://192.168.100.100/centos7"         //安裝路徑模板
# System language
lang zh_CN                                         //設置的鍵盤模式
# Firewall configuration
firewall --disabled
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# SELinux configuration
selinux --enforcing

# Network information
network  --bootproto=dhcp --device=ens33            //設置的網(wǎng)卡信息
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai
# System bootloader configuration
bootloader --location=none
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="xfs" --size=500            //磁盤分區(qū)設置模板
part /home --fstype="xfs" --size=4096
part swap --fstype="swap" --size=4096
part / --fstype="xfs" --grow --size=1    
:q                        //退出模板
[root@localhost ftp]# cd /root                   //進入root用戶家目錄
[root@localhost ~]# ls                           //查看家目錄信息
anaconda-ks.cfg       公共  視頻  文檔  音樂        //找到anaconda-ks.cfg模板
initial-setup-ks.cfg  模板  圖片  下載  桌面
[root@localhost ~]# vim anaconda-ks.cfg           //進入編輯anaconda-ks.cfg模板
...//省略部分內(nèi)容...
%packages
@^gnome-desktop-environment
@base
@core
@desktop-debugging
@dial-up
@directory-client
@fonts
@gnome-desktop
@guest-agents                     //找到此部分信息并復制
@guest-desktop-agents
@input-methods
@internet-browser
@java-platform
@multimedia
@network-file-system-client
@networkmanager-submodules
@print-client
@x11
chrony
kexec-tools

%end
...//省略部分內(nèi)容...
:q                        //退出
[root@localhost ~]# vim /var/ftp/ks.cfg             //進入ftp站點,編輯ks.cfg文件
part /boot --fstype="xfs" --size=500
part /home --fstype="xfs" --size=4096
part swap --fstype="swap" --size=4096
part / --fstype="xfs" --grow --size=1

%packages
@^gnome-desktop-environment
@base
@core
@desktop-debugging
@dial-up
@directory-client
@fonts                                           //在下行粘貼此部分內(nèi)容
@gnome-desktop
@guest-agents
@guest-desktop-agents
@input-methods
@internet-browser
@java-platform
@multimedia
@network-file-system-client
@networkmanager-submodules
@print-client
@x11
chrony
kexec-tools

%end
~                                                                                      
:wq                                            //保存退出

10、在tftp站點啟動菜單文件中添加ks.cfg文件引導條目。

[root@localhost ~]# cd /var/lib/tftpboot/             //進入tftp站點
[root@localhost tftpboot]# ls                         //查看站點信息
initrd.img  pxelinux.0  pxelinux.cfg  vmlinuz
[root@localhost tftpboot]# cd pxelinux.cfg/           //進入目錄
[root@localhost pxelinux.cfg]# ls
default
[root@localhost pxelinux.cfg]# vim default            //進入編輯啟動菜單文件 
default auto
prompt 1

label auto
        kernel vmlinuz              //添加ks=ftp://192.168.100.100/ks.cfg條目使裝機時系統(tǒng)可以讀取ks.cfg模板內(nèi)容
        append initrd=initrd.img method=ftp://192.168.100.100/centos7 ks=ftp://192.168.100.100/ks.cfg

label linux text
        kernel vmlinuz
        append text initrd=initrd.img method=ftp://192.168.100.100/centos7

label linux rescue
        kernel vmlinuz
        append rescue initrd=initrd.img method=ftp://192.168.100.100/centos7
:wq                                     //保存退出

11、配置一臺新的虛擬機,網(wǎng)卡設置為僅主機模式,然后驗證PXE部署裝機+kickstart無人值守裝機。

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹

到此,關于“CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續(xù)學習更多相關知識,請繼續(xù)關注創(chuàng)新互聯(lián)網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>

當前標題:CentOS7中PXE高效批量網(wǎng)絡裝機的詳細介紹
網(wǎng)站鏈接:http://muchs.cn/article8/ihgoip.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供云服務器全網(wǎng)營銷推廣、移動網(wǎng)站建設、用戶體驗、自適應網(wǎng)站、動態(tài)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設