In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you how to configure Linux for batch installation. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Project name: computer room PXE automatic batch assembly
Mission objective: there are a batch of computers (more than 200) in the computer room, which need to be installed with CentOS 7.5 operating system and Web services deployed. .
Completion time: delivery within 24 hours
Application scenarios:
1) XX School computer Room
2) Red Hat Certification examination Environment
3) deployment of enterprise cluster nodes
4) batch configuration of data center servers
Shell script
Project requirements:
Quickly install the CentOS7 operating system for a group of machines (such as bare metal)
Through a separate network (no other DHCP servers, turn off VMware's DHCP if necessary)
Organize a Word version of the experiment report for a rainy day.
Task analysis
Task 1: prepare a CentOS7 server
Task 2: provide DHCP services
Task 3: provide software package resources for clients (Web mode)
Task 4: provide files related to network startup (build TFTP startup server)
Task 5: test PXE network startup and installation
Task 6: provide automatic answer files (answer all kinds of questions during installation)
Task 7: client unattended installation test
TFTP, simple FTP Protocol (UDP 161)
FTP,TCP 21/20 .
Related knowledge: quick access to instructions / manuals for XX commands or configuration files
Man command name
Or
Man profile name
Run the XX command line in English environment
LANG= XX Command Line
Shell script, long foot (run by yourself) contains a lot of executable command line text files
Vim script file
.
Chmod + x script file
Related knowledge:
PXE, pre-boot environment (Pre-boot eXcute Environment)
-by default, it is integrated in the BOOTROM chip of the network card (pxeclient).
Additional preparation: PXE server (install system for client, provide system for client)
How to provide a server side of PXE batch installation:
1) DHCP service, which provides the IP address, tells the boot server where it is, and tells you to get a startup file
2) TFTP service, which provides startup kernel, startup configuration files, etc.
3) HTTP or FTP service, providing CentOS7 software package resources
4) configure automatic installation
Implement process task 1: prepare a CentOS7 server
1) configure the fixed hostname pxesvr and IP address 192.168.10.7 to 24
# hostnamectl set-hostname pxesvr
# nmcli connection modify ens33 ipv4.method manual ipv4.addresses 192.168.10.7/24 connection.autoconnect yes
# nmcli connection up ens33
2) disable the firewall and disable the SELinux protection mechanism
# systemctl disable firewalld-- now / / disable self-boot and stop immediately
Vim / etc/selinux/config
SELINUX=disabled
Setenforce 0
3) Mount the CentOS7 CD (if it is a virtual machine, connect the ISO file) to / mnt/dvd
Mkdir / mnt/dvd
# mount / dev/cdrom / mnt/dvd
4) use the / mnt/dvd directory as the temporary software source
Rm-rf / etc/yum.repos.d/*.repo
Yum-config-manager-- add file:///mnt/dvd
Vim / etc/yum.conf
Gpgcheck=0
Yum repolist
! If there is no network connection in the current host, you need to add the connection before configuring the address
1) find the name of the Nic device (such as ens33)
Nmcli device status
.. ..
2) add a connection to the network card ens33 (for example, also known as ens33)
Format: nmcli con add con-name connection name ifname network card name type ethernet
Nmcli connection add con-name ens33 ifname ens33 type ethernet
Within the Linux configuration file, the part that begins with # indicates a comment
Task 2: provide DHCP services
1) assign IP address related parameters to the client
2) tell the client which server to find next and get a network card startup file
! Comment mark # in the Linux system configuration file
! Disable other DHCP services in the work network (such as NAT) (such as VMware) to avoid conflicts
Yum-y install dhcp
Vim / etc/dhcp/dhcpd.conf
Subnet 192.168.10.0 netmask 255.255.255.0 {
Range 192.168.10.100 192.168.10.200
Next-server 192.168.10.7; / / tell the address of the next server (TFTP)
Filename "pxelinux.0"; / / tell the name of the startup file of the network card to be downloaded
}
Systemctl enable dhcpd-- now / / set self-boot and start immediately
Other configuration references:
# option routers default gateway address
# option domain-name-servers DNS server 1 address, DNS server 2 address
# default-lease-time 3600; / / default lease time
# max-lease-time 7200; / / maximum lease time
! DHCP service troubleshooting--
1) check the service status
Systemctl status dhcpd
The normal state should be green active (running)
Systemctl restart dhcpd
Job for dhcpd.service failed because the control process exited with error code. See "systemctl status dhcpd.service" and "journalctl-xe" for details. = "indicates that there is an error in the configuration file, or the local IP address network segment does not match.
2) learn what is wrong and what is wrong with the configuration file
Diary of vim / var/log/messages / / Linux server
.. .. Look forward from the last line
/ etc/dhcp/dhcpd.conf line 10: . / / Line 10 has a XX error
! The native test obtains the address in DHCP:
Dhclient-d ens33 / /-d indicates debug mode and does not really modify the address
.. ..
Bound to 192.168.10.X
.. ..
Press Ctrl + C to terminate the test
Task 3: provide software package resources for clients (Web mode)
1) install httpd package
Yum-y install httpd
2) deploy package resources
Mkdir / var/www/html/cos7dvd
Cp-r / mnt/dvd/* / var/www/html/cos7dvd
.. .. Please be patient and don't interrupt.
3) start httpd service
Systemctl enable httpd-now
Visit http://192.168.10.7/cos7dvd from the local browser and you can see the software resources page
! Web configuration (note if the virtual Web host was originally configured)
1) once the virtual host is enabled, the default ServerName and DocumentRoot are invalid
2) if the HTTP request submitted by the browser does not belong to any of the defined virtual hosts, then use the web page directory of the first virtual host as feedback
Vim / etc/httpd/conf.d/vhosts.conf / / insert the following in line 1
DocumentRoot / var/www/html
Systemctl enable httpd-now
Task 4: provide files related to network startup (build TFTP startup server)
1) the Nic startup file pxelinux.0
Provided by the package syslinux (/ usr/share/syslinux/pxelinux.0)
2) launch menu configuration pxelinux.cfg/default (configuration module file, background picture, etc.) ), load the CentOS7 system installer (vmlinuz, initrd.img)
Obtained from the CentOS7 CD directory isolinux/
Yum-y install tftp-server / / install TFTP service software
Yum-y install syslinux
Cp / usr/share/syslinux/pxelinux.0 / var/lib/tftpboot/ deployment startup file
Cp / mnt/dvd/isolinux/* / var/lib/tftpboot/ deployment supporting files
Cd / var/lib/tftpboot/
Mkdir pxelinux.cfg / / create a configuration directory
Cp isolinux.cfg pxelinux.cfg/default / / establish default menu configuration
Vim pxelinux.cfg/default
Find label linux, modify the append line below, and specify the source address of the package after inst.stage2=.
Append initrd=initrd.img inst.stage2= http://192.168.10.7/cos7dvd
Systemctl enable tftp-- now / / start the TFTP server
Test whether the TFTP resource is downloadable:
Cd / root
Yum-y install tftp
Tftp 192.168.10.7-c get pxelinux.0
Ls-lh pxelinux.0
Task 5: test PXE network startup and installation
1) create a new virtual machine (CentOS64 bits, memory > 2G)
2) Boot the virtual machine client from the network card
-DHCP gets the address automatically
-Connect to the TFTP server
-download pxelinux.0 startup file
-get menu configuration file pxelinux.cfg/default
3) see the installation menu = "Select to install Install CentOS7
-download vmlinuz and initrd.img
-run the kernel file, load the installer, make sure you can see the graphical language interface, …...
-manually specify the installation source http://192.168.10.7/cos7dvd
-the subsequent process is similar to CD installation, which allows you to shut down the virtual machine without completing the installation.
! If the memory of the client is too small, it is easy to crash the kernel when booting PXE.
Kernel panic kernel crash (panic)
Kickstart unattended / automatic answer Technology
Kick, kick
Start, start.
Shell script (text that can run / run by itself)
Kickstart unattended technology
Kick,start
Shell script, text with long feet (+ x)
Rm-rf / etc/yum.repos.d/*.repo
Echo'[development]
Name=CentOS7
Baseurl= http://192.168.10.7/cos7dvd/
Enabled=1
Gpgcheck=0' > / etc/yum.repos.d/centos7.repo
Task 6: provide automatic answer files (answer all kinds of questions during installation)
1) how to get the answer file
Vim / etc/yum.repos.d/.repo
[development] / / change the ID requirement of the source to development
Yum-y install system-config-kickstart
System-config-kickstart
Basic configuration: language, time zone, administrative password
Installation method: new installation, setting of HTTP installation source
Install the bootloader: install a new bootloader
Zoning: select the first of all three radio selections, add swap 2000m, / all remaining space
Network configuration: add a connection (DHCP)
Package selection: check all software classes except KDE under "Desktop"
For post-installation scripts, refer to the following:
Rm-rf / etc/yum.repos.d/.repo
Echo'[cos7dvd]
Name=added from: file:///mnt/dvd
Baseurl= http://192.168.10.7/cos7dvd
Enabled=1
Gpgcheck=0
'> / etc/yum.repos.d/cos7dvd.repo
Yum-y install httpd
Echo 'NTD1906' > / var/www/html/index.html
Wget http://192.168.10.7/Discuz_X3.4_SC_UTF8.zip
Unzip Discuz_X3.4_SC_UTF8.zip
Cp-rf upload/* / var/www/html/
Systemctl enable httpd
.. ..
-- Save to / root/ks.cfg
2) how to make the client use this answer file
Cp / root/ks.cfg / var/www/html/ks-cos7.cfg
Browsers access http://192.168.10.7/ks-cos7.cfg
Vim / var/lib/tftpboot/pxelinux.cfg/default
Find linux and modify the append line below
Delete the inst.stage2= section and replace it with the download address of the ks= answer file
Append initrd=initrd.img ks= http://192.168.10.7/ks-cos7.cfg
Task 7: client unattended installation test
1) create a new virtual machine (CentOS64 bits, memory > 2G)
2) Boot the virtual machine client from the network card
-DHCP gets the address automatically
-Connect to the TFTP server
-download pxelinux.0 startup file
-get menu configuration file pxelinux.cfg/default
3) see the installation menu = "Select to install CentOS7
-download vmlinuz and initrd.img
-run the kernel file, load the installer, make sure you can see the graphical language interface, …...
-automatically complete the installation process
Thank you for reading! This is the end of this article on "how to configure batch installation of Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.