Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Unattended installation of linux system

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1, unattended installation system

Realize the PXE+kickstart service program of unattended installation service, and manually deploy PXE+DHCP+TFTP+Kiskstart and other service programs, so as to build a set of unattended installation system which can install linux system in batches.

2, the following steps

Install the DHCP service, which is used to assign available IP addresses to the client host, and this is the basis for file transfer between the server and the client host, so install the DHCP service first and configure it accordingly.

When the CD image is mounted and the Yum library files are configured, you can install the DHCP service program

Yum-y install dhcp-y indicates that all problems during installation are yes.

Edit the main configuration file vim / etc/dhcp/dhcpd.conf and enter the contents

Allow booting;-allow startup

Allow bootp;-allow BOOTP bootstrapper protocol

Ddns-update-style interim;-the update mode of DNS server is paused

Ignore client-updates;-ignore client updates

Subnet 192.168.13.0 netmask 255.255.255.0 {- subnet range, subnet mask

Option subnet-mask 255.255.255.0

Option domain-name-servers 192.168.13.10

Range dynamic-bootp 192.168.13.100 192.168.13.200;-IP range assigned to customers and hosts

Default-lease-time 21600;-default connection time is

Max-lease-time 43200;-the maximum connection time is

Next-server 192.168.13.10;-successor server

Filename "pxelinux.0";-Boot driver file, later created

}-curly braces are indispensable

Systemctl restart dhcpd restarts the DHCP service

Systemctl enable dhcpd boots to start the DHCP service

3. Configure the TFTP service program

TFTP service is a simple file transfer protocol based on UDP protocol, and the required file resources can be obtained without Yonghua authentication, so we configure TFTP service to provide boot and driver files for client hosts.

Yum-y install tftp-server installer service program

The TFTP service is run and shut down by the xinetd network daemon service

Systemctl restart xinetd restarts the TFTP service

Systemctl enable xinetd boots to start the TFTP service

Modify the configuration file vim / etc/xinetd.d/tftp

Find this line disable = yes to change yes to no

Execute the restart service command systemctl restart xinetd again

Systemctl enable xinetd

The restart is correct and the configuration is correct.

Because the TFTP service program uses the UDP protocol by default and occupies a port number of 69, it is necessary to write its permanent permission policy in the firewall firewall.

Firewall-cmd-- add-port=69/udp-- permanent adds udp port and takes effect permanently

Firewall-cmd-reload prevents it from not working, overload firewall to make it work

Firewall-cmd-- list-all to view all configured policies

4, configure the SYSLinux service program

SYSLinux is a service program used to provide boot loading, and it can also be understood as the boot file needed by the client host.

Yum-y install syslinux installs SYSLinux service program

First, copy the boot file provided by SYSLinux to the default directory of the TFTP service program, which is the pxelinux.0 mentioned earlier, so that the client host can get the boot file smoothly.

In addition, there are boot files that need to be retrieved in the CD image. After confirming that the CD image has been mounted to the / media/cdrom directory, copy the required boot files to the default directory of the TFTP service program.

Cd / var/lib/tftpboot enters the default directory of the TFTP service program

Cp / usr/share/syslinux/pxelinux.0. Copy the boot files generated in the SYSLinux directory to the current directory

Cp / media/cdrom/images/pxeboot/ {vmlinuz,initrd.img}. Copy the boot files used in the CD image to the current directory

Cp / media/cdrom/isolinux/ {vesamenu.c32,boot.msg}. Copy the boot files used in the CD image to the current directory

Ls looks at the current directory to make sure that all the required boot files have been copied.

Create a pxelinux.cfg directory under the current directory with a suffix, but it is a directory, not a file.

Mkdir pxelinux.cfg mkdir is the command to create a directory

Copy the boot option menu from the system CD to the pxelinux.cfg directory and rename it to default.

/ media/cdrom/isolinux/isolinux.cfg pxelinux.cfg/default this file is the option selected by default when the client host is powered on

There are two options in the default boot menu, either to install the system or to verify the installation media. Now that we have decided to install the system unattended, we will no longer select the installation option manually, otherwise it will run counter to the purpose of this section.

Edit the default file you just copied

Vim pxelinux.cfg/default

The parameter on the first line of default linux is changed to linux, so that the option named linux will be executed by default when the system boots.

Line 64 of append initrd=initrd.img inst.stage2= ftp://192.168.13.10 ks= ftp://192.168.13.10/pub/ks.cfg quiet, we modify the default CD image installation mode to FTP file transfer mode

And specify the URL of the CD image and the path of the Kickstart response file.

5. Configure the vsftpd service program

Yum-y install vsftpd installs vsftpd service program

Systemctl restart vsftpd restarts the vsftpd service

Systemctl enable vsftpd boot up

Copy all the image files in the directory to the working directory of the vsftpd service program

Cp-r / media/cdrom/ / var/ftp/-r Recursive replication takes about 5 minutes, please wait patiently

Write an allow policy to make the FTP protocol permanent in the firewalld firewall management tool

Firewall-cmd-- add-service=ftp-- permanent adds ftp service policy and takes effect permanently

Firewall-cmd-- reload overload firewall

Release the FTP transmission in SELinux (that is, turn on the bool value related to the ftp transmission)

Setsebool-P ftpdconnectallunreserved on

Getsebool-a | grep ftpdconnectallunreserved to check whether it is enabled successfully

6, create the Kickstart answer file

PXE + Kickstart deploys a set of "unattended installation system service" instead of "unattended transmission system CD mirroring service", so we also need to enable the client host to obtain the CD image while automatically filling in the options that appear during the installation process.

Kickstart is not really a service program, but an answer file. Right! The Kickstart answer file contains the options and parameter information that need to be used in the system installation process, and the system can automatically call the contents of this answer file, thus completely realizing the unattended installation system.

In fact, in the root administrator's home directory, there is a file called anaconda-ks.cfg, which is the answer file.

Cp / root/anaconda-ks.cfg / var/ftp/pub/ks.cfg copy it to the working directory of vsftpd

Chmod + r / var/ftp/pub/ks.cfg chmod sets file permissions to ensure that everyone has readable permissions and that the client host can get the answer file and its contents.

Let's modify the configuration file of the answer file

Vim / var/ftp/pub/ks.cfg

Url-- Line 6 of url= ftp://192.168.13.10, change the installation method to FTP protocol, and fill in the IP address of the FTP server carefully

Timezone Asia/Shanghai-line 21 of isUtc with time zone set to Asia / Shanghai (Asia/Shanghai)

Clearpart-- all-- initabel line 29, the disk option is set to clear all disk contents and initialize the disk

At this point, our unattended service system is configured and begins to be configured.

7, automatically configure client hosts

A > Open the New Virtual Machine Wizard, select typical, and click next

B > Select "install the operating system later" and click "next"

C > set the client operating system to Red Hat Enterprise Linux 7 64 bit, and then click the next button

D > Select the installation location and click the "next" button

E > specify the disk capacity. The disk size defaults to "20GB". Click "next" button.

F > Select the custom hardware, set the Network Adapter device to Host-only Mode as well (this step is very important), and then click OK

Then boot, do not need to do any manual operation, all automatic transmission installation, the following operation is successful.

The first time to send a technical article, if there is anything wrong, please forgive me, comments pointed out, thank you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report