CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

A basic overview ---------------------- ----------------------

PXE is guided by the Inter developed network technology, working in Client / Server mode, allows a client to download a boot image from a remote server through the network and load the installation files or the entire operating system

--------- Installation Services PXE installed the required quantities ---------

DHCP+TFTP+DHTP

--------- installation files needed for PXE --------------

Bootstrap pxelinux.0
compressed kernel vmlinuz
system initialization files initrd.img
Start menu default
·
the DHCP: automatically assign IP addresses, locate boot files.
TFTP: storage installation system boot files, fast loading (The reason is that small as boot files, operating efficiency is required)
the FTP: File storage system, a large capacity (TCP protocol, the file system is needed is a safe and stable transfer)

System Environment

CentOS7 as a server: Run the DHCP service to assign addresses, locate boot program, run TFTP server to provide the boot program to download
CentOS7 as a client: NIC supports PXE protocol, the motherboard supports network boot

Actual operation

1, the first deployment PXE server to know that PXE is in the LAN environment is used, but because we need to install the required service package (you can also create private YUM warehouse), it is necessary to add a network card is set to host only mode, so you can either install the needed packages, and can then be guided LAN service
CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

1. First, we add the new card can be configured to copy ens33 network configuration file to ens36 a template, and then enter "vim ifcfg-ens36", enter ens36 network configuration file, the ens36 configured as static IP, press "/" enter DHCP, hit enter, press "dw" to delete "static", the profile of all "ens33" to "ens36", according to "dd" delete UUID = c9fb678c-82b2-44b7 -93ee-ab6d56e066cb, then configure the gateway address is 192.168.100.1, press "wq" to save and exit, so the network can ens36 configured, restart after configuring, let it take effect

[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# cp -p ifcfg-ens33 ifcfg-ens36
[root@localhost network-scripts]# vim ifcfg-ens36
[root@localhost network-scripts]# service network restart

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)
CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)
CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

2, using the "ifconfig" command to view ens36IP modified address, MAC address is in effect

[root@localhost network-scripts]# ifconfig

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

3, after the end of the two-card configuration we will begin the installation service, first install the DHCP service, type "yum intsall dhpd -y" to start the installation DHCP Service

[root@localhost network-scripts]# yum install dhcp -y

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

4, is to take over in the process of configuring DHCP, enter "cp -p /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf" copy a template to the DHCP configuration file enter "yes" to confirm coverage

[root@localhost network-scripts]# cp -p /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

5, enter the DHCP after a good copy of the template configuration file to modify
detailed steps

[root@localhost network-scripts]# vim /etc/dhcp/dhcpd.conf 
subnet 192.168.100.0 netmask 255.255.255.0 {
        range 192.168.100.20 192.168.100.30;
        option routers 192.168.100.100;
        option domain-name-servers 10.10.10.10;
        filename "pxelinux.0";
}

subnet 192.168.100.0 netmask 255.255.255.0(设置网段为192.168.100.0、MAC地址不变)
range 192.168.100.20 192.168.100.30;(配置DHCP服务分配给客户端的地址范围)
option routers 192.168.100.100;(网关设置为指向本地)
option domain-name-servers 10.10.10.10;(分配DNS地址)
net-server 192.168.100.100;(指向TFTP服务器)
filename "pxelinux.0";(指向引导文件位置)

·

6、配置完DHCP配置文件之后就可以安装引导程序文件

[root@localhost network-scripts]# yum install syslinux -y

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

7、安装完之后可以输入"[root@localhost network-scripts]# rpm -ql syslinux | grep pxelinux.0",可以看到文件的路径位置,但是我们应该把它放在TFTP里,因为刚才在配置文件中我们指向了TFTP路径"pxelinux.0",
CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

8、安装我们所需要的使用的tftp服务,输入[root@localhost network-scripts]# yum install tftp-server -y"

[root@localhost network-scripts]# yum install tftp-server -y

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

9、tftp服务安结束之后我们需要知道它的配置文件和站点,输入"[root@localhost ~]# rpm -ql tftp-server",其中"/etc/xinetd.d/tftp"是tftp服务的配置文件,"/var/lib/tftpboot"是tftp服务的站点

[root@localhost ~]# rpm -ql tftp-server

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

10、现在把引导程序"pxelinux.0"放入到tftp服务站点里

[root@localhost ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

11、进入配置文件修改enable启动tftp服务,输入"vim /etc/xinetd.d/tftp",将配置文件中"enable"一行中的"yes"改为"no"即可

[root@localhost ~]# vim /etc/xinetd.d/tftp 

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

12、安装ftp服务使用里面的镜像文件,输入"yum install vsftpd -y"

[root@localhost ~]# yum install vsftpd -y

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

13、进入到ftp站点中拆创建文件夹"centos7"作为挂载目录,可以选择复制到"centos7"也可以直接挂载,这里需要把虚拟机中的镜像文件连接上才可以进行挂载

[root@localhost ~]# cd /var/ftp/
[root@localhost ftp]# mkdir centos7
[root@localhost ftp]# mount /dev/sr0 /var/ftp/centos7

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

14、将初始化文件和压缩内核文件放到"/var/libtftpboot/(tftp服务站站点),

[root@localhost pxeboot]# cp initrd.img vmlinuz /var/lib/tftpboot/

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

15、通过查看可以看到tftp服务站点中就差启动菜单配置好,接下来就是配置启动菜单,进入到"tftpboot"中创建"pxelinux.cfg"目录(此目录名千万不能错)

[root@localhost tftpboot]# mkdir pxelinux.cfg

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

16、进入到pxelinux.cfg中,手动编辑启动菜单"default",编辑完之后"wq"保存退出
详细配置

default auto
prompt 1

label auto
        kernel vmlinuz
        append initrd=initrd.img method=ftp://192.168.100.100/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

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

17、所有的文件都配置好了之后就剩下最后一步了,关闭防火墙、增强性安全功能,然后启动所有服务

[root@localhost pxelinux.cfg]# systemctl stop firewalld.service(关闭防火墙) 
[root@localhost pxelinux.cfg]# setenforce 0(关闭增强性安全功能)
[root@localhost pxelinux.cfg]# systemctl start dhcpd(启动dhcp服务)
[root@localhost pxelinux.cfg]# systemctl start tftp(启动tftp服务)
[root@localhost pxelinux.cfg]# systemctl start vsftpd(启动ftp服务)

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)


-------------------无人装机服务--------------

1、要想实现装机过程无需手动,我们这里就需要安装"kickstart"

[root@localhost ~]# yum install system-config-kickstart -y

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

2、安装完之后我们进入虚拟机中,点击应用程序在系统工具中可以看到"Kiskstart",用它创建模板文件
CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

3, click into the start configuration "Kiskstart" program
basic configuration
the default language: Chinese (Simplified)
Keyboard: USEnglish
Time zone: Asia / on Shanghai
Root password:
check restart after installation
CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)
Installation
Installation: Perform a clean installation
installation methods: FTP
CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)
partition information
click Add
/ the Boot: 500M
/ Home: 4096M
swap: 4096M
/: use the entire disk unallocated space
CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)
network settings
click Add network equipment
CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)
firewall settings
CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)
after installation script
CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)
basic configuration has been satisfied, click on the upper left corner of the file save to save the file in the file system "/ var / ftp /
CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

·

4, "Kiskstart" Configuration finished, we need to "root" directory "anaconda-ks.cfg" in the host installation package to the "ks.cfg" as a template, if you do not replicate when the election assembly will then install failure

[root@localhost ftp]# vim anaconda-ks.cfg 
[root@localhost ftp]# vim ks.cfg

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

5, first enter the "/ var / lib / tftpboot / in, and then go to" /pxelinux.cfg "can see" default ", Edit" default "profiles kickstart add the path in the automatic mode

[root@localhost ~]# cd /var/lib/tftpboot/
[root@localhost tftpboot]# cd pxelinux.cfg/
[root@localhost pxelinux.cfg]# vim default 

CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)
6. Finally, we create a virtual machine, select Later when installing the operating system is installed later, and then select only the host mode, click on the virtual machine is running, you can see the automatically installed CentOS7
CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)
CentOS7 the PXE network installed and unattended batch installed capacity (installed capacity of the whole process hands-free)

Guess you like

Origin blog.51cto.com/14307755/2438694