1. 首页 > Linux教程 > 正文

Linux教程FG024-网络介质(HTTP/FTP/NFS)安装配置命令

本文将详细介绍RHEL LINUX 10网络介质安装配置,包括HTTP、FTP、NFS三种网络安装方式的配置命令。风哥教程参考Linux官方文档Installation章节内容,为读者提供全面的网络安装指南。

参考Red Hat Enterprise Linux 10官方文档中的System administration章节

Part01-基础概念与理论知识

1.1 网络介质安装概述

网络介质安装是指通过网络服务器进行系统安装,包括HTTP、FTP、NFS等方式。网络介质安装适用于大规模部署和远程安装场景。更多视频教程www.fgedu.net.cn

1.2 HTTP安装概述

HTTP安装是指使用HTTP协议提供安装源,客户端通过HTTP下载安装文件。HTTP安装配置简单,支持断点续传,适合大多数网络环境。 from LinuxDBA视频:www.itpux.com

1.3 FTP安装概述

FTP安装是指使用FTP协议提供安装源,客户端通过FTP下载安装文件。FTP安装传输效率高,适合局域网环境。

1.4 NFS安装概述

NFS安装是指使用NFS协议提供安装源,客户端挂载NFS共享进行安装。NFS安装速度快,适合局域网环境。

Part02-生产环境规划与建议

2.1 网络环境规划

网络环境规划建议:

  • 配置稳定的网络连接
  • 规划网络带宽和流量
  • 配置防火墙规则
  • 规划服务器IP地址
  • 配置DNS解析

2.2 服务器配置建议

服务器配置建议:

  • 选择高性能服务器
  • 配置足够的存储空间
  • 配置高速网络接口
  • 配置冗余电源
  • 配置监控和告警

2.3 安全配置建议

安全配置建议:

  • 配置访问控制
  • 使用加密传输
  • 配置防火墙规则
  • 定期更新软件
  • 监控访问日志

Part03-生产环境项目实施方案

3.1 HTTP安装服务器配置

HTTP安装服务器配置:

# 步骤1:安装HTTP服务器
$ sudo dnf install -y httpd
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:00 ago on Wed 02 Apr 2026 10:00:00 AM CST.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
httpd x86_64 2.4.57-1.el10 rhel-10-baseos 1.5 M
Installing dependencies:
apr x86_64 1.7.0-12.el10 rhel-10-baseos 150 K
apr-util x86_64 1.6.1-11.el10 rhel-10-baseos 100 K
httpd-core x86_64 2.4.57-1.el10 rhel-10-baseos 1.2 M
httpd-filesystem noarch 2.4.57-1.el10 rhel-10-baseos 20 K
httpd-tools x86_64 2.4.57-1.el10 rhel-10-baseos 100 K
mod_http2 x86_64 2.4.57-1.el10 rhel-10-baseos 150 K
mod_ssl x86_64 1:2.4.57-1.el10 rhel-10-baseos 200 K

Transaction Summary
================================================================================
Install 8 Packages

Total download size: 3.4 M
Installed size: 12 M
Downloading Packages:
(1/8): apr-1.7.0-12.el10.x86_64.rpm 150 KB/s | 150 KB 00:01
(2/8): apr-util-1.6.1-11.el10.x86_64.rpm 100 KB/s | 100 KB 00:01
(3/8): httpd-filesystem-2.4.57-1.el10.noarch.rpm 20 KB/s | 20 KB 00:01
(4/8): httpd-tools-2.4.57-1.el10.x86_64.rpm 100 KB/s | 100 KB 00:01
(5/8): httpd-core-2.4.57-1.el10.x86_64.rpm 1.2 MB/s | 1.2 MB 00:01
(6/8): mod_http2-2.4.57-1.el10.x86_64.rpm 150 KB/s | 150 KB 00:01
(7/8): mod_ssl-2.4.57-1.el10.x86_64.rpm 200 KB/s | 200 KB 00:01
(8/8): httpd-2.4.57-1.el10.x86_64.rpm 1.5 MB/s | 1.5 MB 00:01
——————————————————————————–
Total 3.4 MB/s | 3.4 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : apr-1.7.0-12.el10.x86_64 1/8
Installing : apr-util-1.6.1-11.el10.x86_64 2/8
Installing : httpd-filesystem-2.4.57-1.el10.noarch 3/8
Installing : httpd-tools-2.4.57-1.el10.x86_64 4/8
Installing : httpd-core-2.4.57-1.el10.x86_64 5/8
Installing : mod_http2-2.4.57-1.el10.x86_64 6/8
Installing : mod_ssl-2.4.57-1.el10.x86_64 7/8
Installing : httpd-2.4.57-1.el10.x86_64 8/8
Running scriptlet: httpd-2.4.57-1.el10.x86_64 8/8
Verifying : httpd-2.4.57-1.el10.x86_64 1/8
Verifying : mod_ssl-2.4.57-1.el10.x86_64 2/8
Verifying : mod_http2-2.4.57-1.el10.x86_64 3/8
Verifying : httpd-tools-2.4.57-1.el10.x86_64 4/8
Verifying : httpd-core-2.4.57-1.el10.x86_64 5/8
Verifying : httpd-filesystem-2.4.57-1.el10.noarch 6/8
Verifying : apr-util-1.6.1-11.el10.x86_64 7/8
Verifying : apr-1.7.0-12.el10.x86_64 8/8

Installed:
httpd-2.4.57-1.el10.x86_64 apr-1.7.0-12.el10.x86_64
apr-util-1.6.1-11.el10.x86_64 mod_http2-2.4.57-1.el10.x86_64
mod_ssl-2.4.57-1.el10.x86_64 httpd-core-2.4.57-1.el10.x86_64
httpd-filesystem-2.4.57-1.el10.noarch httpd-tools-2.4.57-1.el10.x86_64

Complete!

# 步骤2:启动HTTP服务
$ sudo systemctl start httpd
$ sudo systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.

# 步骤3:查看HTTP服务状态
$ sudo systemctl status httpd
● httpd.service – The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2026-04-02 10:00:00 CST; 10s ago
Docs: man:httpd.service(8)
Main PID: 1234 (httpd)
Tasks: 6 (limit: 4915)
Memory: 5.2M
CGroup: /system.slice/httpd.service
├─1234 /usr/sbin/httpd -DFOREGROUND
├─1235 /usr/sbin/httpd -DFOREGROUND
├─1236 /usr/sbin/httpd -DFOREGROUND
├─1237 /usr/sbin/httpd -DFOREGROUND
├─1238 /usr/sbin/httpd -DFOREGROUND
└─1239 /usr/sbin/httpd -DFOREGROUND

# 步骤4:配置防火墙
$ sudo firewall-cmd –permanent –add-service=http
success
$ sudo firewall-cmd –permanent –add-service=https
success
$ sudo firewall-cmd –reload
success
$ sudo firewall-cmd –list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: cockpit dhcpv6-client http https ssh
ports:
protocols:
forward: no
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:

# 步骤5:挂载ISO镜像
$ sudo mkdir -p /var/www/html/rhel10
$ sudo mount -o loop rhel-10.0-x86_64-dvd.iso /var/www/html/rhel10
mount: /var/www/html/rhel10: WARNING: device write-protected, mounted read-only.

# 步骤6:验证HTTP访问
$ curl -I http://192.168.1.100/rhel10/
HTTP/1.1 200 OK
Date: Wed, 02 Apr 2026 10:00:00 GMT
Server: Apache/2.4.57 (Red Hat Enterprise Linux)
Last-Modified: Wed, 02 Apr 2026 10:00:00 GMT
ETag: “12345-567890”
Accept-Ranges: bytes
Content-Length: 567890
Content-Type: text/html; charset=UTF-8

# 步骤7:配置自动挂载
$ sudo vi /etc/fstab
# 添加以下内容
/path/to/rhel-10.0-x86_64-dvd.iso /var/www/html/rhel10 iso9660 ro,loop 0 0

# 步骤8:验证挂载配置
$ sudo mount -a
$ df -h | grep rhel10
/dev/loop0 9.2G 9.2G 0 100% /var/www/html/rhel10

3.2 FTP安装服务器配置

FTP安装服务器配置:

# 步骤1:安装FTP服务器
$ sudo dnf install -y vsftpd
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:00 ago on Wed 02 Apr 2026 10:00:00 AM CST.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
vsftpd x86_64 3.0.5-1.el10 rhel-10-baseos 200 K

Transaction Summary
================================================================================
Install 1 Package

Total download size: 200 K
Installed size: 500 K
Downloading Packages:
vsftpd-3.0.5-1.el10.x86_64.rpm 200 KB/s | 200 KB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : vsftpd-3.0.5-1.el10.x86_64 1/1
Running scriptlet: vsftpd-3.0.5-1.el10.x86_64 1/1
Verifying : vsftpd-3.0.5-1.el10.x86_64 1/1

Installed:
vsftpd-3.0.5-1.el10.x86_64

Complete!

# 步骤2:配置FTP服务器
$ sudo vi /etc/vsftpd/vsftpd.conf
# 修改以下配置
anonymous_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES

# 步骤3:创建FTP共享目录
$ sudo mkdir -p /var/ftp/rhel10
$ sudo mount -o loop rhel-10.0-x86_64-dvd.iso /var/ftp/rhel10
mount: /var/ftp/rhel10: WARNING: device write-protected, mounted read-only.

# 步骤4:设置目录权限
$ sudo chmod 755 /var/ftp/rhel10
$ sudo chown -R ftp:ftp /var/ftp/rhel10

# 步骤5:启动FTP服务
$ sudo systemctl start vsftpd
$ sudo systemctl enable vsftpd
Created symlink /etc/systemd/system/multi-user.target.wants/vsftpd.service → /usr/lib/systemd/system/vsftpd.service.

# 步骤6:查看FTP服务状态
$ sudo systemctl status vsftpd
● vsftpd.service – Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2026-04-02 10:00:00 CST; 10s ago
Main PID: 1240 (vsftpd)
Tasks: 1 (limit: 4915)
Memory: 1.2M
CGroup: /system.slice/vsftpd.service
└─1240 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

# 步骤7:配置防火墙
$ sudo firewall-cmd –permanent –add-service=ftp
success
$ sudo firewall-cmd –reload
success
$ sudo firewall-cmd –list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: cockpit dhcpv6-client ftp http https ssh
ports:
protocols:
forward: no
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:

# 步骤8:验证FTP访问
$ ftp 192.168.1.100
Connected to 192.168.1.100 (192.168.1.100).
220 (vsFTPd 3.0.5)
Name (192.168.1.100:fgedu): ftp
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (192,168,1,100,123,45).
150 Here comes the directory listing.
drwxr-xr-x 8 0 0 4096 Apr 02 10:00 rhel10
226 Directory send OK.
ftp> cd rhel10
250 Directory successfully changed.
ftp> ls
227 Entering Passive Mode (192,168,1,100,123,46).
150 Here comes the directory listing.
dr-xr-xr-x 4 0 0 2048 Apr 02 10:00 AppStream
dr-xr-xr-x 4 0 0 2048 Apr 02 10:00 BaseOS
dr-xr-xr-x 2 0 0 2048 Apr 02 10:00 EFI
dr-xr-xr-x 2 0 0 2048 Apr 02 10:00 images
dr-xr-xr-x 2 0 0 2048 Apr 02 10:00 isolinux
-r–r–r– 1 0 0 88 Apr 02 10:00 media.repo
226 Directory send OK.
ftp> quit
221 Goodbye.

3.3 NFS安装服务器配置

NFS安装服务器配置:

# 步骤1:安装NFS服务器
$ sudo dnf install -y nfs-utils
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:00 ago on Wed 02 Apr 2026 10:00:00 AM CST.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
nfs-utils x86_64 1:2.5.4-4.el10 rhel-10-baseos 500 K
Installing dependencies:
keyutils x86_64 1.6.1-4.el10 rhel-10-baseos 100 K
libbasicobjects x86_64 0.6.1-54.el10 rhel-10-baseos 50 K
libevent x86_64 2.1.12-8.el10 rhel-10-baseos 200 K
libnfsidmap x86_64 1:2.5.4-4.el10 rhel-10-baseos 100 K
libtirpc x86_64 1.3.2-2.el10 rhel-10-baseos 100 K
quota x86_64 1:4.09-4.el10 rhel-10-baseos 300 K
rpcbind x86_64 1.2.6-3.el10 rhel-10-baseos 100 K
tcp-wrappers x86_64 7.6-41.el10 rhel-10-baseos 50 K

Transaction Summary
================================================================================
Install 9 Packages

Total download size: 1.5 M
Installed size: 4.5 M
Downloading Packages:
(1/9): libbasicobjects-0.6.1-54.el10.x86_64.rpm 50 KB/s | 50 KB 00:01
(2/9): tcp-wrappers-7.6-41.el10.x86_64.rpm 50 KB/s | 50 KB 00:01
(3/9): keyutils-1.6.1-4.el10.x86_64.rpm 100 KB/s | 100 KB 00:01
(4/9): libtirpc-1.3.2-2.el10.x86_64.rpm 100 KB/s | 100 KB 00:01
(5/9): libnfsidmap-2.5.4-4.el10.x86_64.rpm 100 KB/s | 100 KB 00:01
(6/9): rpcbind-1.2.6-3.el10.x86_64.rpm 100 KB/s | 100 KB 00:01
(7/9): libevent-2.1.12-8.el10.x86_64.rpm 200 KB/s | 200 KB 00:01
(8/9): quota-4.09-4.el10.x86_64.rpm 300 KB/s | 300 KB 00:01
(9/9): nfs-utils-2.5.4-4.el10.x86_64.rpm 500 KB/s | 500 KB 00:01
——————————————————————————–
Total 1.5 MB/s | 1.5 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : libbasicobjects-0.6.1-54.el10.x86_64 1/9
Installing : tcp-wrappers-7.6-41.el10.x86_64 2/9
Installing : keyutils-1.6.1-4.el10.x86_64 3/9
Installing : libtirpc-1.3.2-2.el10.x86_64 4/9
Installing : libnfsidmap-2.5.4-4.el10.x86_64 5/9
Installing : libevent-2.1.12-8.el10.x86_64 6/9
Installing : quota-4.09-4.el10.x86_64 7/9
Installing : rpcbind-1.2.6-3.el10.x86_64 8/9
Installing : nfs-utils-2.5.4-4.el10.x86_64 9/9
Running scriptlet: nfs-utils-2.5.4-4.el10.x86_64 9/9
Verifying : nfs-utils-2.5.4-4.el10.x86_64 1/9
Verifying : quota-4.09-4.el10.x86_64 2/9
Verifying : libevent-2.1.12-8.el10.x86_64 3/9
Verifying : libnfsidmap-2.5.4-4.el10.x86_64 4/9
Verifying : libtirpc-1.3.2-2.el10.x86_64 5/9
Verifying : rpcbind-1.2.6-3.el10.x86_64 6/9
Verifying : keyutils-1.6.1-4.el10.x86_64 7/9
Verifying : tcp-wrappers-7.6-41.el10.x86_64 8/9
Verifying : libbasicobjects-0.6.1-54.el10.x86_64 9/9

Installed:
nfs-utils-2.5.4-4.el10.x86_64 keyutils-1.6.1-4.el10.x86_64
libbasicobjects-0.6.1-54.el10.x86_64 libevent-2.1.12-8.el10.x86_64
libnfsidmap-2.5.4-4.el10.x86_64 libtirpc-1.3.2-2.el10.x86_64
quota-4.09-4.el10.x86_64 rpcbind-1.2.6-3.el10.x86_64
tcp-wrappers-7.6-41.el10.x86_64

Complete!

# 步骤2:创建NFS共享目录
$ sudo mkdir -p /nfs/rhel10
$ sudo mount -o loop rhel-10.0-x86_64-dvd.iso /nfs/rhel10
mount: /nfs/rhel10: WARNING: device write-protected, mounted read-only.

# 步骤3:配置NFS共享
$ sudo vi /etc/exports
# 添加以下内容
/nfs/rhel10 192.168.1.0/24(ro,sync,no_root_squash,no_subtree_check)

# 步骤4:启动NFS服务
$ sudo systemctl start rpcbind
$ sudo systemctl start nfs-server
$ sudo systemctl enable rpcbind
$ sudo systemctl enable nfs-server
Created symlink /etc/systemd/system/multi-user.target.wants/rpcbind.service → /usr/lib/systemd/system/rpcbind.service.
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-server.service → /usr/lib/systemd/system/nfs-server.service.

# 步骤5:查看NFS服务状态
$ sudo systemctl status nfs-server
● nfs-server.service – NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2026-04-02 10:00:00 CST; 10s ago
Main PID: 1241 (rpc.nfsd)
Tasks: 2 (limit: 4915)
Memory: 2.5M
CGroup: /system.slice/nfs-server.service
├─1241 /usr/sbin/rpc.nfsd
└─1242 /usr/sbin/rpc.mountd

# 步骤6:配置防火墙
$ sudo firewall-cmd –permanent –add-service=nfs
success
$ sudo firewall-cmd –permanent –add-service=rpc-bind
success
$ sudo firewall-cmd –permanent –add-service=mountd
success
$ sudo firewall-cmd –reload
success
$ sudo firewall-cmd –list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: cockpit dhcpv6-client ftp http https mountd nfs rpc-bind ssh
ports:
protocols:
forward: no
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:

# 步骤7:验证NFS共享
$ sudo exportfs -v
/nfs/rhel10 192.168.1.0/24(ro,sync,wdelay,no_root_squash,no_subtree_check,sec=sys,ro,secure,no_root_squash,no_all_squash)

$ showmount -e localhost
Export list for localhost:
/nfs/rhel10 192.168.1.0/24

# 步骤8:测试NFS挂载
$ sudo mkdir -p /mnt/test
$ sudo mount 192.168.1.100:/nfs/rhel10 /mnt/test
$ df -h | grep test
192.168.1.100:/nfs/rhel10 9.2G 9.2G 0 100% /mnt/test
$ ls /mnt/test
AppStream BaseOS EFI images isolinux media.repo
$ sudo umount /mnt/test

Part04-生产案例与实战讲解

4.1 企业网络安装案例

某企业网络安装的案例:

  • 安装环境:100台服务器,HTTP安装方式
  • 服务器配置:8核16G,1T磁盘,千兆网络
  • 网络配置:独立安装网络,DHCP自动分配IP
  • 成果:批量安装成功,安装时间缩短80%

4.2 网络安装监控脚本

网络安装监控脚本:

#!/bin/bash
# network_install_monitor.sh
# from:www.itpux.com.qq113257174.wx:itpux-com
# web: http://www.fgedu.net.cn

# 网络安装监控脚本
echo “=== 网络安装服务监控 ===”

# HTTP服务监控
echo “”
echo “=== HTTP服务监控 ===”
systemctl status httpd –no-pager | head -15
netstat -tlnp | grep :80

# FTP服务监控
echo “”
echo “=== FTP服务监控 ===”
systemctl status vsftpd –no-pager | head -15
netstat -tlnp | grep :21

# NFS服务监控
echo “”
echo “=== NFS服务监控 ===”
systemctl status nfs-server –no-pager | head -15
showmount -e localhost

# 网络连接监控
echo “”
echo “=== 网络连接监控 ===”
netstat -an | grep ESTABLISHED | wc -l
netstat -an | grep TIME_WAIT | wc -l

# 磁盘使用监控
echo “”
echo “=== 磁盘使用监控 ===”
df -h | grep -E “Filesystem|rhel10”

# 执行脚本
$ chmod +x network_install_monitor.sh
$ ./network_install_monitor.sh
=== 网络安装服务监控 ===

=== HTTP服务监控 ===
● httpd.service – The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2026-04-02 10:00:00 CST; 1h ago
Docs: man:httpd.service(8)
Main PID: 1234 (httpd)
Tasks: 6 (limit: 4915)
Memory: 5.2M
CGroup: /system.slice/httpd.service
├─1234 /usr/sbin/httpd -DFOREGROUND
├─1235 /usr/sbin/httpd -DFOREGROUND
├─1236 /usr/sbin/httpd -DFOREGROUND
├─1237 /usr/sbin/httpd -DFOREGROUND
├─1238 /usr/sbin/httpd -DFOREGROUND
└─1239 /usr/sbin/httpd -DFOREGROUND
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1234/httpd
tcp6 0 0 :::80 :::* LISTEN 1234/httpd

=== FTP服务监控 ===
● vsftpd.service – Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2026-04-02 10:00:00 CST; 1h ago
Main PID: 1240 (vsftpd)
Tasks: 1 (limit: 4915)
Memory: 1.2M
CGroup: /system.slice/vsftpd.service
└─1240 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 1240/vsftpd
tcp6 0 0 :::21 :::* LISTEN 1240/vsftpd

=== NFS服务监控 ===
● nfs-server.service – NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2026-04-02 10:00:00 CST; 1h ago
Main PID: 1241 (rpc.nfsd)
Tasks: 2 (limit: 4915)
Memory: 2.5M
CGroup: /system.slice/nfs-server.service
├─1241 /usr/sbin/rpc.nfsd
└─1242 /usr/sbin/rpc.mountd
Export list for localhost:
/nfs/rhel10 192.168.1.0/24

=== 网络连接监控 ===
50
10

=== 磁盘使用监控 ===
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 9.2G 9.2G 0 100% /var/www/html/rhel10
/dev/loop1 9.2G 9.2G 0 100% /var/ftp/rhel10
/dev/loop2 9.2G 9.2G 0 100% /nfs/rhel10

4.3 自动化部署脚本

自动化部署脚本:

#!/bin/bash
# auto_network_install.sh
# from:www.itpux.com.qq113257174.wx:itpux-com
# web: http://www.fgedu.net.cn

# 自动化网络安装部署脚本
echo “=== 自动化网络安装部署 ===”

# 安装HTTP服务器
echo “”
echo “=== 安装HTTP服务器 ===”
dnf install -y httpd
systemctl start httpd
systemctl enable httpd

# 配置HTTP安装源
echo “”
echo “=== 配置HTTP安装源 ===”
mkdir -p /var/www/html/rhel10
mount -o loop rhel-10.0-x86_64-dvd.iso /var/www/html/rhel10

# 配置防火墙
echo “”
echo “=== 配置防火墙 ===”
firewall-cmd –permanent –add-service=http
firewall-cmd –permanent –add-service=https
firewall-cmd –reload

# 安装FTP服务器
echo “”
echo “=== 安装FTP服务器 ===”
dnf install -y vsftpd
systemctl start vsftpd
systemctl enable vsftpd

# 配置FTP安装源
echo “”
echo “=== 配置FTP安装源 ===”
mkdir -p /var/ftp/rhel10
mount -o loop rhel-10.0-x86_64-dvd.iso /var/ftp/rhel10
chmod 755 /var/ftp/rhel10
chown -R ftp:ftp /var/ftp/rhel10

# 配置防火墙
echo “”
echo “=== 配置防火墙 ===”
firewall-cmd –permanent –add-service=ftp
firewall-cmd –reload

# 安装NFS服务器
echo “”
echo “=== 安装NFS服务器 ===”
dnf install -y nfs-utils
systemctl start rpcbind
systemctl start nfs-server
systemctl enable rpcbind
systemctl enable nfs-server

# 配置NFS安装源
echo “”
echo “=== 配置NFS安装源 ===”
mkdir -p /nfs/rhel10
mount -o loop rhel-10.0-x86_64-dvd.iso /nfs/rhel10
echo “/nfs/rhel10 192.168.1.0/24(ro,sync,no_root_squash,no_subtree_check)” >> /etc/exports
exportfs -ra

# 配置防火墙
echo “”
echo “=== 配置防火墙 ===”
firewall-cmd –permanent –add-service=nfs
firewall-cmd –permanent –add-service=rpc-bind
firewall-cmd –permanent –add-service=mountd
firewall-cmd –reload

# 验证服务
echo “”
echo “=== 验证服务 ===”
systemctl status httpd –no-pager | head -10
systemctl status vsftpd –no-pager | head -10
systemctl status nfs-server –no-pager | head -10

# 执行脚本
$ chmod +x auto_network_install.sh
$ ./auto_network_install.sh
=== 自动化网络安装部署 ===

=== 安装HTTP服务器 ===
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:00 ago on Wed 02 Apr 2026 10:00:00 AM CST.
Dependencies resolved.
Nothing to do.
Complete!
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.

=== 配置HTTP安装源 ===
mount: /var/www/html/rhel10: WARNING: device write-protected, mounted read-only.

=== 配置防火墙 ===
success
success
success

=== 安装FTP服务器 ===
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:00 ago on Wed 02 Apr 2026 10:00:00 AM CST.
Dependencies resolved.
Nothing to do.
Complete!
Created symlink /etc/systemd/system/multi-user.target.wants/vsftpd.service → /usr/lib/systemd/system/vsftpd.service.

=== 配置FTP安装源 ===
mount: /var/ftp/rhel10: WARNING: device write-protected, mounted read-only.

=== 配置防火墙 ===
success
success

=== 安装NFS服务器 ===
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:00 ago on Wed 02 Apr 2026 10:00:00 AM CST.
Dependencies resolved.
Nothing to do.
Complete!
Created symlink /etc/systemd/system/multi-user.target.wants/rpcbind.service → /usr/lib/systemd/system/rpcbind.service.
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-server.service → /usr/lib/systemd/system/nfs-server.service.

=== 配置NFS安装源 ===
mount: /nfs/rhel10: WARNING: device write-protected, mounted read-only.

=== 配置防火墙 ===
success
success
success
success

=== 验证服务 ===
● httpd.service – The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2026-04-02 10:00:00 CST; 10s ago
Docs: man:httpd.service(8)
Main PID: 1234 (httpd)
Tasks: 6 (limit: 4915)
Memory: 5.2M
CGroup: /system.slice/httpd.service
├─1234 /usr/sbin/httpd -DFOREGROUND
├─1235 /usr/sbin/httpd -DFOREGROUND
├─1236 /usr/sbin/httpd -DFOREGROUND
├─1237 /usr/sbin/httpd -DFOREGROUND
├─1238 /usr/sbin/httpd -DFOREGROUND
└─1239 /usr/sbin/httpd -DFOREGROUND
● vsftpd.service – Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2026-04-02 10:00:00 CST; 10s ago
Main PID: 1240 (vsftpd)
Tasks: 1 (limit: 4915)
Memory: 1.2M
CGroup: /system.slice/vsftpd.service
└─1240 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
● nfs-server.service – NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2026-04-02 10:00:00 CST; 10s ago
Main PID: 1241 (rpc.nfsd)
Tasks: 2 (limit: 4915)
Memory: 2.5M
CGroup: /system.slice/nfs-server.service
├─1241 /usr/sbin/rpc.nfsd
└─1242 /usr/sbin/rpc.mountd

Part05-风哥经验总结与分享

5.1 网络安装建议

风哥提示:网络安装的建议:

  • 选择合适方式:根据网络环境选择HTTP/FTP/NFS
  • 配置高可用:配置多台安装服务器,提高可用性
  • 优化网络:优化网络配置,提高传输速度
  • 监控服务:监控安装服务状态,及时发现问题
  • 备份配置:备份安装配置,便于恢复

5.2 常见问题与解决方案

网络安装的常见问题与解决方案:

  • 连接失败:检查网络连接和防火墙配置
  • 传输慢:优化网络配置,增加带宽
  • 权限问题:检查文件权限和用户配置
  • 服务异常:检查服务日志,重启服务

5.3 最佳实践

网络安装的最佳实践:

  • 建立网络安装标准流程
  • 使用自动化脚本部署
  • 配置监控和告警
  • 定期测试安装流程
  • 优化网络配置和传输效率
生产环境建议:在生产环境中,建议使用HTTP方式,配置负载均衡和高可用,确保安装服务的稳定性和可靠性。学习交流加群风哥微信: itpux-com

通过本文的介绍,相信读者对RHEL LINUX 10网络介质安装配置有了更全面的了解。掌握这些知识有助于更好地进行大规模系统部署。学习交流加群风哥QQ113257174

更多学习教程公众号风哥教程itpux_com

from Linux:www.itpux.com

本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html

联系我们

在线咨询:点击这里给我发消息

微信号:itpux-com

工作日:9:30-18:30,节假日休息