目录
1、基础概念
1.1 YUM介绍
1.2 DNF介绍
1.3常用Linux版本介绍
2、YUM和DNF对比
2.1软件版本对比
2.2帮助内容对比
2.2.1 DNF帮助命令的输出
2.2.2 YUM帮助命令的输出
2.2.3对比结论
2.3软件仓库对比
2.4安装软件对比
2.4.1 YUM命令安装VSFTPD
2.4.2 DNF命令安装VSFTPD
2.4.3对比结论
2.5 DNF的优势
2.6 DNF的不足
3、YUM/DNF命令详解
4、配置软件仓库
4.1网络软件仓库
4.2本地软件仓库
4.3内网软件仓库服务器
4.4各系统本地软件仓库配置源文件
4.4.1 OEL8及以上版本
4.4.2 OEL7.9及以下版本
4.4.3 RHEL8及以上版本
4.4.4 RHEL7.9及以下版本
4.4.5 CentOS8及以上版本
4.4.6 CentOS7.9及以下版本
4,5各系统内网软件仓库配置源文件
4.5.1 OEL8及以上版本
4.5.2 OEL7.9及以下版本
4.5.3 RHEL8及以上版本
4.5.4 RHEL7.9及以下版本
4.5.5 CentOS8及以上版本
4.5.6 CentOS7.9及以下版本
1、基础概念
1.1 YUM介绍
YUM(全称为 Yellow dog Updater, Modified)是一个在Fedora和RHEL、CentOS、OEL中的Shell前端软件包管理器。
YUM本身基于RPM包管理,能够从指定的YUM源服务器(一个或多个)自动下载RPM包并且进行安装和更新,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。
要成功的使用 YUM 工具安装更新软件或系统,就需要有一个包含各种RPM软件包的repository(软件仓库),这个软件仓库我们习惯称为YUM源 (可以是本地源、网络源)。
就好像你要吃个回锅肉,只买肉回来肯定不行,你还得有油盐酱醋锅碗瓢盆等,传统的RPM安装方式就相当于你去超市一样一样的买全,而YUM则会在你买肉的同时把你所依赖的其他东西一次打包完成。
1.2 DNF介绍
DNF (全称为Dandified yum)是新一代的rpm软件包管理器,他首先出现在 Fedora 18 这个发行版中。而最近,它取代了yum,正式成为 Fedora 22 的包管理器。
DNF在RHEL、CentOS、OEL等系统中,从版本8开始出现,目前和YUM共存。
DNF克服了YUM包管理器的一些瓶颈,提升了包括用户体验,内存占用,依赖分析,运行速度等多方面的内容。
DNF使用Hawkey库,该库解析RPM依赖性以在客户端计算机上运行查询。 它们基于libsolv构建,libsolv是一种使用可满足性算法的程序包相关性求解器。 您可以在libsolv的GitHub存储库中找到有关该算法的更多详细信息。
1.3常用Linux版本介绍
类别 | 介绍 | 最新相同版本 | |
RHEL | RedHat Enterprise Linux操作系统 | RHEL8.5 | 4.18.0-348 |
CentOS | 源于RHEL依照开放源代码协定所释放的源代码编译而成(最近,传闻CentOS将沦落为RHEL和Fedora之间的过渡产品) | CentOS8-20220215 | 4.18.0-365 |
OEL | Oracle Enterprice Linux,源于RHEL操作系统,是Oracle公司专门针对Oracle自有的软件和硬件产品进行了大量优化而成 | OEL8.5 | 4.18.0-348 |
Fedora | Redhat公司赞助,Fedora项目社区开发,可以理解其实RHEL的上游源码平台或者测试平台 | / | / |
注:如上表,Fedora主要使用者为Linux爱好者,而在企业级应用中,通常使用RHEL、CentOS、OEL较为普遍,具体到Oracle的中间件、数据库系统的使用,建议使用OEL最佳。
具体到使用过程、命令等,RHEL、CentOS、OEL三者并无区别。
2、YUM和DNF对比
前提:以Oracle Enterprice Linux 8.5为环境,进行以下所有操作,如无特别说明,以下操作同样适用在Linux 7版本。
2.1软件版本对比
如下图,在同一个操作系统下面,DNF和YUM的版本相同,而且软件包的名字竟然都是DNF。
如此,我们也可以侧面确认,在Linux8之后,DNF是代替了YUM,但是YUM依然可以正常使用。
2.2帮助内容对比
2.2.1 DNF帮助命令的输出
[root@oracle21c ~]# dnf --help
usage: dnf [options] COMMAND
List of Main Commands:
alias List or create command aliases
autoremove remove all unneeded packages that were originally installed as dependencies
check check for problems in the packagedb
check-update check for available package upgrades
clean remove cached data
deplist [deprecated, use repoquery --deplist] List package's dependencies and what packages provide them
distro-sync synchronize installed packages to the latest available versions
downgrade Downgrade a package
group display, or use, the groups information
help display a helpful usage message
history display, or use, the transaction history
info display details about a package or group of packages
install install a package or packages on your system
list list a package or groups of packages
makecache generate the metadata cache
mark mark or unmark installed packages as installed by user.
module Interact with Modules.
provides find what package provides the given value
reinstall reinstall a package
remove remove a package or packages from your system
repolist display the configured software repositories
repoquery search for packages matching keyword
repository-packages run commands on top of all packages in given repository
search search package details for the given string
shell run an interactive DNF shell
swap run an interactive DNF mod for remove and install one spec
updateinfo display advisories about packages
upgrade upgrade a package or packages on your system
upgrade-minimal upgrade, but only 'newest' package match which fixes a problem that affects your system
List of Plugin Commands:
builddep Install build dependencies for package or spec file
changelog Show changelog data of packages
config-manager manage dnf configuration options and repositories
copr Interact with Copr repositories.
debug-dump dump information about installed rpm packages to file
debug-restore restore packages recorded in debug-dump file
debuginfo-install install debuginfo packages
download Download package to current directory
groups-manager create and edit groups metadata file
needs-restarting determine updated binaries that need restarting
playground Interact with Playground repository.
repoclosure Display a list of unresolved dependencies for repositories
repodiff List differences between two sets of repositories
repograph Output a full package dependency graph in dot format
repomanage Manage a directory of rpm packages
reposync download all packages from remote repo
General DNF options:
-c [config file], --config [config file]
config file location
-q, --quiet quiet operation
-v, --verbose verbose operation
--version show DNF version and exit
--installroot [path] set install root
--nodocs do not install documentations
--noplugins disable all plugins
--enableplugin [plugin]
enable plugins by name
--disableplugin [plugin]
disable plugins by name
--releasever RELEASEVER
override the value of $releasever in config and repo
files
--setopt SETOPTS set arbitrary config and repo options
--skip-broken resolve depsolve problems by skipping packages
-h, --help, --help-cmd
show command help
--allowerasing allow erasing of installed packages to resolve
dependencies
-b, --best try the best available package versions in
transactions.
--nobest do not limit the transaction to the best candidate
-C, --cacheonly run entirely from system cache, don't update cache
-R [minutes], --randomwait [minutes]
maximum command wait time
-d [debug level], --debuglevel [debug level]
debugging output level
--debugsolver dumps detailed solving results into files
--showduplicates show duplicates, in repos, in list/search commands
-e ERRORLEVEL, --errorlevel ERRORLEVEL
error output level
--obsoletes enables dnf's obsoletes processing logic for upgrade
or display capabilities that the package obsoletes for
info, list and repoquery
--rpmverbosity [debug level name]
debugging output level for rpm
-y, --assumeyes automatically answer yes for all questions
--assumeno automatically answer no for all questions
--enablerepo [repo] Enable additional repositories. List option. Supports
globs, can be specified multiple times.
--disablerepo [repo] Disable repositories. List option. Supports globs, can
be specified multiple times.
--repo [repo], --repoid [repo]
enable just specific repositories by an id or a glob,
can be specified multiple times
--enable enable repos with config-manager command
(automatically saves)
--disable disable repos with config-manager command
(automatically saves)
-x [package], --exclude [package], --excludepkgs [package]
exclude packages by name or glob
--disableexcludes [repo], --disableexcludepkgs [repo]
disable excludepkgs
--repofrompath [repo,path]
label and path to an additional repository to use
(same path as in a baseurl), can be specified multiple
times.
--noautoremove disable removal of dependencies that are no longer
used
--nogpgcheck disable gpg signature checking (if RPM policy allows)
--color COLOR control whether color is used
--refresh set metadata as expired before running the command
-4 resolve to IPv4 addresses only
-6 resolve to IPv6 addresses only
--destdir DESTDIR, --downloaddir DESTDIR
set directory to copy packages to
--downloadonly only download packages
--comment COMMENT add a comment to transaction
--bugfix Include bugfix relevant packages, in updates
--enhancement Include enhancement relevant packages, in updates
--newpackage Include newpackage relevant packages, in updates
--security Include security relevant packages, in updates
--advisory ADVISORY, --advisories ADVISORY
Include packages needed to fix the given advisory, in
updates
--bz BUGZILLA, --bzs BUGZILLA
Include packages needed to fix the given BZ, in
updates
--cve CVES, --cves CVES
Include packages needed to fix the given CVE, in
updates
--sec-severity {Critical,Important,Moderate,Low}, --secseverity {Critical,Important,Moderate,Low}
Include security relevant packages matching the
severity, in updates
--forcearch ARCH Force the use of an architecture
2.2.2 YUM帮助命令的输出
[root@oracle21c ~]# yum --help
usage: yum [options] COMMAND
List of Main Commands:
alias List or create command aliases
autoremove remove all unneeded packages that were originally installed as dependencies
check check for problems in the packagedb
check-update check for available package upgrades
clean remove cached data
deplist [deprecated, use repoquery --deplist] List package's dependencies and what packages provide them
distro-sync synchronize installed packages to the latest available versions
downgrade Downgrade a package
group display, or use, the groups information
help display a helpful usage message
history display, or use, the transaction history
info display details about a package or group of packages
install install a package or packages on your system
list list a package or groups of packages
makecache generate the metadata cache
mark mark or unmark installed packages as installed by user.
module Interact with Modules.
provides find what package provides the given value
reinstall reinstall a package
remove remove a package or packages from your system
repolist display the configured software repositories
repoquery search for packages matching keyword
repository-packages run commands on top of all packages in given repository
search search package details for the given string
shell run an interactive YUM shell
swap run an interactive YUM mod for remove and install one spec
updateinfo display advisories about packages
upgrade upgrade a package or packages on your system
upgrade-minimal upgrade, but only 'newest' package match which fixes a problem that affects your system
List of Plugin Commands:
builddep Install build dependencies for package or spec file
changelog Show changelog data of packages
config-manager manage yum configuration options and repositories
copr Interact with Copr repositories.
debug-dump dump information about installed rpm packages to file
debug-restore restore packages recorded in debug-dump file
debuginfo-install install debuginfo packages
download Download package to current directory
groups-manager create and edit groups metadata file
needs-restarting determine updated binaries that need restarting
playground Interact with Playground repository.
repoclosure Display a list of unresolved dependencies for repositories
repodiff List differences between two sets of repositories
repograph Output a full package dependency graph in dot format
repomanage Manage a directory of rpm packages
reposync download all packages from remote repo
General YUM options:
-c [config file], --config [config file]
config file location
-q, --quiet quiet operation
-v, --verbose verbose operation
--version show YUM version and exit
--installroot [path] set install root
--nodocs do not install documentations
--noplugins disable all plugins
--enableplugin [plugin]
enable plugins by name
--disableplugin [plugin]
disable plugins by name
--releasever RELEASEVER
override the value of $releasever in config and repo
files
--setopt SETOPTS set arbitrary config and repo options
--skip-broken resolve depsolve problems by skipping packages
-h, --help, --help-cmd
show command help
--allowerasing allow erasing of installed packages to resolve
dependencies
-b, --best try the best available package versions in
transactions.
--nobest do not limit the transaction to the best candidate
-C, --cacheonly run entirely from system cache, don't update cache
-R [minutes], --randomwait [minutes]
maximum command wait time
-d [debug level], --debuglevel [debug level]
debugging output level
--debugsolver dumps detailed solving results into files
--showduplicates show duplicates, in repos, in list/search commands
-e ERRORLEVEL, --errorlevel ERRORLEVEL
error output level
--obsoletes enables yum's obsoletes processing logic for upgrade
or display capabilities that the package obsoletes for
info, list and repoquery
--rpmverbosity [debug level name]
debugging output level for rpm
-y, --assumeyes automatically answer yes for all questions
--assumeno automatically answer no for all questions
--enablerepo [repo] Enable additional repositories. List option. Supports
globs, can be specified multiple times.
--disablerepo [repo] Disable repositories. List option. Supports globs, can
be specified multiple times.
--repo [repo], --repoid [repo]
enable just specific repositories by an id or a glob,
can be specified multiple times
--enable enable repos with config-manager command
(automatically saves)
--disable disable repos with config-manager command
(automatically saves)
-x [package], --exclude [package], --excludepkgs [package]
exclude packages by name or glob
--disableexcludes [repo], --disableexcludepkgs [repo]
disable excludepkgs
--repofrompath [repo,path]
label and path to an additional repository to use
(same path as in a baseurl), can be specified multiple
times.
--noautoremove disable removal of dependencies that are no longer
used
--nogpgcheck disable gpg signature checking (if RPM policy allows)
--color COLOR control whether color is used
--refresh set metadata as expired before running the command
-4 resolve to IPv4 addresses only
-6 resolve to IPv6 addresses only
--destdir DESTDIR, --downloaddir DESTDIR
set directory to copy packages to
--downloadonly only download packages
--comment COMMENT add a comment to transaction
--bugfix Include bugfix relevant packages, in updates
--enhancement Include enhancement relevant packages, in updates
--newpackage Include newpackage relevant packages, in updates
--security Include security relevant packages, in updates
--advisory ADVISORY, --advisories ADVISORY
Include packages needed to fix the given advisory, in
updates
--bz BUGZILLA, --bzs BUGZILLA
Include packages needed to fix the given BZ, in
updates
--cve CVES, --cves CVES
Include packages needed to fix the given CVE, in
updates
--sec-severity {Critical,Important,Moderate,Low}, --secseverity {Critical,Important,Moderate,Low}
Include security relevant packages matching the
severity, in updates
--forcearch ARCH Force the use of an architecture
[root@oracle21c ~]#
2.2.3对比结论
从上面DNF和YUM帮助命令的输出可以看出,两者的区别很小,使用方法大致相同,常用命令并无区别。
2.3软件仓库对比
前提:创建/mount目录,把光盘镜像文件挂载在这个目录。然后在/etc/yum.repo.d/目录下移除所有系统自带YUM/DNF源(软件仓库)配置文件,创建本地YUM/DNF源(软件仓库)配置文件(后面章节详细介绍)。
如下图,DNF和YUM命令所列出的YUM/DNF源相同。
如下图,清除缓存中的RPM软件包列表,重新获取缓存,YUM和DNF的操作相同,结果也相同。
如下图,我们把YUM/DNF源配置文件移除,清除缓存之后,YUM/DNF都无法获取软件仓库源的配置文件信息。
如此,我们可以确认,DNF在软件仓库方面的配置和使用,和YUM并无任何区别。
2.4安装软件对比
2.4.1 YUM命令安装VSFTPD
2.4.2 DNF命令安装VSFTPD
前提,使用YUM命令卸载软件包。
2.4.3对比结论
如上面YUM和DNF命令输出结果来看,没有任何差别。
2.5 DNF的优势
- DNF使用C语言库hawkey进行软件包依赖关系解析,从而大幅度提升包管理操作效率
- DNF降低了内存消耗,从而提升用户体验。
- DNF如果配置和启用的库没有响应,DNF将跳过它并使用可用的repos继续事务,而不会像YUM,如果配置库不可用,YUM将立即停止工作。
2.6 DNF的不足
DNF 包管理器作为 YUM 包管理器的升级替代品,它能自动完成更多的操作,但不足之处还是有的,举例如下:
- 在 DNF 中没有 –skip-broken 命令,并且没有替代命令供选择。
- 在 DNF 中没有判断哪个包提供了指定依赖的 resolvedep 命令。
- 在 DNF 中没有用来列出某个软件依赖包的 deplist 命令。
- 当你在 DNF 中排除了某个软件库,那么该操作将会影响到你之后所有的操作,不像在 YUM 下那样,你的排除操作只会咋升级和安装软件时才起作用。
3、YUM/DNF命令详解
前提:下面的内容主要体现DNF命令操作,如无特别说明,YUM命令同样适用。
查看系统中可用的软件仓库
# dnf repolist
查看系统中可用和不可用的所有的软件仓库
# dnf repolist all
- 列出软件仓库中的所有RPM软件包
# dnf list
- 列出软件仓库中所有已安装的 RPM软件包
# dnf list installed
- 列出软件仓库中所有可供安装的RPM软件包
# dnf list available
- 搜索软件仓库中的RPM软件包
# dnf search vsftpd
- 查找某一文件的提供者
# dnf provides vsftpd
- 查看软件包详情
# dnf info vsftpd
- 安装软件包及其依赖的其他软件包
# dnf install vsftpd
# dnf install vsftpd -y
- 删除软件包
# dnf remove vsftpd
- 删除无用孤立的软件包
# dnf autoremove
- 删除缓存的无用软件包
# dnf clean all
- 获取有关某条命令的使用帮助
# dnf help clean
- 获取软件仓库中的软件包列表到缓存中
# dnf makecache
- 更新软件仓库中的软件包列表
# dnf check- update
- 查看 DNF 命令的执行历史
# dnf history
- 查看所有的软件包组
# dnf grouplist
- 安装一个软件包组
# dnf groupinstall ‘System Tools’
# dnf groupinstall ‘System Tools’ -y
- 卸载一个软件包组
# dnf groupremove ‘System Tools’
# dnf groupremove ‘System Tools’ -y
- 从特定的软件包库安装特定的软件
# dnf -enablerepo=epel install vsftpd
- 重新安装特定软件包
# dnf reinstall vsftpd
- 更新系统中所有需要更新的包
# dnf update
- 更新一个特定的软件包
# dnf update vsftpd
- 列出所有命令及其用途
# dnf help
4、配置软件仓库
默认情况下,RHEL、CentOS、OEL的7和8版本系统下,YUM/DNF软件仓库的配置文件都存放在/etc/yum.repo.d/目录下,以repo作为后缀。
4.1网络软件仓库
如果你的系统可以连接互联网,那软件仓库的配置就可以使用网络上的一些免费软件仓库资源进行配置。
以某云为例。
- 基于CentOS系统请访问:https://developer.aliyun.com/mirror/centos
- 基于CentOS 9-stream系统请访问:https://mirrors.aliyun.com/centos-stream/
- 基于Fedora系统请访问:https://developer.aliyun.com/mirror/fedora
- 基于OEL的支持有限,仅提供操作系统镜像文件的下载,请访问:
https://developer.aliyun.com/mirror/oracle
下面简单介绍配置软件仓库方法如下。
- 在/etc/yum.repo.d/下把默认的repo文件删除或者备份到其他目录。
- 从云上下载对应版本的repo文件到/etc/yum.repo.d/目录下。
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
- 使用yum makecache生成缓存。
- 在本地系统运行YUM命令进行软件包的操作即可。
网络软件仓库的使用虽然不用自己准备系统镜像文件,但是相对麻烦,而且会受到网速的影响较大。
4.2本地软件仓库
使用系统镜像文件或者系统光盘,挂载到目录,然后创建YUM/DNF软件仓库,可以暂时使用。
也可以将系统镜像文件拷贝到系统之中,然后挂载到目录之后,设置系统开机自动挂载,可以长期使用。
- 确定镜像文件或者系统光盘的设备文件。
比如:/dev/sr0
- 创建挂载设备文件的目录。
# mkdir /mount
- 挂载设备文件/镜像文件/系统光盘到目录。
# mount /dev/sr0 /mount
- 查看挂载目录。
如下图所示,为OEL8.5系统镜像根目录(RHEL和centOS同版本目录和此相同)。
如下图所示,为OEL7.9系统镜像根目录(RHEL和centOS同版本目录和此相同)。
- 创建备份目录,把/etc/yum.repo.d/目录下repo文件移动到其中。
- 创建新的repo文件,内容如下。
- 如上图所示,依旧以OEL8.5系统软件仓库创建为例。
- 使用yum makecache生成软件包列表缓存。
4.3内网软件仓库服务器
当你作为一个网络管理员的时候,如果网络内Linux系统数量较多,每个系统需要安装或者更新软件包的时候,都需要你去配置本地软件仓库,那将会是很麻烦的事情。
而且,往往网络内的很多系统是不允许访问互联网的,这个时候,创建一个内网的网络软件仓库服务器将会变的很有必要。
下面,依旧以OEL8.5为环境,详解创建过程。
- 依照“本地软件仓库”章节内容,创建本地软件仓库。
- 使用yum install httpd -y命令安装httpd软件包。
# yum install httpd -y
Last metadata expiration check: 2:27:20 ago on Sat 19 Feb 2022 03:19:18 PM CST.
Dependencies resolved.
=====================================================================================
Package Arch Version Repo Size
=====================================================================================
Installing:
httpd x86_64 2.4.37-41.0.1.module+el8.5.0+20323+c8e0c271 Appstream 1.4 M
Installing dependencies:
apr x86_64 1.6.3-12.el8 Appstream 129 k
apr-util x86_64 1.6.1-6.el8 Appstream 105 k
httpd-filesystem noarch 2.4.37-41.0.1.module+el8.5.0+20323+c8e0c271 Appstream 39 k
httpd-tools x86_64 2.4.37-41.0.1.module+el8.5.0+20323+c8e0c271 Appstream 106 k
mailcap noarch 2.1.48-3.el8 base 39 k
mod_http2 x86_64 1.15.7-3.module+el8.4.0+20024+b87b2deb Appstream 154 k
oracle-logos-httpd
noarch 84.5-1.0.1.el8 base 29 k
Installing weak dependencies:
apr-util-bdb x86_64 1.6.1-6.el8 Appstream 24 k
apr-util-openssl x86_64 1.6.1-6.el8 Appstream 27 k
Enabling module streams:
httpd 2.4
Transaction Summary
=====================================================================================
Install 10 Packages
Total size: 2.0 M
Installed size: 5.5 M
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : apr-1.6.3-12.el8.x86_64 1/10
Running scriptlet: apr-1.6.3-12.el8.x86_64 1/10
Installing : apr-util-bdb-1.6.1-6.el8.x86_64 2/10
Installing : apr-util-openssl-1.6.1-6.el8.x86_64 3/10
Installing : apr-util-1.6.1-6.el8.x86_64 4/10
Running scriptlet: apr-util-1.6.1-6.el8.x86_64 4/10
Installing : httpd-tools-2.4.37-41.0.1.module+el8.5.0+20323+c8e0c271 5/10
Running scriptlet: httpd-filesystem-2.4.37-41.0.1.module+el8.5.0+20323+c8e 6/10
Installing : httpd-filesystem-2.4.37-41.0.1.module+el8.5.0+20323+c8e 6/10
Installing : oracle-logos-httpd-84.5-1.0.1.el8.noarch 7/10
Installing : mailcap-2.1.48-3.el8.noarch 8/10
Installing : mod_http2-1.15.7-3.module+el8.4.0+20024+b87b2deb.x86_64 9/10
Installing : httpd-2.4.37-41.0.1.module+el8.5.0+20323+c8e0c271.x86_6 10/10
Running scriptlet: httpd-2.4.37-41.0.1.module+el8.5.0+20323+c8e0c271.x86_6 10/10
Verifying : mailcap-2.1.48-3.el8.noarch 1/10
Verifying : oracle-logos-httpd-84.5-1.0.1.el8.noarch 2/10
Verifying : apr-1.6.3-12.el8.x86_64 3/10
Verifying : apr-util-1.6.1-6.el8.x86_64 4/10
Verifying : apr-util-bdb-1.6.1-6.el8.x86_64 5/10
Verifying : apr-util-openssl-1.6.1-6.el8.x86_64 6/10
Verifying : httpd-2.4.37-41.0.1.module+el8.5.0+20323+c8e0c271.x86_6 7/10
Verifying : httpd-filesystem-2.4.37-41.0.1.module+el8.5.0+20323+c8e 8/10
Verifying : httpd-tools-2.4.37-41.0.1.module+el8.5.0+20323+c8e0c271 9/10
Verifying : mod_http2-1.15.7-3.module+el8.4.0+20024+b87b2deb.x86_64 10/10
Installed:
apr-1.6.3-12.el8.x86_64
apr-util-1.6.1-6.el8.x86_64
apr-util-bdb-1.6.1-6.el8.x86_64
apr-util-openssl-1.6.1-6.el8.x86_64
httpd-2.4.37-41.0.1.module+el8.5.0+20323+c8e0c271.x86_64
httpd-filesystem-2.4.37-41.0.1.module+el8.5.0+20323+c8e0c271.noarch
httpd-tools-2.4.37-41.0.1.module+el8.5.0+20323+c8e0c271.x86_64
mailcap-2.1.48-3.el8.noarch
mod_http2-1.15.7-3.module+el8.4.0+20024+b87b2deb.x86_64
oracle-logos-httpd-84.5-1.0.1.el8.noarch
Complete!
#
- 启动并查看HTTPD服务。
- 查看本机地址,并在客户端进行测试,确定http服务器配置没有问题。
- 在http服务根目录创建/var/www/html/OEL8目录,并拷贝/mount下系统镜像文件中内容到/var/www/html/OEL8/下。
默认情况下,http服务的根目录在/var/www/html/
- 在客户端测试访问http://192.168.31.101/OEL85,确定可以访问系统镜像文件内容。
- 在客户端配置软件仓库文件。
如下图所示,baseurl地址为内网所创建的http服务器地址以及系统镜像文件的拷目录。
- 使用yum makecache生成软件包列表缓存。
依照上述步骤,我们可以在一台http服务器中,把内网常用的各版本LINUX系统镜像文件进行相同操作。然后在Linux客户端依据实际系统版本进行相应配置。
4.4各系统本地软件仓库配置源文件
4.4.1 OEL8及以上版本
# cat /etc/yum.repos.d/base-yum.repo
[base]
name=oel85-yum
baseurl=file:///mount/BaseOS
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
[Appstream]
name=oel85-yum-app
baseurl= file:///mount/AppStream
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
4.4.2 OEL7.9及以下版本
# cat /etc/yum.repos.d/base-yum.repo
[base]
name=oel79
baseurl= file:///mount/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
4.4.3 RHEL8及以上版本
# cat /etc/yum.repos.d/base-yum.repo
[base]
name=RHEL8-yum
baseurl=file:///mount/BaseOS
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[Appstream]
name=RHEL8-yum-app
baseurl= file:///mount/AppStream
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY- redhat-release
4.4.4 RHEL7.9及以下版本
# cat /etc/yum.repos.d/base-yum.repo
[base]
name=rhel79
baseurl= file:///mount/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
4.4.5 CentOS8及以上版本
# cat /etc/yum.repos.d/base-yum.repo
[base]
name=centos-yum
baseurl=file:///mount/BaseOS
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos-8
[Appstream]
name= centos -yum-app
baseurl= file:///mount/AppStream
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY- centos-8
4.4.6 CentOS7.9及以下版本
# cat /etc/yum.repos.d/base-yum.repo
[base]
name=centos
baseurl= file:///mount/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos-7
4,5各系统内网软件仓库配置源文件
以下内容红色部分根据实际情况进行调整。
4.5.1 OEL8及以上版本
# cat /etc/yum.repos.d/base-yum.repo
[base]
name=oel85-yum
baseurl=http://192.168.31.101/OEL85/BaseOS
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
[Appstream]
name=oel85-yum-app
baseurl= http://192.168.31.101/OEL85/AppStream
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
4.5.2 OEL7.9及以下版本
# cat /etc/yum.repos.d/base-yum.repo
[base]
name=oel79
baseurl= http://192.168.31.101/OEL79/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
4.5.3 RHEL8及以上版本
# cat /etc/yum.repos.d/base-yum.repo
[base]
name=RHEL8-yum
baseurl=http://192.168.31.101/RHEL85/BaseOS
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[Appstream]
name=RHEL8-yum-app
baseurl= http://192.168.31.101/RHEL85/AppStream
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY- redhat-release
4.5.4 RHEL7.9及以下版本
# cat /etc/yum.repos.d/base-yum.repo
[base]
name=rhel79
baseurl= http://192.168.31.101/RHEL79/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
4.5.5 CentOS8及以上版本
# cat /etc/yum.repos.d/base-yum.repo
[base]
name=centos-yum
baseurl=http://192.168.31.101/centos/BaseOS
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos-8
[Appstream]
name= centos -yum-app
baseurl= http://192.168.31.101/centos/AppStream
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY- centos-8
4.5.6 CentOS7.9及以下版本
# cat /etc/yum.repos.d/base-yum.repo
[base]
name=centos
baseurl= http://192.168.31.101/centos/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos-7