Build a PXE network installation server and install the CentOS operating system on the newly purchased bare metal of 10 servers. >The newly installed system is a minimal installation, and the default language is "Chinese". >Manually configure the YUM warehouse for the newly installed system, roo"/> Build a PXE network installation server and install the CentOS operating system on the newly purchased bare metal of 10 servers. >The newly installed system is a minimal installation, and the default language is "Chinese". >Manually configure the YUM warehouse for the newly installed system, roo">
search
HomeSystem TutorialLINUXLinux kernel, initialization file, installation source, boot menu, menu

lab environment

As a company's business continues to develop, the number of server hosts has also dropped rapidly. For function changes or newly purchased servers, the CentOS7 operating system needs to be reinstalled. In order to improve the efficiency of server installation, it is required to implement full manual wireless operation based on PXE network. Manned batch installation.

Description of Requirement

>The IP address of the server is "192.168.184.101", and the public network it is located on is "192.168.184.0/24".

>Build a PXE network installation server and install the CentOS operating system on the newly purchased bare metal of 10 servers.

>The newly installed system is a minimal installation, and the default language is "Chinese".

> Manually configure the YUM warehouse for the newly installed system, and set the root password to "abc.123".

11.3.1 Build a PXE remote installation server

The PXE remote installation server in this example integrates CentOS7 installation source, TFTP service, and DHCP service to send PXE boot program, Linux kernel, boot menu and other data to the customer's bare machine, as well as provide installation files.

1. Plan to install CentOS7 source

The network installation source of CentOS7 is usually released through HTTP or FTP contracts. It also supports NFS (Network File System) contracts. Please refer to other information for the configuration of NFS, which will not be discussed here.

For example, if you use an FTP contract to publish the installation source, you can deploy a YUM software warehouse on the server.

[root@node01 centos7]# mount /dev/cdrom /mnt/
[root@node01 ~]# mkdir /var/ftp/centos7
[root@node01 ~]# cp -rf /mnt/* /var/ftp/centos7/
[root@node01 ~]# systemctl start vsftpd

批量安装linux_批量安装linux系统_批量安装windows10

批量安装linux_批量安装windows10_批量安装linux系统

2. Install and enable TFTP service

The TFTP service is provided by the tftp-server software package. The configuration file is located in /etc/xinetd.d/tftp. When configuring, just change "disable=yes" to "disable=no" and then start the TFTP service.

[root@node01 ~]# yum -y install tftp-server
[root@node01 ~]# vim /etc/xinetd.d/tftp
[root@node01 ~]# systemctl start tftp
[root@node01 ~]# systemctl enable tftp

批量安装linux_批量安装windows10_批量安装linux系统

批量安装linux_批量安装linux系统_批量安装windows10

批量安装linux_批量安装windows10_批量安装linux系统

3. Prepare the Linux kernel and initialize the image file

For the Linux kernel used for PXE network installation, the initialization image files can be obtained from the CentOS7 system CD, which are vmlinuz and initrd, img, located in the folder images/pxeboot. Find these two files and copy them to the root directory of the tftp service.

[root@node01 ~]# cd /mnt/images/pxeboot/
[root@node01 pxeboot]# cp vmlinuz initrd.img /var/lib/tftpboot/

4.打算PXE引导程序、启动菜单文件

用于PXE网路安装的引导程序为pxelinux.0,由软件包syslinux提供。安装好软件包syslinux,然后将文件pxelinux.0也复制到tftp服务的根目录下。

[root@node01 ~]# yum -y install syslinux
[root@node01 ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

批量安装linux系统_批量安装windows10_批量安装linux

启动菜单拿来指导顾客机的引导过程,包括怎样调用内核,怎么加载初始化镜像。默认的启动菜单文件为defaultlinux学习视频,应放置在tftp根目录的pxelinux.ctg子目录下,典型的启动菜单配置可参考以下操作自动构建。

[root@node01 ~]# mkdir /var/lib/tftpboot/pxelinux.cfg
[root@node01 ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
default auto //指定默认入口名称
prompt 1 //1表示等待用户控制
label auto
 kernel vmlinuz
 append initrd=initrd.img method=ftp://192.168.184.101/centos7
label linux text
 kernel vmlinuz
 append text initrd=initrd.img method=ftp://192.168.184.101/centos7
 
label linux rescue
 kernel vmlinuz
 append rescue initrd=initrd.img method=ftp://192.168.184.101/centos7

批量安装windows10_批量安装linux系统_批量安装linux

上述配置记录中定义了三个引导入口,分别为图形安装(默认)、文本安装、救援模式。其中,prompt拿来设置是否等待用户选择;label拿来定义并分隔启动项;kernel和append拿来定义引导参数。引导入口的个数及内容依照须要自行定义。诸如,实现无人值守安装时只须要一个入口就够了。

5.安装并启用DHCP服务

因为PXE顾客机一般是仍未装系统的裸机,因而为了与服务器取得联系并正确下载相关引导文件,须要预先配置好DHCP服务来手动分配地址并告知引导文件位置。如PXE服务器的IP地址为192.168.184.101,DHCP地址池为192.168.8.150~192.168.8.200.则可以参考以下操作来搭建DHCP服务器。

[root@node01 ~]# yum -y install dhcp
[root@node01 ~]# vim /etc/dhcp/dhcpd.conf
subnet 192.168.184.0 netmask 255.255.255.0 {
 range 192.168.184.150 192.168.184.200;
 option domain-name-servers 202.96.128.86;
 option domain-name "bdqn.com";
 option routers 192.168.184.2;
 option broadcast-address 192.168.184.255;
 default-lease-time 21600;
 max-lease-time 43200;
 next-server 192.168.184.101;//指定TFTP服务器的地址
 filename "pxelinux.0";//指定PXE引导程序的文件名
}
[root@node01 ~]# systemctl start dhcpd
[root@node01 ~]# systemctl enable dhcpd

批量安装linux系统_批量安装linux_批量安装windows10

批量安装linux_批量安装linux系统_批量安装windows10

从上述过程可以见到,与通常DHCP服务不同的是,配置文件中降低了netx-server和filename这两行记录,分别拿来指定TFTP服务器的地址和PXE引导程序的文件名。

11.3.2验证PXE网路安装

搭建好PXE远程安装服务器之后,就可以使用顾客机进行安装测试了。对于新订购的服务器或PC裸机,通常不须要额外设置:若要为已有系统的主机重装系统,则可能须要更改BIOS设置,将“BootFirst”设为“NETWORK”或“LAN”,之后重启主机;若使用VMware创建的虚拟机进行测试,虚拟机显存起码须要2GB,否则在启动安装时会报错。

假如服务器配置正确,网路联接、PXE支持等都没有问题,则顾客机重启后将手动配置IP地址,之后从TFTP服务器中获取引导程序pxelinux.0,并按照引导菜单配置提示用户指定启动入口,如图中所示。

PXE网路安装的引导菜单

批量安装linux_批量安装windows10_批量安装linux系统

在提示字串“boot:”后直接按Enter键(或执行“auto”命令),将会步入默认的图形安装入口;若执行“linuxtext”命令,则步入文本安装入口;若执行“linuxrescue”命令,则步入搜救模式。

直接按Enter键确认后将手动通过网路下载安装文件,并步入图形安装程序界面,如图中所示。若才能成功抵达这一步批量安装linux,说明PXE网路安装基本成功。后续安装步骤与使用光碟的正常安装类似,这儿不再表述。

步入图形化安装配置程序

批量安装linux_批量安装linux系统_批量安装windows10

11.4实现Kickstart无人值守安装

上一节介绍了通过PXE技术远程安装CentOS7系统的方式,安装介质不再受限于光碟、移动硬碟等设备,大大增强了系统安装的灵活性.但是,安装期间仍须要自动选择语言,按键类型、指定安装源等一系列交互操作,当须要批量安装时十分不便捷。

批量安装linux_批量安装windows10_批量安装linux系统

本节将进一步学习怎样实现无人值守手动安装,通过使用Kickstart工具配置安装应答文件,自动完成安装过程中的各类设置,因而无须自动干预,提升网路装机效率。

11.4.1打算安装应答文件

在CentOS7系统中安装system-config-kickstart工具以后.即可通过图形化向导工具来配置安装应答文件,假如用户对手动应答文件的配置比较熟悉,也可以直接编辑CentOS7安装后手动创建的应答文件(/root/anaconda-ks.cfg),按照须要适当修订后使用。

1.配置安装应答参数

通过桌面菜单“应用程序”→“系统工具"→“Kickstart"即可打开“Kickstart配置程序”窗口。在“Kickstart配置程序”窗口中,可以针对基本配置、安装方式,引导装载程序选项,分区信息、网络配置等各类安装设置进行指定,如图中所示。

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

批量安装linux系统_批量安装windows10_批量安装linux

批量安装windows10_批量安装linux系统_批量安装linux

“Kickstart配置程序”窗口

批量安装linux_批量安装windows10_批量安装linux系统

1)基本配置及安装方式

“基本配置”可参考图中来指定,比如,将默认语言设为“中文(繁体)”,时区设为“Asia/Shanghai”,根口令设为“abc.123”,中级配置中勾选“安装后重启”。在“安装方式”界面中,应正确指定CentOS7的安装方式,如右图所示。若有用户验证信息也需一并指定。在“引导装载程序选项”界面中,选择安装新引导装载程序。

指定CentOS7的安装方式

批量安装linux_批量安装windows10_批量安装linux系统

2)分区信息

在“分区信息”界面中,需正确规划硬碟分区方案。诸如,可界定一个1024MB的/boot分区、2GB的swap分区,将剩余空间界定给根分区,如图中所示。

指定硬碟分区方案

批量安装windows10_批量安装linux系统_批量安装linux

3)网路配置及防火墙配置

在“网络配置”界面中,添加一个网路设备“ens33”,将网路类型设为“DHCP”。

在“防火墙配置”界面中,可以选择禁用SELinux、禁用防火墙。

批量安装linux_批量安装linux系统_批量安装windows10

4)软件包选择

CentOS7系统开始不再提供软件包的选择,如图中所示,假如须要安装软件包,可以按照需要将/root/anaconda-ks.cfg的软件包安装脚本复制到ks.cfg文件中,只须要复制%packages到%end部份即可,在%packages到%end之间,包含以@开头的软件包列表,将不须要的软件名删掉,剩下的就是系统会手动安装的软件包。诸如,仅保留以下内容即为采用最小化安装。

以下操作将在完成脚本保存后再进行

[root@node01 ~]# vim anaconda-ks.cfg//将以下内容复制到 [root@node01 ~]# vim ks.cfg
%packages
@^gnome-desktop-environment
@base
@compat-libraries
@core
@desktop-debugging
@development
@dial-up
@directory-client
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@input-methods
@internet-browser
@java-platform
@multimedia
@network-file-system-client
@networkmanager-submodules
@print-client
@x11
chrony
%end

批量安装windows10_批量安装linux_批量安装linux系统

5)安装脚本

在“预安装脚本”界面、“安装后脚本”界面中,可以分别添加在安装前,安装后手动运行的可执行句子。此项设置使服务器的手动化配置显得愈发容易,比如,可以使顾客机在完成安装后手动设置YUM软件库房批量安装linux,如图中所示,须要注意的是,应确保所编撰的代码才能正确执行,以免安装失败。

6)其他信息

若没有特殊需求,在“验证”界面、“显示配置”界面中,保持默认设置就可以了。

rm -f /etc/yum.repos.d/*
echo -e '[base]nname=CentOS7.3nbaseurl=ftp://192.168.184.101/centos7nenabled=1ngpgcheck=1ngpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7'>/etc/yum.repos.d/centos7.repo

批量安装linux系统_批量安装linux_批量安装windows10

2.保存手动应答文件

选择“Kickstart配置程序”窗口的“文件“→“保存”命令,指定目标文件夹、文件名,将配置好的应答参数保存为文本文件,如/root/ks.ctg。之后若要更改此应答配置,可以在“Kickstart配置程序”窗口中打开进行调整,或则直接用Vl等文本编辑工具进行更改。

点左上角文件>保存

批量安装linux系统_批量安装windows10_批量安装linux

批量安装linux系统_批量安装linux_批量安装windows10

批量安装windows10_批量安装linux_批量安装linux系统

11.4.2实现批量手动装机

有了手动安装的应答文件以后,只要将其放置PXE安装服务器的FTP目录下,并适当更改引导菜单,就可以实现基于网路的批量手动装机了。

1.启用手动应答文件

在PXE远程安装服务器中,将上一节构建的应答文件复制到/var/ftp/centos7目录下,使顾客机才能通过ftp://192.168.184.101/centos7/ks.cfg访问:之后编辑引导菜单文件default,添加ks引导参数以指定ks.cfg应答文件的URL路径。

[root@node01 ~]# cp /root/ks.cfg /var/ftp/ks.cfg
[root@node01 ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
default auto
prompt 0//0表示不等待用户控制
label auto
 kernel vmlinuz
 append initrd=initrd.img method=ftp://192.168.184.101/centos7
ks=ftp://192.168.184.101/ks.cfg//新加入的内容,指定ks.cfg应答文件的URL路径
label linux text
 kernel vmlinuz
 append text initrd=initrd.img method=ftp://192.168.184.101/centos7
label linux rescue
 kernel vmlinuz
 append rescue initrd=initrd.img method=ftp://192.168.184.101/centos7

批量安装linux_批量安装windows10_批量安装linux系统

2.验证无人值守安装

启用手动应答安装以后,当顾客机每次以PXE方法引导时,将手动下载ks.cfg应答配置文件,之后按照其中的设置安装CentOS7系统,而无须手工干预,如图中所示,这样就可以同时为多台顾客机安装系统了。

顾客机安装完成之后,检测其YUM软件库房配置linux操作系统培训,可以发觉早已根据“安装后脚本”的设置手动构建了/etc/yum.repos.d/centos7.repo文件。

批量安装windows10_批量安装linux系统_批量安装linux

批量安装linux_批量安装windows10_批量安装linux系统

The above is the detailed content of Linux kernel, initialization file, installation source, boot menu, menu. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What are the main tasks of a Linux system administrator?What are the main tasks of a Linux system administrator?Apr 19, 2025 am 12:23 AM

The main tasks of Linux system administrators include system monitoring and performance tuning, user management, software package management, security management and backup, troubleshooting and resolution, performance optimization and best practices. 1. Use top, htop and other tools to monitor system performance and tune it. 2. Manage user accounts and permissions through useradd commands and other commands. 3. Use apt and yum to manage software packages to ensure system updates and security. 4. Configure a firewall, monitor logs, and perform data backup to ensure system security. 5. Troubleshoot and resolve through log analysis and tool use. 6. Optimize kernel parameters and application configuration, and follow best practices to improve system performance and stability.

Is it hard to learn Linux?Is it hard to learn Linux?Apr 18, 2025 am 12:23 AM

Learning Linux is not difficult. 1.Linux is an open source operating system based on Unix and is widely used in servers, embedded systems and personal computers. 2. Understanding file system and permission management is the key. The file system is hierarchical, and permissions include reading, writing and execution. 3. Package management systems such as apt and dnf make software management convenient. 4. Process management is implemented through ps and top commands. 5. Start learning from basic commands such as mkdir, cd, touch and nano, and then try advanced usage such as shell scripts and text processing. 6. Common errors such as permission problems can be solved through sudo and chmod. 7. Performance optimization suggestions include using htop to monitor resources, cleaning unnecessary files, and using sy

What is the salary of Linux administrator?What is the salary of Linux administrator?Apr 17, 2025 am 12:24 AM

The average annual salary of Linux administrators is $75,000 to $95,000 in the United States and €40,000 to €60,000 in Europe. To increase salary, you can: 1. Continuously learn new technologies, such as cloud computing and container technology; 2. Accumulate project experience and establish Portfolio; 3. Establish a professional network and expand your network.

What is the main purpose of Linux?What is the main purpose of Linux?Apr 16, 2025 am 12:19 AM

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

Does the internet run on Linux?Does the internet run on Linux?Apr 14, 2025 am 12:03 AM

The Internet does not rely on a single operating system, but Linux plays an important role in it. Linux is widely used in servers and network devices and is popular for its stability, security and scalability.

What are Linux operations?What are Linux operations?Apr 13, 2025 am 12:20 AM

The core of the Linux operating system is its command line interface, which can perform various operations through the command line. 1. File and directory operations use ls, cd, mkdir, rm and other commands to manage files and directories. 2. User and permission management ensures system security and resource allocation through useradd, passwd, chmod and other commands. 3. Process management uses ps, kill and other commands to monitor and control system processes. 4. Network operations include ping, ifconfig, ssh and other commands to configure and manage network connections. 5. System monitoring and maintenance use commands such as top, df, du to understand the system's operating status and resource usage.

Boost Productivity with Custom Command Shortcuts Using Linux AliasesBoost Productivity with Custom Command Shortcuts Using Linux AliasesApr 12, 2025 am 11:43 AM

Introduction Linux is a powerful operating system favored by developers, system administrators, and power users due to its flexibility and efficiency. However, frequently using long and complex commands can be tedious and er

What is Linux actually good for?What is Linux actually good for?Apr 12, 2025 am 12:20 AM

Linux is suitable for servers, development environments, and embedded systems. 1. As a server operating system, Linux is stable and efficient, and is often used to deploy high-concurrency applications. 2. As a development environment, Linux provides efficient command line tools and package management systems to improve development efficiency. 3. In embedded systems, Linux is lightweight and customizable, suitable for environments with limited resources.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download

Atom editor mac version download

The most popular open source editor