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

What is the introduction, file configuration and simple usage of yum

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces the introduction and file configuration and simple usage of yum to you. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

Simple usage of yum

The bottom layer of yum is implemented through rpm, but yum solves the dependency problem when installing the software, and automatically deals with the package dependency when installing.

When using yum, you need to configure yum services, and each yum service will provide software functions that you can't listen to. Yum services will be classified according to their functions, which means different repositories. The system will have its own warehouse, as long as the computer can be connected to the Internet to use the warehouse, you can download and install software packages, of course, there is no need to connect to the Internet to install software packages, there are requirements, there are solutions, described later.

Configuration file for yum:

Main configuration file: / etc/yum.conf to provide common configuration files for each warehouse

Definition of each warehouse: / etc/yum.repo.d/*.repo, files must be suffixed with .repo

First, a brief introduction to the use of the following yum:

Format: yum option package name

Common options:

Install: installing software packages

You only need to provide the package name during installation.

If there are multiple versions in different repositories, the latest version will be installed by default

If you want to install a specified version, you need to specify the version number

-y: interactive reminder of whether to install or not during installation. Specify-y to answer yes automatically without manual confirmation.

Reinstall: reinstall and overwrite the original package

Remove: uninstall the package

Search: search for software packages that support fuzzy matching

Info: view brief information about the program

List: list the current system installation packages, too many, directly use search to check.

Grouplist: lists the current system package groups

Groupinstall: package group installation

If the package group name contains special characters such as spaces during installation, it should be enclosed in quotation marks, for example: yum groupinstall "development tools"

Groupremove: uninstall the package group

Groupinfo: package group brief information

History: check the installation history, it will show the installation time, user, number, action, etc.

Undo serial number: uninstall and uninstall all dependent packages when installing the software, which is equivalent to undoing the previous action and using it with caution, because the dependent package may be dependent on other software.

Redo serial number: reinstall, as opposed to undo.

Yum's warehouse management tools:

Clean: cleaning cache

All: all caches

Package: specify package cache

Metadata: specify repository cache

Repolist: list all configured repositories and create cache in disguise

Makecache: create a cache, automatically connect to every available repository, download data, and create as a cache

Yum configuration format

There are two ways to create an yum repository:

The first is to use CD-ROM image directly. This method is only suitable for local use and can be used when there is no network.

The second is to create a network yum warehouse, through the Internet Ali Yun, Tsinghua University, 163to achieve.

Create the yum repository configuration format:

[repo ID]: the name of the warehouse

Name= [name]: alias

Baseurl=url://...: the address of the warehouse, there are several types

File://: local path addr

Http://: network path address

Https://: a secure network path address

Ftp://: network path address based on ftp service

Gpgcheck= {0 | 1}: whether to check validity. 0: no check; 1: check. Default is 1.

Enabled= {0 | 1}: whether to enable warehouse. Default is enabled, 0 bit is not enabled.

Gpgkey=URL: public key address

Create a local source usage example:

First mount the CD to the / meida/cdrom directory

Create a new file with the suffix .repo, such as centos.repo

The content is:

[DVDbase]

Name=centos7-base

Baseurl= file:///media/cdrom

Gpgcheck=0

With these lines, the local yum is built, and multiple sources can be created in the same file.

The following is the epel source, which requires the host to access the Internet.

[EPEL]

Name=centos7-epel

Baseurl= https://mirrors.aliyun.com/epel/$releasever/$basearch/

Baseurl= https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/$basearch/

Gpgcheck=0

The built-in variable of $releasever:yum will automatically determine the system major version number centos 6 or centos 7.

$basearch: system platform, such as x86room64

Use yum clean all to clear the cache after the configuration file is completed, and yun repolist in use can list the currently available repositories.

For example: install packages such as tree,ftp,lftp,telnet.

Yum installation can be installed with multiple packages at the same time

[root@centos6 yum.repos.d] # yum install tree ftp lftp telnetLoaded plugins: fastestmirror, refresh-packagekit SecuritySetting up Install ProcessDetermining fastest mirrorsResolving Dependencies-- > Running transaction check--- > Package ftp.x86_64 0Rule 0.17-54.el6 will be installed--- > Package lftp.x86_64 0RU 4.0.9-14.el6 will be installed--- > Package telnet.x86_64 1Rom 0.17-48.el6 will be installed--- > Package tree.x86_64 0Rom 1.5.3-3.el6 will be installed-- > Finished Dependency ResolutionDependencies Resolved==== Package Arch Version Repository Size====Installing: ftp x86'64 0.17-54.el6 base 58 k lftp x86'64 4.0.9-14.el6 base 755 k telnet x86'64 1 54.el6 base 0.17-48.el6 base 58k tree x86164 1.5.3-3.el6 base 36 kTransaction Summary====Install 4 Package (s) Total download size: 907kInstalled size: 2.8MIs this ok [ydeband N]: yDownloading Packages: -- Total 24 MB/s | 907 kB 00:00 Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionWarning: RPMDB altered outside of yum. Installing: lftp-4.0.9-14.el6.x86_64 1 Installing 4 Installing: ftp-0.17-54.el6.x86_64 2 Charley 4 Installing: tree-1.5.3-3.el6.x86_64 3 Installing 4 Installing: 1Rose telnet- 17-48.el6.x86_64 4 Verifying: 1:telnet-0.17-48.el6.x86_64 1 Verifying: tree-1.5.3-3.el6.x86_64 2 Verifying: ftp-0.17-54. El6.x86_64 3 to 4 Verifying: lftp-4.0.9-14.el6.x86_64 4 to 4 Installed: ftp.x86_64 0 to 0. 17-54.el6 lftp.x86_64 0 to 4. 9-14.el6 telnet.x86_64 1:0. 17-48.el6 tree.x86_64 0VLA 1.5.3-3.el6 Complete!

Write system initialization script reset.sh, including aliases, prompt colors, yum repository configuration files

# / bin/bashecho "alias cdnet='cd / etc/sysconfig/network-script/'" > > / root/.vimrcecho 'PS1= "\ 033 [1 politics 32m [\ u @\ h\ W] #\ 033 [0m" > > / etc/profile.d/env.shcat > / etc/yum.repos.d/centos.repo

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