For the deployment of a large number of servers with the same system in the production environment, it is a very time-consuming task to install the operating system one by one. Fortunately, CentOS provides the function of unattended installation of the system. The configuration steps are described in detail below.
One, configure the local yum source
Because some software needs to be installed to achieve our purpose, it is best to configure the yum source first.
Mount the CD to the /media/ directory.
Second, the software needed to install
tftp: Simple file transfer protocol, used to provide installation guide-related files to the client.
dhcp: Dynamic Host Configuration Protocol, which assigns IP addresses to clients.
http: Provide the client with the files needed during system installation.
system-config-kickstart: used to generate kickstart configuration files.
Three, turn off the firewall and SELinux
Fourth, configure the tftp server
1、 Modify the configuration file
Set disable to "no".
2、 Restart service
3、 View the tftp server port
4、 Copy the pxelinux.0 file to the /var/lib/tftpboot directory
Note: Usually the syslinux directory under the /usr/share directory exists. In case there is no such directory in your system, you can first execute yum -y install syslinux to install the software, and then copy.
5、 Copy the contents of the isolinux directory from the installation CD to the /var/lib/tftpboot directory
6、 Copy the /var/lib/tftpboot/isolinux.cfg file to the /var/lib/tftpboot/pxelinux.cfg directory and rename it to default
7、 Modify the default file
The default file is used to define the boot menu during installation. We can modify this file to customize the installation interface.
Note: 192.168.253.128 is the IP address of the kickstart server.
Five, configure DHCP
1、 Modify the /etc/dhcp/dhcpd.conf file
2、 Restart service
Six, configure HTTP
1、 Create a directory in the root directory of http for mounting system image files
2、 Mount the CD to the newly created directory
Seven, generate kickstart configuration file
1、 Open kickstart configuration tool
Open the terminal in the graphical interface and enter the following command to call up the kickstart configuration tool.
2、 Configure basic information such as language, time zone, root password, etc.
3、 Choose the installation method
Here, only the http protocol is used for demonstration. The other installation methods are similar and can be configured according to this method.
4、 Create partition
5、 Add network card device
6、 Turn off SELinux and firewall
7、 Select the package to be installed
Only the most basic software packages are selected here.
8、 Create a post-install script
9、 Save the configuration file
** Note: The configuration that is not explained in the above configuration process will all adopt the default configuration. **
10、 Create partition and LVM in the configuration file
As shown in the figure below, the zone configuration information is marked in the red frame.
Let's take a look at the partition creation format in the ks configuration file:
Create partition: part
Create physical volume: part pv.ID
Create a volume group: volgroup volume group name-pesize=PE block size PV
Create a logical volume: logvol mount point –fstype=file system format –name=volume name –vgname=VG volume name –size=capacity
According to the above summary, let's take a look at how the picture is divided:
clearpart -linux -drivers=sda: means to clear all Linux partitions on sda;
part /boot –fstype="ext4" –size=500: partition 500M of space to /boot, the partition format is ext4;
part pv.01 -grow -size=1: All the remaining space on sda is made into physical volume pv.01;
volgroup VolGroup –pesize=4096 pv.01: divide the physical volume pv.01 into the VolGroup volume group;
logvol / –fstype="ext4" –name=lv_root –vgname=VolGroup –size=10240: Divide 10G of space from the volume group VolGroup to make a logical volume for the root partition. The name of the logical volume is lv_root and its format is ext4 ;
logvol swap –name=lv_swap –vgname=VolGroup –size=2048: Divide 2G of space from the volume group VolGroup into a logical volume for swap partition. The name of the logical volume is lv_swap.
8. Use unattended installation of CentOS6.6 system
For a machine without any system, you can directly enter the interface shown in the figure below, and you can see that its label is the text we customized in the default file above.
After the previous series of environmental checks, the text installation interface is directly entered, as shown in the following figure:
After the installation is complete, you will directly enter the system.
Let's verify that the various preset configurations are effective:
Enter the password you just set to successfully enter the system, and also get an IP address;
The results of each zone are consistent with the preset situation;
Remember that we set up the post script at the end to automatically create the yum source, which was also successfully established.
Note: The process demonstrated above is the most basic deployment steps and content. We can also use ks configuration files and post scripts to complete the installation and configuration of more complex systems.
Recommended Posts