Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Common operations of YUM tools in Linux system

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1. Introduction to YUM 1. The meaning of YUM

YUM, whose full name is Yellowdog Updater Modified, is a Shell front-end package manager based on RPM package management. Because it is based on the RPM package manager, the scenario used is similar to RPM, and the main supported Linux operating systems are: RedHat, CentOS, Fedora. YUM also provides graphical front-end tools: yumex and kyum, which need to be used if yum works properly.

2. YUM features using python development needs the corresponding software warehouse (repository) automatic upgrade, installation, removal of rpm software package can well solve the problem of RPM software package dependence can be customized multiple repositories / yum sources (repository) 3. YUM workflow executes yum commands to read yum configuration files, get warehouse information and search metadata files in the warehouse Determine the required software and dependent software download related software packages and check files install the software packages sequentially when the remote warehouse is updated, you can update the local cache (software meta-information) through the corresponding commands. 2. Common operations

After the installation of the system, the network source has been configured by default. When the network is unblocked, you can use the yum command to complete the software installation, upgrade, uninstall and other operations.

1. Common instruction install {package1} [package2] [...] The latest version of the software and related dependencies will be installed. Multiple packages can be installed at the same time. The specified package can be either a name or a rpm package file separated by a space. When specified as a rpm package file, the effect is equivalent to localinstallupdate/update-to [package1] [package2] [...] Update all software of the system to the latest version when the package parameters are left empty. The specified package can be either a name or a rpm package file. When specified as a rpm package file, the effect is equivalent to localupdateupdate-to: you can specify to upgrade the software to a certain version of check-update: list all updatable software.

Remove/erase {package1} [package2] [...]: delete the specified package list is equivalent to all when no parameters are written: list all available package information and installed package information available: list all packages that can be installed in the YumSource updates: list all packages available for upgrade in yum installed: list all installed package information

Info: lists the details of one or all of the software, and supports the same options as list

The effect of clean is equivalent to clean all when parameters are left empty: all local cache files will be cleared packages: all downloaded software packages will be cleared, and metadata will not be automatically deleted by default: clear downloaded meta-information cache files, and cache expire-cache will be re-downloaded when yum is run again: clear expired cache if cache data is still available Delete operation will not be performed rpmdb: clear all rpm software database information cached locally plugins: clear cache data corresponding to all plug-ins all: clear all cache data listed above makecache: cache metadata locally

Search {string1} [string2] [...]: search for software packages based on the information provided, give priority to search by name, if not found, use description information and url to match localinstall {rpmfile1} [rpmfile2] [...]: install a rpm package using yum, and automatically search for the dependent software needed for installation localupdate {rpmfile1} [rpmfile2] [...]: upgrade a rpm package using yum Automatically search the available sources for reinstall {package1} [package2] [...]: reinstall a software package, based on the most recently installed version, deplist {package1} [package2] [...]: list the dependent software related to a package.

Only part of the content was intercepted. Well, sure enough, rpm software dependence can turn into a nightmare if you are not careful. Yum, thanks for having you.

Repolist [all/enabled/disabled] all: show all yum sources enabled: show all open yum sources disabled: show all closed yum sources

Check: check the local rpm database and product information for errors. 2. Common option-y: automatically use the option in the yes response process-Q: cancel the output, silent installation-v: output details-R: set the maximum waiting time, in minutes-‌-version: display the current yum tool version

-‌-skip-broken: solve the dependency error problem when uninstalling the software-‌-downloadonly: download the software only-‌-downloaddir: specify the download path of the software package 3. Management and maintenance of Yum source 1. Yum configuration file yum configuration file directory: / etc/yum.repos.dyum configuration file: * .repo2. Configure domestic Mirror

By default, Base corresponds to the configuration of network images, and Media corresponds to the configuration of local images. The network image address is the list of images provided by centos.org. You can modify the images to domestic Ali, NetEase and other images to improve the download speed.

Backup the original Base configuration file (optional) cd / etc/yum.repos.dmv CentOS-Base.repo CentOS-Base.repo.bak download the Aliyun yum configuration file and write it to the corresponding file wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

Generate cache yum makecache IV, local YUM source configuration 1. Configuration item description [serverid]: unique identification of repo, used to distinguish different reponame: description of repo, support writing mirrorlist: image list address using $to reference variable value. After opening, there is a list recording multiple image addresses. Automatically scan these lists to select image resources release: release version, corresponding to the large version number, such as: 6prime7arch: system architecture. 32 bits generally correspond to i386. 64-bit corresponds to x86_64repo: warehouse type, such as os, fasttrack and other infra: this option can be omitted. The corresponding value is stock, which can be viewed in / etc/yum/vars/infra.

Baseurl: directly points to a yum source address, supports multiple protocols http: network transfer protocol ftp: file transfer protocol file: file protocol, can point to a local disk path gpgcheck: whether to enable gpg check 0: turn off gpgkey: specify check file URLenabled: whether to enable the configuration 0: close 1: enable failovermethode: how to select roundrobin in case of warehouse failure: default option, randomly select priority: pick 2 in order. Mount the CD image

Because the system image contains most of the commonly used software packages, it is generally used as the yum source when offline. When using a virtual machine, you can mount the CD image directly, and when you use the physical machine, you can set up a ftp server or burn the CD image file to a U disk and mount it, or copy all the contents to a certain path of the system.

After mounting the CD image, it will be identified as cdrom under / dev, and mount it using the following command:

Mkdir / mnt/cdrommount / dev/cdrom / mnt/cdrom

3. Modify the configuration file to invalidate the default Base configuration, otherwise the server cannot be found without a network connection. Mv / etc/yum.repos.d/CentOS-Base.repo / etc/yum.repos.d/CentOS-Base.repo.bak use the Media file as the template and specify baseurl as the CD mount path. The complete configuration content is as follows (CentOS-Media.repo):

[c6-media] name=CentOS-$releasever-Mediabaseurl= file:///mnt/cdrom/gpgcheck=0enabled=1

If gpgcheck is specified as 1, you need to correctly specify the value of gpgkey as the path to the verification file, such as: / mnt/cdrom/RPM-GPG-KEY-CentOS-6

4. Available authentication yum makecache

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report