PXE is automatically installed Linux systems
1. PXE Introduction
When the installed operating system is relatively large, the manual installation is unrealistic at this time is necessary to use PXE up.
PXE stands for: Preboot Excution Environment Pre-Boot Execution Environment is developed by Intel-based network model Client / Server, support for remote hosts over the network from a remote server to download the image, and thus can be guided through a support network and PXE boot operating system install Windows, linux and other operating systems.
2. Experimental Procedure
(1) Preparing the Environment
Two virtual machines, one of which is used as a server. (Configuration operations are substantially all client machines need not be configured on the server.) Also need to install at least one source (image file installation system)
1. The two virtual machines NIC is configured to only the host mode (mainly external network and isolation to face the impact of physical machines DHCP service)
2. Turn off the VMware DHCP server
in VMware main interface, click "edit → virtual network editor"
select the host type of connection only in the open interface and check off the following use the local DHCP service (if gray check box, click change settings give him admin rights) as shown:
3. Change the configuration file as follows:
TYPE=Etherner
BOOTPROTO = static # dhcp will change static
IPADDR = 192.168.117.10 # assign a ip address to the vmnet1 in the same network segment
PREFIX = 255.255255.0 # Subnet Mask
GATEWAY = 192.168.117.1 # Gateway
NAME=ens33
DEVICE=ens3 3
ONBOOT = yes # yes to
4. Edit the Wi ndows virtual NIC configuration to the virtual machine and can communicate , open the Control Panel → Network and Sharing Center → Change adapter settings , usually only the name of the host is connected VMnet1, ipv4
Ip Address : 192.168..117.11
Subnet Mask: 255.255.255.0
5. Check Server settings
Ensure SELinux and firewall is turned off.
The / etc / selinux / config file SELINUX = xxx to SELINUX = disabled and restart.
It can be ordered getenforce view, if it is disabled or permissive state that is closed
to perform the following two commands sure to turn off the firewall
systemctl stop firewalld
systemctl disable firewalld
6. Install the software (required)
yum install httpd dhcp syslinux tftp-server
systemctl start httpd tftp.socket
systemctl enable dhcpd tftp.socket httpd
7. Preparing to Install source
mkdir -p / var / www / html / Centos / 7 # Create Folder
mount / var / www / html / Centos / 7 # disc mounted to the directory
/ etc / sr0 / var / www / html / Centos / 7 iso9660 default 0 0 # add information to automatically mount
df -h # confirmation mounting information
In the host using the browser to access http://192.168.11.2/Centos/7 confirmation can be seen mounted installation files
8. prepare auto-answer file
Modified anaconda-ks.cfg file
#platform=86, AMD64, or Intel EM64T
#version=DEVEL
# System authorization information
auth --useshadow --passalgo=sha512
# The Install OS INSTEAD of upgrade # select the upgrade or installation, install to install, upgrade is an upgrade
install
# The Use Media Installation CDROM # installation media, here is the need to modify the place
cdrom
# The Use text the MODE install # using a graphical interface to install or text, usually we do not need to install automatic graphics
text
# Firewall the Configuration # firewall options, usually choose to close
firewall --disabled
firstboot --disable
ignoredisk --only-use=sda
# Keyboard layouts
# old format: keyboard us
# new format:
keyboard --vckeymap=us --xlayouts=''
# System language
long en_US.UTF-8
# Network Information # After installing the network configuration information can be onboot changed to ON , you can specify the way a hostname
network --bootproto=dhcp --device=ens33 --onboot=off --ipv6=auto --no-activate
network --hostname=localhost.localdomain
# Reboot the After Installation # reboot after installation
reboot
# Root password # root account password, where password is encrypted password
rootpw --iscrypted $1$HwDDpzbI$JcacPj2.QTbRQgNWUP8hr1
# SELinux the Configuration #SELinux options
selinux --disabled
# System services
services --enabled="chronyd"
# Do not configure the X Window System
skipx
# System TimeZone # time zone
timezone Asia/Shanghai
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
#Clear the Master Boot Record
# Zerombr # Clear MBR
# Partition clearing information
# Clearpart --all --initlabel # Clear Disk
# Disk partitioning information
# The following three lines are partition information, pay attention to modify according to their own situation. size unit is MB
#part swap --fstype="swap" --size=2048
#part / --fstype="xfs" --size=20480
#part /boot --fstype="xfs" --size=1024
# To install the package @ the beginning of the packet group, there is no @ is a separate package
%packages
@core
zsh
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
1. Install the media content that is replaced by the following cdrom url --url = "http://192.168.117.10/centos/7/"
2. firewall and SELinux according to their needs to open or close
3. If no zerombr and the clearpart --all --initlabel , if preceded manually add # remove
4 before removing the partition information #
5 according to their needs you need to install the package, minimizing only one core to
6. put the file can be saved after HTTP places to visit, such as / var / the WWW / HTML / , make sure the file permissions to 644
7. in the host access http: / /192.168.117.10/anaconda-ks.cfg If you can successfully access, indicating success.
9 . Configure DHCP server
By default, the DHCP service configuration file is empty after the installation is complete, and therefore DHCP services must be some configuration before they can start, DHCP service configuration file is : /etc/dhcp/dhcpd.conf ,
# Specify the DHCP acquired server DNS address
option domain-name-servers 114.114.114.114
# Default IP lease address
default-lease-time 600;
# Longest lease
max-lease-time 7200;
# Subnet to specify the network segment, Netmask is a mask
subnet 192.168.117.0 netmask 255.255.255.0
{
# Use range specified IP address pool
range 192.168.117.100 192.168.117.200
}
filename "pxelinux.0";
range 192.168.11.3 192.168.11.124;
}
Then use systemctl start dhcpd start dhcp service, using ss -unl view the 67 port will already be opened
10. Copy the relevant documents to the TFTP shared directory
11. Modify default file
# Is just to copy the file menu
default menu.c32
# Timeout, that is, the countdown menu
timeout 600
display boot.msg
# Start specific configuration menu
# MENU label is used to specify the name of the menu, customize, ^ symbols are used to determine the cursor position,
# While subsequent letter is transferred to the corresponding menu shortcuts
# Kernel to specify the kernel file path, as we put it in the folder path is 7 / vmlinuz
# Specified initrd path, and ks path to the answer file file
# Sure that the answer file can be accessed
label linux
menu label ^Install CentOS 7
kernel 7/vmlinuz
append initrd=7/initrd.img ks=http://192.168.11.2/anaconda-ks.cfg
# Local hard disk
# The MENU default representation of this menu is the default menu, automatic installation because of the risk, it is recommended to start locally as the default start
label local
menu default
menu label Boot from ^local drive
localboot 0xFFFF
menu end
1 2. Start the test
The card is also another virtual machine is configured to only host, use the card to automatically obtain IP .
Finally, make sure the installation source, and answer file can be accessed, and the default file path is configured correctly.
Verification of the firewall and SELinux is turned off.
Confirmation, then you can start to be tested.