yum


安装源代码软件包需要编译安装,需要安装支持c和c++程序语言的编译器,如gcc、gcc-c++、make
如果使用rpm方式安装,则需要先安装多个依赖包,这样会很繁琐。可以使用 yum方式进行一键安装。

本地源

配置本地yum源仓库

mount /dev/cdrom /mnt/把光盘挂载到/mnt目录下或者mount /dev/sr0 /mnt
cdrom和sr0都是光驱
挂载目的地址最好是空的 原来的数据将被隐藏,一个挂载点同一时只能挂载一个设备
cd /etc/yum.repos.d/ 切换到/etc/yum.repos.d/下
mkdir repos.bak 创建名字为repos.bak目录
mv *.repo repos.bak 将yum.repos.d/下的所有移动到repos.bak目录下
vim local.repo 使用vim编辑器编辑local.repo
[local] 仓库类别
name=local 仓库名称
baseurl=file:///mnt 指定URL 访问路径为光盘挂载目录 本地yum源
enabled=1 开启此yum源,此为默认项,可省略
gpgcheck=0 不验证软件包的签名
yum clean all && yum makecache 删除yum缓存并更新

yum常用的操作命令

yum -y install +软件名 安装、升级软件包,“-y”选项表示自动确认
yum -y remove +软件名 卸载软件包,可自动解决其依赖关系
yum -y update +软件名 升级软件包
yum list 查询软件包列表
yum list installed 查询系统中已安装的软件包
yum list available 查询仓库中尚未安装的软件包
yum list updates 查询可以升级版本的软件包
yum info 软件名 查询软件包的描述信息
yum info httpd
yum search all关键词 根据某个关键词来查找相关的软件包
例:yum search all httpd
yum whatprovides +命令 查询命令属于哪个软件包
例:yum whatprovides netstat
yum install 包名 -y --downloadonly --downloaddir=/tmp/下载RPM包到指定目录
yum -U update 升级软件包只适合网络源

网络源

1.将创建的local.repo文件移动到repo.bak目录下(也可以是别的备份目录),去除yum源,清理缓存并且生成新的缓存
[root@localhost yum.repos.d]# ls
local.repo repos.bak
[root@localhost yum.repos.d]# mv repos.bak/*.repo ./
[root@localhost yum.repos.d]# ls
CentOS-Base.repo CentOS-fasttrack.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-Media.repo local.repo
CentOS-Debuginfo.repo CentOS-Sources.repo repos.bak
[root@localhost yum.repos.d]# mv local.repo repos.bak/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo repos.bak
[root@localhost yum.repos.d]# yum clean all
已加载插件:fastestmirror, langpacks
正在清理软件源: base extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@localhost yum.repos.d]# yum makecache
已加载插件:fastestmirror, langpacks
base | 3.6 kB 00:00:00extras | 2.9 kB 00:00:00updates | 2.9 kB 00:00:00(1/10): base/7/x86_64/group_gz | 153 kB 00:00:00(2/10): base/7/x86_64/primary_db | 6.1 MB 00:00:01(3/10): base/7/x86_64/filelists_db | 7.2 MB 00:00:01(4/10): base/7/x86_64/other_db | 2.6 MB 00:00:00(5/10): extras/7/x86_64/primary_db | 253 kB 00:00:05(6/10): extras/7/x86_64/filelists_db | 305 kB 00:00:05(7/10): extras/7/x86_64/other_db | 154 kB 00:00:00(8/10): updates/7/x86_64/filelists_db | 15 MB 00:00:02(9/10): updates/7/x86_64/other_db | 1.6 MB 00:00:00(10/10): updates/7/x86_64/primary_db | 27 MB 00:00:09Determining fastest mirrors

  • base: mirrors.ustc.edu.cn
  • extras: ftp.sjtu.edu.cn
  • updates: ftp.sjtu.edu.cn
    元数据缓存已建立
    [root@localhost yum.repos.d]# ls
    CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
    CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo repos.bak
    [root@localhost yum.repos.d]# rpm -q httpd
    未安装软件包 httpd

2.下载httpd到指定目录
[root@localhost opt]# yum install httpd -y --downloadonly --downloaddir=/opt/httpd-release
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile

  • base: mirrors.ustc.edu.cn
  • extras: ftp.sjtu.edu.cn
  • updates: ftp.sjtu.edu.cn
    正在解决依赖关系
    –> 正在检查事务
    —> 软件包 httpd.x86_64.0.2.4.6-99.el7.centos.1 将被 安装
    –> 解决依赖关系完成

依赖关系解决

Package 架构 版本 源 大小
正在安装:
httpd x86_64 2.4.6-99.el7.centos.1 updates 2.7 M
事务概要
安装 1 软件包
总下载量:2.7 M
安装大小:9.4 M
Background downloading packages, then exiting:
httpd-2.4.6-99.el7.centos.1.x86_64.rpm | 2.7 MB 00:00:00exiting because “Download Only” specified
[root@localhost opt]# cd httpd-release/
[root@localhost httpd-release]# ls
httpd-2.4.6-99.el7.centos.1.x86_64.rpm
3.下载gcc apr-devel pkgconfig* libapr* pcre pcre-devel libtool libxml2-devel apr-util到指定目录**
[root@localhost opt]# yum install gcc
apr-devel* pkgconfig* libapr* pcre pcre-devel libtool libxml2-devel apr-util* -y --downloadonly --downloaddir=/opt/httpd-release
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile

  • base: mirrors.ustc.edu.cn
  • extras: ftp.sjtu.edu.cn
  • updates: ftp.sjtu.edu.cn
    软件包 1:pkgconfig-0.27.1-4.el7.x86_64 已安装并且是最新版本
    软件包 pcre-8.32-17.el7.x86_64 已安装并且是最新版本
    软件包 libtool-2.4.2-22.el7_3.x86_64 已安装并且是最新版本
    正在解决依赖关系
    –> 正在检查事务
    —> 软件包 apr.x86_64.0.1.4.8-3.el7 将被 升级
    —> 软件包 apr.x86_64.0.1.4.8-7.el7 将被 更新
    —> 软件包 apr-devel.x86_64.0.1.4.8-7.el7 将被 安装
    —> 软件包 apr-util.x86_64.0.1.5.2-6.el7 将被 升级
    —> 软件包 apr-util.x86_64.0.1.5.2-6.el7_9.1 将被 更新
    —> 软件包 apr-util-devel.x86_64.0.1.5.2-6.el7_9.1 将被 安装
    –> 正在处理依赖关系 openldap-devel(x86-64),它被软件包 apr-util-devel-1.5.2-6.el7_9.1.x86_64 需要
    –> 正在处理依赖关系 libdb-devel(x86-64),它被软件包 apr-util-devel-1.5.2-6.el7_9.1.x86_64 需要
    –> 正在处理依赖关系 expat-devel(x86-64),它被软件包 apr-util-devel-1.5.2-6.el7_9.1.x86_64 需要
    —> 软件包 apr-util-ldap.x86_64.0.1.5.2-6.el7_9.1 将被 安装
    —> 软件包 apr-util-mysql.x86_64.0.1.5.2-6.el7_9.1 将被 安装
    —> 软件包 apr-util-nss.x86_64.0.1.5.2-6.el7_9.1 将被 安装
    —> 软件包 apr-util-odbc.x86_64.0.1.5.2-6.el7_9.1 将被 安装
    –> 正在处理依赖关系 libodbc.so.2()(64bit),它被软件包 apr-util-odbc-1.5.2-6.el7_9.1.x86_64 需要
    —> 软件包 apr-util-openssl.x86_64.0.1.5.2-6.el7_9.1 将被 安装
    —> 软件包 apr-util-pgsql.x86_64.0.1.5.2-6.el7_9.1 将被 安装
    –> 正在处理依赖关系 libpq.so.5()(64bit),它被软件包 apr-util-pgsql-1.5.2-6.el7_9.1.x86_64 需要
    —> 软件包 apr-util-sqlite.x86_64.0.1.5.2-6.el7_9.1 将被 安装
    —> 软件包 gcc.x86_64.0.4.8.5-16.el7 将被 升级
    –> 正在处理依赖关系 gcc = 4.8.5-16.el7,它被软件包 libquadmath-devel-4.8.5-16.el7.x86_64 需要
    —> 软件包 gcc.x86_64.0.4.8.5-44.el7 将被 更新
    –> 正在处理依赖关系 libgomp = 4.8.5-44.el7,它被软件包 gcc-4.8.5-44.el7.x86_64 需要
    –> 正在处理依赖关系 cpp = 4.8.5-44.el7,它被软件包 gcc-4.8.5-44.el7.x86_64 需要
    –> 正在处理依赖关系 libgcc >= 4.8.5-44.el7,它被软件包 gcc-4.8.5-44.el7.x86_64 需要
    —> 软件包 gcc-c++.x86_64.0.4.8.5-16.el7 将被 升级
    —> 软件包 gcc-c++.x86_64.0.4.8.5-44.el7 将被 更新
    –> 正在处理依赖关系 libstdc+±devel = 4.8.5-44.el7,它被软件包 gcc-c+±4.8.5-44.el7.x86_64 需要
    –> 正在处理依赖关系 libstdc++ = 4.8.5-44.el7,它被软件包 gcc-c+±4.8.5-44.el7.x86_64 需要
    —> 软件包 gcc-gfortran.x86_64.0.4.8.5-16.el7 将被 升级
    —> 软件包 gcc-gfortran.x86_64.0.4.8.5-44.el7 将被 更新
    –> 正在处理依赖关系 libquadmath = 4.8.5-44.el7,它被软件包 gcc-gfortran-4.8.5-44.el7.x86_64 需要
    –> 正在处理依赖关系 libgfortran = 4.8.5-44.el7,它被软件包 gcc-gfortran-4.8.5-44.el7.x86_64 需要
    —> 软件包 gcc-gnat.x86_64.0.4.8.5-44.el7 将被 安装
    –> 正在处理依赖关系 libgnat-devel = 4.8.5-44.el7,它被软件包 gcc-gnat-4.8.5-44.el7.x86_64 需要
    –> 正在处理依赖关系 libgnat = 4.8.5-44.el7,它被软件包 gcc-gnat-4.8.5-44.el7.x86_64 需要
    —> 软件包 gcc-go.x86_64.0.4.8.5-44.el7 将被 安装
    –> 正在处理依赖关系 libgo-devel = 4.8.5-44.el7,它被软件包 gcc-go-4.8.5-44.el7.x86_64 需要
    –> 正在处理依赖关系 libgo = 4.8.5-44.el7,它被软件包 gcc-go-4.8.5-44.el7.x86_64 需要
    —> 软件包 gcc-objc.x86_64.0.4.8.5-44.el7 将被 安装
    –> 正在处理依赖关系 libobjc = 4.8.5-44.el7,它被软件包 gcc-objc-4.8.5-44.el7.x86_64 需要
    –> 正在处理依赖关系 libobjc.so.4()(64bit),它被软件包 gcc-objc-4.8.5-44.el7.x86_64 需要
    —> 软件包 gcc-objc++.x86_64.0.4.8.5-44.el7 将被 安装
    —> 软件包 gcc-plugin-devel.x86_64.0.4.8.5-44.el7 将被 安装
    –> 正在处理依赖关系 mpfr-devel >= 2.2.1,它被软件包 gcc-plugin-devel-4.8.5-44.el7.x86_64 需要
    –> 正在处理依赖关系 libmpc-devel >= 0.8.1,它被软件包 gcc-plugin-devel-4.8.5-44.el7.x86_64 需要
    –> 正在处理依赖关系 gmp-devel >= 4.1.2-8,它被软件包 gcc-plugin-devel-4.8.5-44.el7.x86_64 需要
    —> 软件包 libxml2-devel.x86_64.0.2.9.1-6.el7_9.6 将被 安装
    –> 正在处理依赖关系 libxml2 = 2.9.1-6.el7_9.6,它被软件包 libxml2-devel-2.9.1-6.el7_9.6.x86_64 需要
    –> 正在处理依赖关系 zlib-devel,它被软件包 libxml2-devel-2.9.1-6.el7_9.6.x86_64 需要
    –> 正在处理依赖关系 xz-devel,它被软件包 libxml2-devel-2.9.1-6.el7_9.6.x86_64 需要
    —> 软件包 pcre-devel.x86_64.0.8.32-17.el7 将被 安装
    –> 正在检查事务
    —> 软件包 cpp.x86_64.0.4.8.5-16.el7 将被 升级
    —> 软件包 cpp.x86_64.0.4.8.5-44.el7 将被 更新
    —> 软件包 expat-devel.x86_64.0.2.1.0-15.el7_9 将被 安装
    –> 正在处理依赖关系 expat = 2.1.0-15.el7_9,它被软件包 expat-devel-2.1.0-15.el7_9.x86_64 需要
    —> 软件包 gmp-devel.x86_64.1.6.0.0-15.el7 将被 安装
    —> 软件包 libdb-devel.x86_64.0.5.3.21-25.el7 将被 安装
    –> 正在处理依赖关系 libdb(x86-64) = 5.3.21-25.el7,它被软件包 libdb-devel-5.3.21-25.el7.x86_64 需要
    —> 软件包 libgcc.x86_64.0.4.8.5-16.el7 将被 升级
    —> 软件包 libgcc.x86_64.0.4.8.5-44.el7 将被 更新
    —> 软件包 libgfortran.x86_64.0.4.8.5-16.el7 将被 升级
    —> 软件包 libgfortran.x86_64.0.4.8.5-44.el7 将被 更新
    —> 软件包 libgnat.x86_64.0.4.8.5-44.el7 将被 安装
    —> 软件包 libgnat-devel.x86_64.0.4.8.5-44.el7 将被 安装
    —> 软件包 libgo.x86_64.0.4.8.5-44.el7 将被 安装
    —> 软件包 libgo-devel.x86_64.0.4.8.5-44.el7 将被 安装
    —> 软件包 libgomp.x86_64.0.4.8.5-16.el7 将被 升级
    —> 软件包 libgomp.x86_64.0.4.8.5-44.el7 将被 更新
    —> 软件包 libmpc-devel.x86_64.0.1.0.1-3.el7 将被 安装
    —> 软件包 libobjc.x86_64.0.4.8.5-44.el7 将被 安装
    —> 软件包 libquadmath.x86_64.0.4.8.5-16.el7 将被 升级
    —> 软件包 libquadmath.x86_64.0.4.8.5-44.el7 将被 更新
    —> 软件包 libquadmath-devel.x86_64.0.4.8.5-16.el7 将被 升级
    —> 软件包 libquadmath-devel.x86_64.0.4.8.5-44.el7 将被 更新
    —> 软件包 libstdc++.x86_64.0.4.8.5-16.el7 将被 升级
    —> 软件包 libstdc++.x86_64.0.4.8.5-44.el7 将被 更新
    —> 软件包 libstdc+±devel.x86_64.0.4.8.5-16.el7 将被 升级
    —> 软件包 libstdc+±devel.x86_64.0.4.8.5-44.el7 将被 更新
    —> 软件包 libxml2.x86_64.0.2.9.1-6.el7_2.3 将被 升级
    –> 正在处理依赖关系 libxml2 = 2.9.1-6.el7_2.3,它被软件包 libxml2-python-2.9.1-6.el7_2.3.x86_64 需要
    —> 软件包 libxml2.x86_64.0.2.9.1-6.el7_9.6 将被 更新
    —> 软件包 mpfr-devel.x86_64.0.3.1.1-4.el7 将被 安装
    —> 软件包 openldap-devel.x86_64.0.2.4.44-25.el7_9 将被 安装
    –> 正在处理依赖关系 openldap(x86-64) = 2.4.44-25.el7_9,它被软件包 openldap-devel-2.4.44-25.el7_9.x86_64 需要
    –> 正在处理依赖关系 cyrus-sasl-devel(x86-64),它被软件包 openldap-devel-2.4.44-25.el7_9.x86_64 需要
    —> 软件包 postgresql-libs.x86_64.0.9.2.24-9.el7_9 将被 安装
    —> 软件包 unixODBC.x86_64.0.2.3.1-14.el7 将被 安装
    —> 软件包 xz-devel.x86_64.0.5.2.2-2.el7_9 将被 安装
    –> 正在处理依赖关系 xz-libs = 5.2.2-2.el7_9,它被软件包 xz-devel-5.2.2-2.el7_9.x86_64 需要
    —> 软件包 zlib-devel.x86_64.0.1.2.7-21.el7_9 将被 安装
    –> 正在处理依赖关系 zlib = 1.2.7-21.el7_9,它被软件包 zlib-devel-1.2.7-21.el7_9.x86_64 需要
    –> 正在检查事务
    —> 软件包 cyrus-sasl-devel.x86_64.0.2.1.26-24.el7_9 将被 安装
    –> 正在处理依赖关系 cyrus-sasl-lib(x86-64) = 2.1.26-24.el7_9,它被软件包 cyrus-sasl-devel-2.1.26-24.el7_9.x86_64 需要
    –> 正在处理依赖关系 cyrus-sasl(x86-64) = 2.1.26-24.el7_9,它被软件包 cyrus-sasl-devel-2.1.26-24.el7_9.x86_64 需要
    —> 软件包 expat.x86_64.0.2.1.0-10.el7_3 将被 升级
    —> 软件包 expat.x86_64.0.2.1.0-15.el7_9 将被 更新
    —> 软件包 libdb.x86_64.0.5.3.21-20.el7 将被 升级
    –> 正在处理依赖关系 libdb(x86-64) = 5.3.21-20.el7,它被软件包 libdb-utils-5.3.21-20.el7.x86_64 需要
    —> 软件包 libdb.x86_64.0.5.3.21-25.el7 将被 更新
    —> 软件包 libxml2-python.x86_64.0.2.9.1-6.el7_2.3 将被 升级
    —> 软件包 libxml2-python.x86_64.0.2.9.1-6.el7_9.6 将被 更新
    —> 软件包 openldap.x86_64.0.2.4.44-5.el7 将被 升级
    —> 软件包 openldap.x86_64.0.2.4.44-25.el7_9 将被 更新
    —> 软件包 xz-libs.x86_64.0.5.2.2-1.el7 将被 升级
    –> 正在处理依赖关系 xz-libs = 5.2.2-1.el7,它被软件包 xz-5.2.2-1.el7.x86_64 需要
    —> 软件包 xz-libs.x86_64.0.5.2.2-2.el7_9 将被 更新
    —> 软件包 zlib.x86_64.0.1.2.7-17.el7 将被 升级
    —> 软件包 zlib.x86_64.0.1.2.7-21.el7_9 将被 更新
    –> 正在检查事务
    —> 软件包 cyrus-sasl.x86_64.0.2.1.26-21.el7 将被 升级
    —> 软件包 cyrus-sasl.x86_64.0.2.1.26-24.el7_9 将被 更新
    —> 软件包 cyrus-sasl-lib.x86_64.0.2.1.26-21.el7 将被 升级
    –> 正在处理依赖关系 cyrus-sasl-lib(x86-64) = 2.1.26-21.el7,它被软件包 cyrus-sasl-gssapi-2.1.26-21.el7.x86_64 需要
    –> 正在处理依赖关系 cyrus-sasl-lib(x86-64) = 2.1.26-21.el7,它被软件包 cyrus-sasl-md5-2.1.26-21.el7.x86_64 需要
    –> 正在处理依赖关系 cyrus-sasl-lib(x86-64) = 2.1.26-21.el7,它被软件包 cyrus-sasl-scram-2.1.26-21.el7.x86_64 需要
    –> 正在处理依赖关系 cyrus-sasl-lib(x86-64) = 2.1.26-21.el7,它被软件包 cyrus-sasl-plain-2.1.26-21.el7.x86_64 需要
    —> 软件包 cyrus-sasl-lib.x86_64.0.2.1.26-24.el7_9 将被 更新
    —> 软件包 libdb-utils.x86_64.0.5.3.21-20.el7 将被 升级
    —> 软件包 libdb-utils.x86_64.0.5.3.21-25.el7 将被 更新
    —> 软件包 xz.x86_64.0.5.2.2-1.el7 将被 升级
    —> 软件包 xz.x86_64.0.5.2.2-2.el7_9 将被 更新
    –> 正在检查事务
    —> 软件包 cyrus-sasl-gssapi.x86_64.0.2.1.26-21.el7 将被 升级
    —> 软件包 cyrus-sasl-gssapi.x86_64.0.2.1.26-24.el7_9 将被 更新
    —> 软件包 cyrus-sasl-md5.x86_64.0.2.1.26-21.el7 将被 升级
    —> 软件包 cyrus-sasl-md5.x86_64.0.2.1.26-24.el7_9 将被 更新
    —> 软件包 cyrus-sasl-plain.x86_64.0.2.1.26-21.el7 将被 升级
    —> 软件包 cyrus-sasl-plain.x86_64.0.2.1.26-24.el7_9 将被 更新
    —> 软件包 cyrus-sasl-scram.x86_64.0.2.1.26-21.el7 将被 升级
    —> 软件包 cyrus-sasl-scram.x86_64.0.2.1.26-24.el7_9 将被 更新
    –> 解决依赖关系完成

依赖关系解决

Package 架构 版本 源 大小
正在安装:
apr-devel x86_64 1.4.8-7.el7 base 188 k
apr-util-devel x86_64 1.5.2-6.el7_9.1 updates 76 k
apr-util-ldap x86_64 1.5.2-6.el7_9.1 updates 19 k
apr-util-mysql x86_64 1.5.2-6.el7_9.1 updates 23 k
apr-util-nss x86_64 1.5.2-6.el7_9.1 updates 21 k
apr-util-odbc x86_64 1.5.2-6.el7_9.1 updates 27 k
apr-util-openssl x86_64 1.5.2-6.el7_9.1 updates 20 k
apr-util-pgsql x86_64 1.5.2-6.el7_9.1 updates 23 k
apr-util-sqlite x86_64 1.5.2-6.el7_9.1 updates 21 k
gcc-gnat x86_64 4.8.5-44.el7 base 13 M
gcc-go x86_64 4.8.5-44.el7 base 5.9 M
gcc-objc x86_64 4.8.5-44.el7 base 5.7 M
gcc-objc++ x86_64 4.8.5-44.el7 base 6.2 M
gcc-plugin-devel x86_64 4.8.5-44.el7 base 828 k
libxml2-devel x86_64 2.9.1-6.el7_9.6 updates 1.1 M
pcre-devel x86_64 8.32-17.el7 base 480 k
正在更新:
apr x86_64 1.4.8-7.el7 base 104 k
apr-util x86_64 1.5.2-6.el7_9.1 updates 92 k
gcc x86_64 4.8.5-44.el7 base 16 M
gcc-c++ x86_64 4.8.5-44.el7 base 7.2 M
gcc-gfortran x86_64 4.8.5-44.el7 base 6.7 M
为依赖而安装:
cyrus-sasl-devel x86_64 2.1.26-24.el7_9 updates 310 k
expat-devel x86_64 2.1.0-15.el7_9 updates 58 k
gmp-devel x86_64 1:6.0.0-15.el7 base 181 k
libdb-devel x86_64 5.3.21-25.el7 base 39 k
libgnat x86_64 4.8.5-44.el7 base 967 k
libgnat-devel x86_64 4.8.5-44.el7 base 2.7 M
libgo x86_64 4.8.5-44.el7 base 2.2 M
libgo-devel x86_64 4.8.5-44.el7 base 231 k
libmpc-devel x86_64 1.0.1-3.el7 base 32 k
libobjc x86_64 4.8.5-44.el7 base 80 k
mpfr-devel x86_64 3.1.1-4.el7 base 68 k
openldap-devel x86_64 2.4.44-25.el7_9 updates 805 k
postgresql-libs x86_64 9.2.24-9.el7_9 updates 235 k
unixODBC x86_64 2.3.1-14.el7 base 413 k
xz-devel x86_64 5.2.2-2.el7_9 updates 46 k
zlib-devel x86_64 1.2.7-21.el7_9 updates 50 k
为依赖而更新:
cpp x86_64 4.8.5-44.el7 base 5.9 M
cyrus-sasl x86_64 2.1.26-24.el7_9 updates 88 k
cyrus-sasl-gssapi x86_64 2.1.26-24.el7_9 updates 41 k
cyrus-sasl-lib x86_64 2.1.26-24.el7_9 updates 156 k
cyrus-sasl-md5 x86_64 2.1.26-24.el7_9 updates 57 k
cyrus-sasl-plain x86_64 2.1.26-24.el7_9 updates 39 k
cyrus-sasl-scram x86_64 2.1.26-24.el7_9 updates 43 k
expat x86_64 2.1.0-15.el7_9 updates 83 k
libdb x86_64 5.3.21-25.el7 base 720 k
libdb-utils x86_64 5.3.21-25.el7 base 132 k
libgcc x86_64 4.8.5-44.el7 base 103 k
libgfortran x86_64 4.8.5-44.el7 base 301 k
libgomp x86_64 4.8.5-44.el7 base 159 k
libquadmath x86_64 4.8.5-44.el7 base 190 k
libquadmath-devel x86_64 4.8.5-44.el7 base 54 k
libstdc++ x86_64 4.8.5-44.el7 base 306 k
libstdc+±devel x86_64 4.8.5-44.el7 base 1.5 M
libxml2 x86_64 2.9.1-6.el7_9.6 updates 668 k
libxml2-python x86_64 2.9.1-6.el7_9.6 updates 247 k
openldap x86_64 2.4.44-25.el7_9 updates 356 k
xz x86_64 5.2.2-2.el7_9 updates 229 k
xz-libs x86_64 5.2.2-2.el7_9 updates 103 k
zlib x86_64 1.2.7-21.el7_9 updates 90 k
事务概要
安装 16 软件包 (+16 依赖软件包)
升级 5 软件包 (+23 依赖软件包)
总下载量:83 M
Background downloading packages, then exiting:
No Presto metadata available for base
No Presto metadata available for updates
(1/60): apr-util-devel-1.5.2-6.el7_9.1.x86_64.rpm | 76 kB 00:00:00(2/60): apr-util-ldap-1.5.2-6.el7_9.1.x86_64.rpm | 19 kB 00:00:00(3/60): apr-devel-1.4.8-7.el7.x86_64.rpm | 188 kB 00:00:00(4/60): apr-util-mysql-1.5.2-6.el7_9.1.x86_64.rpm | 23 kB 00:00:00(5/60): apr-util-nss-1.5.2-6.el7_9.1.x86_64.rpm | 21 kB 00:00:00(6/60): apr-util-1.5.2-6.el7_9.1.x86_64.rpm | 92 kB 00:00:00(7/60): apr-util-odbc-1.5.2-6.el7_9.1.x86_64.rpm | 27 kB 00:00:00(8/60): apr-util-openssl-1.5.2-6.el7_9.1.x86_64.rpm | 20 kB 00:00:00(9/60): apr-util-pgsql-1.5.2-6.el7_9.1.x86_64.rpm | 23 kB 00:00:00(10/60): apr-util-sqlite-1.5.2-6.el7_9.1.x86_64.rpm | 21 kB 00:00:00(11/60): cyrus-sasl-2.1.26-24.el7_9.x86_64.rpm | 88 kB 00:00:00(12/60): cyrus-sasl-devel-2.1.26-24.el7_9.x86_64.rpm | 310 kB 00:00:00(13/60): cyrus-sasl-lib-2.1.26-24.el7_9.x86_64.rpm | 156 kB 00:00:00(14/60): cyrus-sasl-md5-2.1.26-24.el7_9.x86_64.rpm | 57 kB 00:00:00(15/60): cyrus-sasl-plain-2.1.26-24.el7_9.x86_64.rpm | 39 kB 00:00:00(16/60): cyrus-sasl-gssapi-2.1.26-24.el7_9.x86_64.rpm | 41 kB 00:00:00(17/60): cyrus-sasl-scram-2.1.26-24.el7_9.x86_64.rpm | 43 kB 00:00:00(18/60): expat-devel-2.1.0-15.el7_9.x86_64.rpm | 58 kB 00:00:00(19/60): expat-2.1.0-15.el7_9.x86_64.rpm | 83 kB 00:00:00(20/60): apr-1.4.8-7.el7.x86_64.rpm | 104 kB 00:00:05(21/60): gcc-4.8.5-44.el7.x86_64.rpm | 16 MB 00:00:01(22/60): gcc-c+±4.8.5-44.el7.x86_64.rpm | 7.2 MB 00:00:01(23/60): gcc-gfortran-4.8.5-44.el7.x86_64.rpm | 6.7 MB 00:00:00(24/60): gcc-gnat-4.8.5-44.el7.x86_64.rpm | 13 MB 00:00:01(25/60): gcc-go-4.8.5-44.el7.x86_64.rpm | 5.9 MB 00:00:00(26/60): gcc-objc-4.8.5-44.el7.x86_64.rpm | 5.7 MB 00:00:00(27/60): gcc-objc+±4.8.5-44.el7.x86_64.rpm | 6.2 MB 00:00:00(28/60): gcc-plugin-devel-4.8.5-44.el7.x86_64.rpm | 828 kB 00:00:00(29/60): gmp-devel-6.0.0-15.el7.x86_64.rpm | 181 kB 00:00:00(30/60): libdb-5.3.21-25.el7.x86_64.rpm | 720 kB 00:00:00(31/60): libdb-devel-5.3.21-25.el7.x86_64.rpm | 39 kB 00:00:00(32/60): libdb-utils-5.3.21-25.el7.x86_64.rpm | 132 kB 00:00:00(33/60): libgcc-4.8.5-44.el7.x86_64.rpm | 103 kB 00:00:00(34/60): libgfortran-4.8.5-44.el7.x86_64.rpm | 301 kB 00:00:00(35/60): libgnat-4.8.5-44.el7.x86_64.rpm | 967 kB 00:00:00(36/60): libgnat-devel-4.8.5-44.el7.x86_64.rpm | 2.7 MB 00:00:00(37/60): libgo-4.8.5-44.el7.x86_64.rpm | 2.2 MB 00:00:00(38/60): libgo-devel-4.8.5-44.el7.x86_64.rpm | 231 kB 00:00:00(39/60): libgomp-4.8.5-44.el7.x86_64.rpm | 159 kB 00:00:00(40/60): libmpc-devel-1.0.1-3.el7.x86_64.rpm | 32 kB 00:00:00(41/60): libobjc-4.8.5-44.el7.x86_64.rpm | 80 kB 00:00:00(42/60): libquadmath-4.8.5-44.el7.x86_64.rpm | 190 kB 00:00:00(43/60): libquadmath-devel-4.8.5-44.el7.x86_64.rpm | 54 kB 00:00:00(44/60): libstdc+±4.8.5-44.el7.x86_64.rpm | 306 kB 00:00:00(45/60): libstdc+±devel-4.8.5-44.el7.x86_64.rpm | 1.5 MB 00:00:00(46/60): cpp-4.8.5-44.el7.x86_64.rpm | 5.9 MB 00:00:16(47/60): libxml2-2.9.1-6.el7_9.6.x86_64.rpm | 668 kB 00:00:05(48/60): libxml2-python-2.9.1-6.el7_9.6.x86_64.rpm | 247 kB 00:00:00(49/60): openldap-2.4.44-25.el7_9.x86_64.rpm | 356 kB 00:00:00(50/60): openldap-devel-2.4.44-25.el7_9.x86_64.rpm | 805 kB 00:00:00(51/60): postgresql-libs-9.2.24-9.el7_9.x86_64.rpm | 235 kB 00:00:00(52/60): mpfr-devel-3.1.1-4.el7.x86_64.rpm | 68 kB 00:00:00(53/60): unixODBC-2.3.1-14.el7.x86_64.rpm | 413 kB 00:00:00(54/60): libxml2-devel-2.9.1-6.el7_9.6.x86_64.rpm | 1.1 MB 00:00:06(55/60): xz-devel-5.2.2-2.el7_9.x86_64.rpm | 46 kB 00:00:00(56/60): xz-libs-5.2.2-2.el7_9.x86_64.rpm | 103 kB 00:00:00(57/60): zlib-1.2.7-21.el7_9.x86_64.rpm | 90 kB 00:00:00(58/60): zlib-devel-1.2.7-21.el7_9.x86_64.rpm | 50 kB 00:00:00(59/60): pcre-devel-8.32-17.el7.x86_64.rpm | 480 kB 00:00:05(60/60): xz-5.2.2-2.el7_9.x86_64.rpm | 229 kB 00:00:05
总计 3.1 MB/s | 83 MB 00:27exiting because “Download Only” specified
[root@localhost opt]# cd /opt/httpd-release/
[root@localhost httpd-release]# ls
apr-1.4.8-7.el7.x86_64.rpm
apr-devel-1.4.8-7.el7.x86_64.rpm
apr-util-1.5.2-6.el7_9.1.x86_64.rpm
apr-util-devel-1.5.2-6.el7_9.1.x86_64.rpm
apr-util-ldap-1.5.2-6.el7_9.1.x86_64.rpm
apr-util-mysql-1.5.2-6.el7_9.1.x86_64.rpm
apr-util-nss-1.5.2-6.el7_9.1.x86_64.rpm
apr-util-odbc-1.5.2-6.el7_9.1.x86_64.rpm
apr-util-openssl-1.5.2-6.el7_9.1.x86_64.rpm
apr-util-pgsql-1.5.2-6.el7_9.1.x86_64.rpm
apr-util-sqlite-1.5.2-6.el7_9.1.x86_64.rpm
cpp-4.8.5-44.el7.x86_64.rpm
cyrus-sasl-2.1.26-24.el7_9.x86_64.rpm
cyrus-sasl-devel-2.1.26-24.el7_9.x86_64.rpm
cyrus-sasl-gssapi-2.1.26-24.el7_9.x86_64.rpm
cyrus-sasl-lib-2.1.26-24.el7_9.x86_64.rpm
cyrus-sasl-md5-2.1.26-24.el7_9.x86_64.rpm
cyrus-sasl-plain-2.1.26-24.el7_9.x86_64.rpm
cyrus-sasl-scram-2.1.26-24.el7_9.x86_64.rpm
expat-2.1.0-15.el7_9.x86_64.rpm
expat-devel-2.1.0-15.el7_9.x86_64.rpm
gcc-4.8.5-44.el7.x86_64.rpm
gcc-c+±4.8.5-44.el7.x86_64.rpm
gcc-gfortran-4.8.5-44.el7.x86_64.rpm
gcc-gnat-4.8.5-44.el7.x86_64.rpm
gcc-go-4.8.5-44.el7.x86_64.rpm
gcc-objc-4.8.5-44.el7.x86_64.rpm
gcc-objc+±4.8.5-44.el7.x86_64.rpm
gcc-plugin-devel-4.8.5-44.el7.x86_64.rpm
gmp-devel-6.0.0-15.el7.x86_64.rpm
httpd-2.4.6-99.el7.centos.1.x86_64.rpm
libdb-5.3.21-25.el7.x86_64.rpm
libdb-devel-5.3.21-25.el7.x86_64.rpm
libdb-utils-5.3.21-25.el7.x86_64.rpm
libgcc-4.8.5-44.el7.x86_64.rpm
libgfortran-4.8.5-44.el7.x86_64.rpm
libgnat-4.8.5-44.el7.x86_64.rpm
libgnat-devel-4.8.5-44.el7.x86_64.rpm
libgo-4.8.5-44.el7.x86_64.rpm
libgo-devel-4.8.5-44.el7.x86_64.rpm
libgomp-4.8.5-44.el7.x86_64.rpm
libmpc-devel-1.0.1-3.el7.x86_64.rpm
libobjc-4.8.5-44.el7.x86_64.rpm
libquadmath-4.8.5-44.el7.x86_64.rpm
libquadmath-devel-4.8.5-44.el7.x86_64.rpm
libstdc+±4.8.5-44.el7.x86_64.rpm
libstdc+±devel-4.8.5-44.el7.x86_64.rpm
libxml2-2.9.1-6.el7_9.6.x86_64.rpm
libxml2-devel-2.9.1-6.el7_9.6.x86_64.rpm
libxml2-python-2.9.1-6.el7_9.6.x86_64.rpm
mpfr-devel-3.1.1-4.el7.x86_64.rpm
openldap-2.4.44-25.el7_9.x86_64.rpm
openldap-devel-2.4.44-25.el7_9.x86_64.rpm
pcre-devel-8.32-17.el7.x86_64.rpm
postgresql-libs-9.2.24-9.el7_9.x86_64.rpm
unixODBC-2.3.1-14.el7.x86_64.rpm
xz-5.2.2-2.el7_9.x86_64.rpm
xz-devel-5.2.2-2.el7_9.x86_64.rpm
xz-libs-5.2.2-2.el7_9.x86_64.rpm
zlib-1.2.7-21.el7_9.x86_64.rpm
zlib-devel-1.2.7-21.el7_9.x86_64.rpm

阿里云当yum

第一步将创建的local.repo文件移动到repo.bak目录下(也可以是别的备份目录)
第二步将可以连外网的系统打开,执行wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo 将阿里云镜像下载到/etc/yum.repos.d/目录下
第三步:刷新缓存, yum claen all && yum makecache #清理缓存并且生成新的缓存
当既有本地yum源又有aliyun源的时候,在装软件包的时候先用本地的yum源去安装,本地找不到可用的包时再使用aliyun源去安装软件,这里就涉及到了优先级的问题,yum提供的插件yum-plugin-priorities.noarch可以解决这个问题

1.查看是否安装了yum-plugin优先级插件
rpm -qa |grep yum-plugin-

2.如果没有安装,就安装插件
yum -y install yum-plugin-priorities.noarch

3.查看插件是否启用
cat /etc/yum/pluginconf.d/priorities.conf

[main]:
enabled = 1 # 1为启动,0 为禁止

4.修改本地yum源优先使用
vi local.repo
[local]
name=local
baseurl=file:///mnt/
enabled=1
gpgcheck=1
priority=1 #数字越小优先级越高

[epel]
baseurl=https://mirrors.aliyun.com/epel/7Server/x86_64/
enabled=1
gpgcheck=0
priority=2

5.验证安装包的数量
执行yum repolist all 可显示所有仓库包

  • 16
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值