linux 命令安装yum_Yum命令教程,提供Linux软件包管理示例,例如安装,更新,删除...

linux 命令安装yum

linux 命令安装yum

Linux applications installed (generally) as packages. Packages contain required files like binary, configuration, database, data, graphic, etc. All files packaged to one file named rpm. There is a lot of packages in fedora or other rpm based distribution to manage.

Linux应用程序(通常)作为软件包安装。 软件包包含必需的文件,例如二进制文件,配置文件,数据库,数据,图形等。所有文件打包为一个名为rpm的文件。 在fedora或其他基于rpm的发行版中有很多软件包需要管理。

Keep in mind that there is also a different version of packages like a1,a2,a3. Packages are named like wireshark-1.10.7-3.fc20.x86_64. Here Wireshark is package real name as we know, 1.10.7-3 is the version number used in Wireshark, fc20  shows that this packages used in fedora core 20 but it is not must you can use this packet if you supply dependencies of package, latest x86_64 means that this package includes 64 bit binaries and this is important because it will not work with 32 bit libraries or OS if you see noarch it means that there is no architecture-specific binary. Do we look at all of these things when installing applications? NO, because a lot of work is done by yum rpm manager. Yum, use rpm to make things more smooth and easy. So we just write package name and it installs it.

请记住,还有其他版本的软件包,例如a1,a2,a3。 软件包的名称类似于wireshark-1.10.7-3.fc20.x86_64 。 这里的Wireshark是我们所知的软件包真实名称, 1.10.7-3是Wireshark中使用的版本号, fc20表示该软件包在fedora core 20中使用,但是如果您提供软件包的依赖项,则不必使用此数据包,最新的x86_64表示此软件包包括64位二进制文​​件,这很重要,因为如果您看到noarch ,则它将不适用于32位库或OS,这意味着没有特定于体系结构的二进制文件。 在安装应用程序时,我们会看所有这些东西吗? 否,因为yum rpm管理器完成了大量工作。 百胜,使用rpm可使事情变得更加流畅和轻松。 因此,我们只需编写软件包名称并安装它即可。

安装软件包 (Install A Package)

Installing a package is very easy you can add more packages with space delimiter. Here we will install Wireshark core package and GCC which is a c compiler. If we want to install them without answering yes/no question we must provide -y between yum and install like yum -y install. Here yum resolves dependencies and show installation required packages. There is 9 required package.

安装软件包非常容易,您可以使用空格分隔符添加更多软件包。 在这里,我们将安装Wireshark核心软件包和ac编译器GCC。 如果要安装它们而不回答是/否问题,则必须在yum和install之间提供-y,例如yum -y install 。 在这里,yum解决了依赖性并显示了安装所需的软件包。 有9个必需的程序包。

$ yum install wireshark gcc
Install Package
Install Package
安装套件

从指定的存储库安装软件包(Install A Package From Specified Repository)

As we will see below yum can use multiple repositories and the same package can be provided from multiple repositories. While installing this package we can specify specific repository like below.

正如我们将在下面看到的,yum可以使用多个存储库,并且可以从多个存储库提供相同的软件包。 在安装此软件包时,我们可以指定特定的存储库,如下所示。

$ yum --enablerepo="centosplus/7/x86_64"_64 install  tmux

自动确认/是 (Automatic Confirmation / Yes)

While operating with yum commands for caution reasons confirmations exist. If we are confident what we do we simply provide -y parameter to accept all confirmation questions like below.

谨慎使用yum命令进行操作时,存在确认。 如果我们有信心,我们只需提供-y参数即可接受所有确认问题,如下所示。

$ sudo yum install tmux -y

安装组软件包 (Install Group Packages)

If we want to install group which includes a group of packages for similar targets like gnome desktop, KDE desktop, etc. we can use @ sign before package name

如果我们要安装包括针对类似目标(例如gnome桌面,KDE桌面等)的一组软件包的组,则可以在软件包名称前使用@符号

$ sudo yum install @"KDE Plasma Workspaces"
Install Group Packages
Install Group Packages
安装组包

搜索包(Search Package)

To search packages with specific word use search. If you want to search all areas of package description use all parameter.

要搜索带有特定单词的软件包,请使用搜索。 如果要搜索包装说明的所有区域,请使用all参数。

$ yum search wiresh
Search Package
Search Package
搜索包

搜索更多详细信息(Search More Details)

Name and summary matches only, use “search all” for everything.

名称和摘要仅匹配,对所有内容使用“全部搜索”。

$ yum search all wiresh
Search More Details
Search More Details
搜索更多详细信息

列出包裹(List Packages)

If you want to list all available packages use list option. But there may be a lot of output you can filter it with grep

如果要列出所有可用软件包,请使用列表选项。 但是可能会有很多输出,您可以使用grep对其进行过滤

$ yum list
List Packages
List Packages
列出包裹

更新包(Update Packages)

To update packages use an update. You can specify version if not it is updated to the latest. If not installed it is installed. To see any updates available use check-update which outputs updated packages count. The upgrade is the same but looks for the obsolete flag.

要更新软件包,请使用更新。 如果未指定版本,则可以将其更新为最新版本。 如果未安装,则已安装。 要查看可用的任何更新,请使用check-update,它输出更新的软件包计数。 升级是一样的,但是会寻找过时的标志。

$ sudo yum update
Update Packages
Update Packages
更新包

列出组包(List Group Packages)

Repositories provide packages. There can be more than one repository configured in a Linux system. Packages provided configured repositories can be listed like below.

存储库提供软件包。 Linux系统中可以配置多个存储库。 可以按如下所示列出已配置的存储库提供的软件包。

$ yum grouplist
List Group Packages
List Group Packages
列出组包

列出已安装的组软件包(List Installed Group Packages)

There is an option to the only list installed group packages.

仅列出已安装的组软件包有一个选项。

$ yum grouplist installed
List Installed Group Packages
List Installed Group Packages
列出已安装的组软件包

移除包裹(Remove Package)

To remove packages use to remove or erase which removes all files and dependencies.

要删除软件包,请使用“删除”或“擦除”来删除所有文件和依赖项。

$ sudo yum remove wireshark
Remove Package
Remove Package
移除包裹

删除组包(Remove Group Packages)

Group packages can be removed like a regular package. To remove group packages just provide groupremove like below.

可以像常规软件包一样删除组软件包。 要删除组软件包,只需提供groupremove如下所示。

$ sudo yum groupremove "GNOME Desktop"
Remove Group Packages
Remove Group Packages
删除组包

查找带有文件路径的软件包名称(Find Package Name With File Path)

If you want to search a filename in packages use provides or whatprovides. This is a very handy option for looking at what file belongs to what package. Here we query /etc/grub2.cfg and get results from different versions of grub.

如果要在包中搜索文件名,请使用whatprovideswhatprovides 。 这是查看哪个文件属于哪个程序包的非常方便的选项。 在这里,我们查询/etc/grub2.cfg并从不同版本的grub获取结果。

$ yum whatprovides /etc/grub2.cfg
Look Package Name
Look Package Name
外观包装名称

包装信息(Package Information)

To get info about a package use info. Wireshark has two packages for x64 and x86 which is shown i686. This will provide information like name, architecture, version, release, size, repository, description, license

要获取有关包装的信息,请使用信息。 Wireshark有两个用于x64和x86的软件包,显示为i686。 这将提供诸如名称,体系结构,版本,发行版,大小,存储库,描述,许可证之类的信息

$ yum info wireshark
Package Information
Package Information
包装信息

清理缓存(Clean Cache)

To clear cache files and get more free space. We can use this command for every 1-2 months. This option has parameters but using all is most practical usage.

清除缓存文件并获得更多可用空间。 我们可以每1-2个月使用此命令。 该选项具有参数,但是使用all是最实际的用法。

$ sudo yum clean all
Clean Cache
Clean Cache
清理缓存

百胜互动壳牌(Yum Interactive Shell)

Yum, the shell is used for batch or interactive command line if you specify file the yum commands in the file are executed if not you will get a shell to run yum commands.

百胜,如果您指定文件,该shell用于批处理或交互式命令行,否则将执行该文件中的yum命令,否则您将获得一个运行yum命令的shell。

$ sudo yum shell
Yum Shell
Yum Shell
百胜餐饮

重新安装套件(Reinstall Package)

Installed packages can be installed again. This will reconfigure the package and clean the binaries and configuration of the package.

已安装的软件包可以再次安装。 这将重新配置软件包,并清除二进制文件和软件包的配置。

$ sudo yum reinstall wireshark
Reinstall Package
Reinstall Package
重新安装套件

降级包(Downgrade Package)

This is a rare situation. Packages can be downgraded which means installing older versions. If there is an application relies on old releases this feature can be used. To downgrade a package exact version must be exist configured repository.

这是一种罕见的情况。 软件包可以降级,这意味着安装较旧的版本。 如果某个应用程序依赖于旧版本,则可以使用此功能。 要降级软件包,必须存在已配置的存储库的确切版本。

$ sudo yum downgrade qemu-img-1.6.2-5.fc20.x86_64

列出软件包的依赖关系 (List Package Dependencies)

Dependency is the requirement to install a package. A package dependency is another package like libraries, binaries, frameworks. The dependency of a package can be got by providing the package name like below.

依赖关系是安装软件包的要求。 包依赖性是另一个包,例如库,二进制文件和框架。 可以通过提供如下所示的包名称来获得包的依赖关系。

$ yum deplist wireshark
List Package Dependencies
List Package Dependencies
列出软件包的依赖关系

列出启用的存储库(List Enabled Repositories)

Generally, Linux systems are configured to use more than one repository. There are also popular repositories provided by third parties. All these repositories can be listed with repolist command.

通常,Linux系统配置为使用多个存储库。 也有第三方提供的流行存储库。 所有这些存储库都可以使用repolist命令列出。

$ yum repolist
List Repositories
List Repositories
列出资料库

列出所有资料库(List All Repositories)

By default yum repolist command provides enabled repositories. There may be some repositories not enabled and not used. Providing all will list all enabled and not enabled repositories.

默认情况下, yum repolist命令提供启用的存储库。 可能有一些未启用和未使用的存储库。 全部提供将列出所有已启用和未启用的存储库。

$ yum repolist all
List All Repositories
List All Repositories
列出所有存储库

打印详细的存储库信息(Print Detailed Repository Information)

In the previous example, we have listed repositories. Details about these repositories can be listed with repoinfo command.

在前面的示例中,我们列出了存储库。 可以使用repoinfo命令列出有关这些存储库的详细信息。

$ yum repoinfo base/7/x86_64
Print Detailed Repository Information
Print Detailed Repository Information
打印详细的存储库信息

repoinfo provides repository information like repository id, name, status, revision, package count, size, mirrors, base URL, expire and file name.

repoinfo提供存储库信息,例如存储库ID,名称,状态,修订,包数,大小,镜像,基本URL,到期和文件名。

LEARN MORE  How To Apt-Get Update, Upgrade, Dist-Upgrade, Full-Upgrade, and Their Similarities and Differences?
了解更多信息如何获得更新,升级,远程升级,完全升级以及它们的异同?

百胜指挥历史 (Yum Command History)

Yum provides a practical way to see the history of yum with history parameter. To see yum history we can also look to the /var/log/yum.log for more detailed info. history command provides command id, command, issued date and time, action and changed package count.

百胜提供了一种使用历史参数查看百胜历史的实用方法。 要查看yum历史记录,我们还可以查看/var/log/yum .log以获取更多详细信息。 history命令提供命令ID,命令,发布的日期和时间,操作和更改的包数。

$ sudo yum history
History
History
历史

恢复交易(Resume Transaction)

Think about this while installing packages with yum the ssh connection is lost. What will happen can we resume from where we left? Yes. Some times there is an error or disrupt and you need to resume the transaction.

使用yum安装软件包时,请考虑一下此问题,ssh连接会丢失。 我们可以从离开的地方恢复过来吗? 是。 有时会出现错误或中断,您需要恢复交易。

$ sudo yum load-transaction /tmp/yum_save_tx.2017-01-12.13-02.LIA7DG.yumtx
Resume Transaction
Resume Transaction
恢复交易

百胜数据库完整性检查(Yum Database Integrity Check)

check command will check the status of the yum database. If it founds some corruption it will try to recover this.

check命令将检查yum数据库的状态。 如果发现损坏,它将尝试恢复该损坏。

$ yum check

百胜配置文件 (Yum Configuration File)

Generally yum configuration resides /etc/yum.conf and /etc/yum.conf.d and these paths are used as default. If you want to specify different yum configuration file use -c option

通常,yum配置位于/etc/yum.conf/etc/yum.conf.d中,并且这些路径用作默认路径。 如果要指定其他yum配置文件,请使用-c选项

$ yum -c yum.conf search wiresha
Yum Configuration File
Yum Configuration File
百胜配置文件

详细模式(Verbose Mode)

While using operation commands with yum we may want to get more informed about running the command. We can use -v option to see more details about yum operations.

在将操作命令与yum一起使用时,我们可能希望获得有关运行命令的更多信息。 我们可以使用-v选项查看有关yum操作的更多详细信息。

$ yum -v search wiresha
Verbose Mode
Verbose Mode
详细模式

不进行GPG /摘要检查的安装(Install Without GPG/Digest Check)

Rpm files are signed for security reasons but some times it may be a trivial problem and we want to disable signature checking use --nogpgcheck. But generally, do not prefer using this option which will provide some security thread for the installed packages.

出于安全原因对Rpm文件进行签名,但有时可能是一个小问题,我们希望使用--nogpgcheck禁用签名检查。 但是通常不希望使用此选项,因为它会为安装的软件包提供一些安全性。

$ sudo yum install --nogpgcheck tmux
Install Without GPG/Digest Check
Install Without GPG/Digest Check
不进行GPG /摘要检查的安装

跳过损坏的软件包以进行更新(Skip Broken Packages For Update)

Sometimes updates come with broken dependencies or packages so you can skip all of them and install other packages without problem use –skip-broken

有时更新附带损坏的依赖项或软件包,因此您可以跳过所有更新或安装其他软件包而不会出现问题–skip-broken

$ sudo yum --skip-broken update
Skip Broken Packages For Update
Skip Broken Packages For Update
跳过损坏的软件包以进行更新

仅下载包(Only Download Package)

To just download packages not install them you can install them later. This will download package to the current working directory like a name tmux-1.8-4.el7.x86_64.rpm

要仅下载软件包而不安装它们,可以稍后再安装。 这会将软件包下载到当前工作目录,例如名称tmux-1.8-4.el7.x86_64.rpm

$ sudo yum --downloadonly install tmux
Download Package
Download Package
下载包

翻译自: https://www.poftut.com/yum-command-tutorial-with-examples-for-linux-package-management-like-install-update-remove/

linux 命令安装yum

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值