Linux基础

您所在的位置:网站首页 yum下载软件包 Linux基础

Linux基础

2023-02-21 13:12| 来源: 网络整理| 查看: 265

 

RPM是为了简化安装的复杂度,而Yum软件仓库是为了解决软件包之间的依赖关系

一、rpm 本地安装 rpm -ivh filename.rpm # 安装 rpm -Uvh filename.rpm # 升级 rpm -e filename.rpm # 卸载 rpm -qpi filename.rpm # 查询软件描述 rpm -qpl filename.rpm # 列出软件文件 rpm -qf filename.rpm # 查询文件属于哪个RPM

  

二、yum

2.1 yum 命令

yum reportlist all # 列出所有仓库 yum list all # 列出仓库中所有软件包 yum info xxx # 查看软件包信息 yum install xxx # 安装软件包 yum reinstall xxx # 重装软件包 yum update xxx # 升级软件包 yum remove xxx # 移除软件包 yum clean all # 清除所有仓库缓存 yum check-update # 检查可更新软件包 yum grouplist # 查看系统已经安装的软件包组 yum groupinstall xxx # 安装指定的软件包组 yum groupremove xxx # 移除指定软件包组 yum groupinfo xxx # 查询指定的软件包组信息

  

2.2 只下载rpm包, 不安装

yum install yum-plugin-downloadonly yum install --downloadonly --downloaddir=/tmp/packages/ gcc-c++

  

2.3 httpd  list - install - info

[root@centos78 ~]# yum list httpd --showduplicates Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.nju.edu.cn * epel: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.nju.edu.cn * updates: mirrors.ustc.edu.cn Available Packages httpd.x86_64 2.4.6-95.el7.centos base httpd.x86_64 2.4.6-97.el7.centos updates httpd.x86_64 2.4.6-97.el7.centos.1 updates httpd.x86_64 2.4.6-97.el7.centos.2 updates httpd.x86_64 2.4.6-97.el7.centos.4 updates httpd.x86_64 2.4.6-97.el7.centos.5 updates httpd.x86_64 2.4.6-98.el7.centos.6 updates

 

[root@centos78 ~]# yum install httpd-2.4.6-95.el7.centos Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.nju.edu.cn * epel: ftp.iij.ad.jp * extras: mirrors.nju.edu.cn * updates: mirrors.ustc.edu.cn Resolving Dependencies --> Running transaction check ---> Package httpd.x86_64 0:2.4.6-95.el7.centos will be installed --> Processing Dependency: httpd-tools = 2.4.6-95.el7.centos for package: httpd-2.4.6-95.el7.centos.x86_64 --> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-95.el7.centos.x86_64 --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-95.el7.centos.x86_64 --> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-95.el7.centos.x86_64 --> Running transaction check ---> Package apr.x86_64 0:1.4.8-7.el7 will be installed ---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed ---> Package httpd-tools.x86_64 0:2.4.6-95.el7.centos will be installed ---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved =================================================================================================================== Package Arch Version Repository Size =================================================================================================================== Installing: httpd x86_64 2.4.6-95.el7.centos base 2.7 M Installing for dependencies: apr x86_64 1.4.8-7.el7 base 104 k apr-util x86_64 1.5.2-6.el7 base 92 k httpd-tools x86_64 2.4.6-95.el7.centos base 93 k mailcap noarch 2.1.41-2.el7 base 31 k Transaction Summary =================================================================================================================== Install 1 Package (+4 Dependent packages) Total download size: 3.0 M Installed size: 10 M Is this ok [y/d/N]: y Downloading packages: (1/5): httpd-tools-2.4.6-95.el7.centos.x86_64.rpm | 93 kB 00:00:00 (2/5): apr-1.4.8-7.el7.x86_64.rpm | 104 kB 00:00:00 (3/5): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:00:00 (4/5): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:01 (5/5): httpd-2.4.6-95.el7.centos.x86_64.rpm | 2.7 MB 00:00:01 ------------------------------------------------------------------------------------------------------------------- Total 1.8 MB/s | 3.0 MB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : apr-1.4.8-7.el7.x86_64 1/5 Installing : apr-util-1.5.2-6.el7.x86_64 2/5 Installing : httpd-tools-2.4.6-95.el7.centos.x86_64 3/5 Installing : mailcap-2.1.41-2.el7.noarch 4/5 Installing : httpd-2.4.6-95.el7.centos.x86_64 5/5 Verifying : httpd-tools-2.4.6-95.el7.centos.x86_64 1/5 Verifying : mailcap-2.1.41-2.el7.noarch 2/5 Verifying : apr-1.4.8-7.el7.x86_64 3/5 Verifying : httpd-2.4.6-95.el7.centos.x86_64 4/5 Verifying : apr-util-1.5.2-6.el7.x86_64 5/5 Installed: httpd.x86_64 0:2.4.6-95.el7.centos Dependency Installed: apr.x86_64 0:1.4.8-7.el7 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-95.el7.centos mailcap.noarch 0:2.1.41-2.el7 Complete!

  

[root@centos78 ~]# yum info httpd Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.nju.edu.cn * epel: ftp.iij.ad.jp * extras: mirrors.nju.edu.cn * updates: mirrors.ustc.edu.cn Installed Packages Name : httpd Arch : x86_64 Version : 2.4.6 Release : 95.el7.centos Size : 9.4 M Repo : installed From repo : base Summary : Apache HTTP Server URL : http://httpd.apache.org/ License : ASL 2.0 Description : The Apache HTTP Server is a powerful, efficient, and extensible : web server. Available Packages Name : httpd Arch : x86_64 Version : 2.4.6 Release : 98.el7.centos.6 Size : 2.7 M Repo : updates/7/x86_64 Summary : Apache HTTP Server URL : http://httpd.apache.org/ License : ASL 2.0 Description : The Apache HTTP Server is a powerful, efficient, and extensible : web server.

 

2.4 yum 安装依赖报错处理

[root@centos78 ~]]# package-cleanup --cleandupes --noscripts [root@centos78 ~]]# yum-complete-transaction --cleanup-only Cleaning up unfinished transaction journals Cleaning up 2021-10-20.02:46.46 Cleaning up 2021-10-20.02:51.00 [root@centos78 ~]]# package-cleanup --cleandupes --noscripts [root@centos78 ~]]# yum-complete-transaction --cleanup-only No unfinished transactions left. # 执行最近一次的yum命令 [root@centos78 ~]]# yum history redo last

  

 

[root@cl-server yum.repos.d]# yum 已加载插件:fastestmirror 您需要给出命令 Usage: yum [options] COMMAND List of Commands: check 检查 RPM 数据库问题 check-update 检查是否有可用的软件包更新 clean 删除缓存数据 deplist 列出软件包的依赖关系 distribution-synchronization 已同步软件包到最新可用版本 downgrade 降级软件包 erase 从系统中移除一个或多个软件包 fs Acts on the filesystem data of the host, mainly for removing docs/lanuages for minimal hosts. fssnapshot Creates filesystem snapshots, or lists/deletes current snapshots. groups 显示或使用、组信息 help 显示用法提示 history 显示或使用事务历史 info 显示关于软件包或组的详细信息 install 向系统中安装一个或多个软件包 list 列出一个或一组软件包 load-transaction 从文件名中加载一个已存事务 makecache 创建元数据缓存 provides 查找提供指定内容的软件包 reinstall 覆盖安装软件包 repo-pkgs 将一个源当作一个软件包组,这样我们就可以一次性安装/移除全部软件包。 repolist 显示已配置的源 search 在软件包详细信息中搜索指定字符串 shell 运行交互式的 yum shell swap Simple way to swap packages, instead of using shell update 更新系统中的一个或多个软件包 update-minimal Works like upgrade, but goes to the 'newest' package match which fixes a problem that affects your system updateinfo Acts on repository update information upgrade 更新软件包同时考虑软件包取代关系 version 显示机器和/或可用的源版本。 Options: -h, --help 显示此帮助消息并退出 -t, --tolerant 忽略错误 -C, --cacheonly 完全从系统缓存运行,不升级缓存 -c [config file], --config=[config file] 配置文件路径 -R [minutes], --randomwait=[minutes] 命令最长等待时间 -d [debug level], --debuglevel=[debug level] 调试输出级别 --showduplicates 在 list/search 命令下,显示源里重复的条目 -e [error level], --errorlevel=[error level] 错误输出级别 --rpmverbosity=[debug level name] RPM 调试输出级别 -q, --quiet 静默执行 -v, --verbose 详尽的操作过程 -y, --assumeyes 回答全部问题为是 --assumeno 回答全部问题为否 --version 显示 Yum 版本然后退出 --installroot=[path] 设置安装根目录 --enablerepo=[repo] 启用一个或多个软件源(支持通配符) --disablerepo=[repo] 禁用一个或多个软件源(支持通配符) -x [package], --exclude=[package] 采用全名或通配符排除软件包 --disableexcludes=[repo] 禁止从主配置,从源或者从任何位置排除 --disableincludes=[repo] disable includepkgs for a repo or for everything --obsoletes 更新时处理软件包取代关系 --noplugins 禁用 Yum 插件 --nogpgcheck 禁用 GPG 签名检查 --disableplugin=[plugin] 禁用指定名称的插件 --enableplugin=[plugin] 启用指定名称的插件 --skip-broken 忽略存在依赖关系问题的软件包 --color=COLOR 配置是否使用颜色 --releasever=RELEASEVER 在 yum 配置和 repo 文件里设置 $releasever 的值 --downloadonly 仅下载而不更新 --downloaddir=DLDIR 指定一个其他文件夹用于保存软件包 --setopt=SETOPTS 设置任意配置和源选项 --bugfix Include bugfix relevant packages, in updates --security Include security relevant packages, in updates --advisory=ADVS, --advisories=ADVS Include packages needed to fix the given advisory, in updates --bzs=BZS Include packages needed to fix the given BZ, in updates --cves=CVES Include packages needed to fix the given CVE, in updates --sec-severity=SEVS, --secseverity=SEVS Include security relevant packages matching the severity, in updates 插件选项:

  



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3