【linux命令】yum命令

正文

yum命令

查看提供某个命令的rpm包:

# yum provides gcc
Loading mirror speeds from cached hostfile
 * base: mirrors.bupt.edu.cn
 * centos-sclo-rh: mirrors.nju.edu.cn
 * centos-sclo-sclo: mirrors.nju.edu.cn
 * extras: mirrors.nju.edu.cn
 * updates: mirrors.nju.edu.cn
devtoolset-7-gcc-7.1.1-2.1.el7.x86_64 : GCC version 7
Repo        : centos-sclo-rh
Matched from:
Provides    : gcc = 7.1.1-2.1.el7



gcc-4.8.5-44.el7.x86_64 : Various compilers (C, C++, Objective-C, Java, ...)
Repo        : base



gcc-4.8.5-39.el7.x86_64 : Various compilers (C, C++, Objective-C, Java, ...)
Repo        : @anaconda

 

查看rpm包信息:

[root@node01 ~]# dnf info perl-4:5.26.3-422.el8.x86_64
Repository extras is listed more than once in the configuration
Last metadata expiration check: 1:55:30 ago on Wed 13 Nov 2024 02:28:40 PM CST.
Installed Packages
Name         : perl
Epoch        : 4
Version      : 5.26.3
Release      : 422.el8
Architecture : x86_64
Size         : 0.0  
Source       : perl-5.26.3-422.el8.src.rpm
Repository   : @System
From repo    : appstream
Summary      : Practical Extraction and Report Language
URL          : http://www.perl.org/
License      : GPL+ or Artistic
Description  : Perl is a high-level programming language with roots in C, sed, awk and shell
             : scripting. Perl is good at handling processes and files, and is especially
             : good at handling text. Perl's hallmarks are practicality and efficiency.
             : While it is used to do a lot of different things, Perl's most common
             : applications are system administration utilities and web programming.
             : 
             : This is a metapackage with all the Perl bits and core modules that can be
             : found in the upstream tarball from perl.org.
             : 
             : If you need only a specific feature, you can install a specific package
             : instead. E.g. to handle Perl scripts with /usr/bin/perl interpreter,
             : install perl-interpreter package. See perl-interpreter description for more
             : details on the Perl decomposition into packages.

 

yum命令的参数有很多,其中就有只是下载而不需要安装的命令,并且也会自动解决依赖;通常和 --downloaddir 参数一起使用。

yum install --downloadonly --downloaddir=DIR [package_name]

例如:

yum install --downloadonly --downloaddir=/tmp/ vsftpd
yum reinstall --downloadonly --downloaddir=/tmp/ vsftpd

说明:如果该服务器已经安装了需要下载的软件包,那么使用 install下载就不行,可以使用reinstall下载。 放心(不会真的安装和重新安装,因为后面加了 --downloadonly,表明只是下载。

 

下面命令会自动处理依赖关系,比直接使用 rpm -i 命令更方便。

yum localinstall package.rpm

参考资料

1. 通过yum命令只下载rpm包不安装

 

posted @   苏格拉底的落泪  阅读(30)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
点击右上角即可分享
微信分享提示