[Linux] package manager yum

Foreword :

  • If you understand the previous learning content as letting everyone know the basic knowledge of [linux] and use it, then the next learning knowledge is to let everyone develop programs in a pure [linux] environment. In order to achieve this For one purpose, we need the assistance of tools. Therefore, the next thing I will tell you is the common tools under [linux]! ! !


This article directory

(1) Talking about software packages

1. What is yum

(2) Background introduction

1. The principle of downloading (do you really understand downloading)

2. Reasons for the birth of software

3. Open source ecology

4. Software classification

(3) Use of yum

1. How to check the software package

2. Installation and uninstallation

3. Basic commands of yum

(4) yum source

a)CentOS-Base.repo

 b)CentOS-Epel.repo 

(5) Summary


(1) Talking about software packages

Before officially explaining the first tool, let me give you a concrete introduction to the concept of software packages. I wonder if you really understand it?

So what is a software package? Next give the answer:

  • To install software under Linux, a common method is to download the source code of the program and compile it to obtain an executable program.
  • But this is too troublesome, so some people compile some commonly used software in advance, make it into a software package (which can be understood as an installer on windows) and put it on a server, and this compilation can be easily obtained through the package manager Good software package, install it directly.
  • Software packages and package managers, in layman's terms, an example is like the relationship between "App" and "App Store" in daily life, so everyone may be clear.

Well, with the above content as a foreshadowing, we will start to study [yum] in depth. In the first step, let me give its specific concept, that is, what is [yum]? Let everyone first have a preliminary understanding of it.


1. What is yum

  • YUM, the full name of Yellow dog Updater, Modifier, is a free and open source command-line package management tool . It is a very commonly used package manager under Linux. It is mainly used in distributions such as Fedora, RedHat, and Centos.
  • Based on RPM package management, it can automatically download and install RPM packages from a specified server, automatically handle dependencies, and install all dependent software packages at one time without tedious downloading and installation again and again.
  • Yum provides commands to find, install, and delete a certain, a group, or even all software packages, and the commands are concise and easy to remember.

(2) Background introduction

By combining the concept of [yum] mentioned above, let's take the scene of downloading software in daily life as an example to take everyone to explore in depth! ! !

1. The principle of downloading (do you really understand downloading)

First of all, I would like to ask you a small question, that is, in daily life, whether it is an Android or an iPhone for a mobile phone, when we are going to the app store in the mobile phone to download software, the software in the mobile store is in your What about local? Or is it on your remote side?

  • I believe everyone should know the answer. For the software to be downloaded, it is not actually on your mobile phone. It is downloaded remotely, and downloaded from the server to our mobile phone through the application market.

Secondly, when you upload and download software on your mobile phone, the software is currently on the remote server. At this time, the problem arises. There are millions of servers or more on the remote server, so which server are you accessing when you download the software?

  • For us ordinary users, do we need to manage so much? Did you know that it has an impact on us? We only need to open the application market, find the software we need, and click to download it. At this time, the above download work is fully handed over to the mobile application market to solve.

  • For example, when we want to download [csdn] on our mobile phone, we open the app store on our own, find the corresponding software through query and search, and click download. At this time, the app store agent completes the download from the remote server The task of downloading software onto our phones. Therefore, when we click to download, we can see the download progress.

Therefore, by analogy, there is also a so-called "app store" under our [linux] to help us accomplish this task.

2. Reasons for the birth of software

For us, living in this era of highly developed information technology, it is already commonplace to visit various beeping stations or information communication every day. So why would someone provide us with such a massive [APP]? What is the purpose of these people?

  • The answer is simple, it just wants us to use its software so that its company can make money! It is all driven by profit.
  • In the past, Internet companies had a saying - the wool comes from the pig, and the dog pays the bill! ! I don’t know if you have used the [APP] well, but suddenly an advertisement pops up for you. What does that mean? It means that these Internet companies set up a platform for us to use and watch. At this time, our attention is on this [APP]. When there are active people, it will attract advertisers to deliver advertisements. Once there are advertisements, then Advertisers will pay the fee and make money in this way.

like this:

 

Then there are friends just out of curiosity: is there any advertisement for our [Linux]?

  • The answer is of course not. Have you seen anything other than code in [Linux]? Because [Linux] is a pure command-line operating system with no interface, others cannot push advertisements to you

3. Open source ecology

Speaking of which, are you guys curious? The [APP] you mentioned just now is ultimately for the company to make money, so is it the same for [linux]?

  • We said from the first blog that [Linux] is a free, open source operating system, which provides an open source community for some developers to communicate and learn from each other! ! !

It is based on open source, and most of them are free. Therefore, [linux] has been favored by most companies, and most companies use [linux]. Therefore, although its operation requires a server, and the server needs to be maintained after a long time of use, maintenance must be required Cost and labor, everyone will wonder who will deal with it?

  • In fact, for this situation, as I said just now, most companies on the market use this operating system, so the company is the company that is least willing to see such a scenario. I still remember that Luo Yonghao seemed to donate part of the money from selling products to the maintenance of open source.

4. Software classification

The software under [linux] is mainly divided into two categories, so which two categories are they?

Mainly divided into [system software] and [extension software]

  • Official software: This kind of software is usually common and can be named [recommended]
  •  Extension software: For this type of software, it is not actually official software. For example, the [sl] we are going to learn next is a typical extension software.

Next is the little trick for software selection:

First of all, I would like to ask everyone a small question, that is, do you like the latest version of the software?

  • For me, the [linux] system I am using now is CentOS7, and in this era of rapid development, there have been many newer software than it, so do I have to use it?

Next I will answer this question:

  • First of all, everyone likes to choose the latest model. It is nothing more than that the latest software must be upgraded on the basis of the old version, and it will definitely be easier to use than the old version. But you can be sure that although it solves the problems of the old version, won't the new version have new problems. Although some new operating systems solve some other problems, they will definitely face some new problems
  • As for the old version of the software, after all, it has been used for so long, and many problems have been relatively solved. If the new version is suddenly replaced at this time, then for those unpredictable "pitches", if you step on it If the loss is light, it is okay, but if it is serious, the consequences may be unbearable

(3) Use of yum

1. How to check the software package

First of all, when we want to install application software, we must first enter the [App Store], and then let’s take a look at what yum is in our [Linux]

  • We need to execute the following command to view the yum under the current [linux]
yum list | grep sl

Next, let's take a look through the instructions:

Everyone looks at the face of question marks? Don't worry, I will give you a little explanation next, so that everyone can get to know each other:

①The leftmost one is the name of the software under the operating system , this should be understandable! It mainly includes the following information:

  • Major version number ; minor version number; source program release number - release number of the software package; host platform.cpu architecture.

Immediately after the end, many suffixes will have "x86_64", what does it mean?

  • The main code is the installation package of the 64-bit system, and the "i686" suffix indicates the installation package of the 32-bit system. When selecting the package, it must match the system.

②Secondly, the middle part is the version it issued .

③The name behind @ on the far right is the **publisher** of this [yum], just like the app store on the phone 


2. Installation and uninstallation

First introduce the yum syntax:

yum [options] [command] [package ...]
  • options: optional, options include -h (help), -y (select all "yes" when prompted during the installation process), -q (do not display the installation process) and so on.
  • command: the operation to be performed.
  • package: The installed package name.

Next, let's install a tester:

Installed, I want to delete how to delete it? Very simple, see the following example:

 For the above installation method, we will pop up the scene where we manually enter [-y] to confirm, so is there a way that we don't need to manually enter it, but the system can complete it directly? Of course there are, as follows:

yum -y install sl.x86_64

 When we go to test this software, we will find an interesting thing, because it looks like a train.

Precautions

  • When installing the software, it is necessary to write content to the system directory, so generally [sudo] or switch to the [root] account is required to complete.
  • The yum installation software can only install one after the other is installed. In the process of yum installing a software, if you try to use yum to install another software, yum will report an error.

3. Basic commands of yum

Next, I will show you what are the commonly used commands under [yum].

1. List all updatable software inventory commands:

  • yum check-update

2. Update all software commands:

  • yum update

3. Install only specified software commands:

  • yum install <package_name>

4. Update only specified software commands:

  • yum update <package_name>

5. List all installable software inventory command:

  • yum list

6. Remove the package command:

  • yum remove <package_name>

7. Find the package command:

  • yum search <keyword>

8. Clear cache command:

  • yum clean packages: 清除缓存目录下的软件包
    yum clean headers: 清除缓存目录下的 headers
    yum clean oldheaders: 清除缓存目录下旧的 headers
    
      yum clean, yum clean all 
    = yum clean packages; 
    = yum clean oldheaders :清除缓存目录下的软件包及旧的 headers


(4) yum source

In the above study, we already know how to install and uninstall the software, is this enough? The answer is of course not enough. For an excellent learner, we not only need to know why, but also know why . Only by truly mastering its principle and use can we be able to say that we can master it! ! !

At the beginning, I have already mentioned to you the principle of downloading software on our mobile phone. For the mobile app store, how does it know where to download it?

  • Therefore, these application stores must know the download address of each software! For this download address, it is generally the built-in download address (configuration file)

So for yum in [Linux], how does it know where the software it is going to download is?

  • Based on the above situation , it is necessary to talk about [yum]'s own configuration file, which is what I will talk about next - yum source

So what is [yum]?

  • A repository (software warehouse) containing various rpm packages. We are used to calling this software warehouse a yum source or a yum warehouse. This source can be local or network.

The next question is where is [yum source]? How to view all the yum sources configured on your own machine? This requires the following command:

ls -l /etc/yum.repos.d/	//查看配置的【yum】源

Next, let's take a look:

Parse:

You may be confused about the things listed on the far right above, what do you mean? Next, let me introduce to you:

  •  CentOS-Base.repo [basic yum source]
  • CentOS-Epel.repo [extended yum source]

a)CentOS-Base.repo

Next, we can go to understand the two, as follows:

 b)CentOS-Epel.repo 

Notice:

  • If there is no problem when you use [yum] yourself, then we need to configure it again, and the [yum] source configuration file you see is the domestic mirror source—such as Huawei Cloud, Alibaba Cloud, 163, etc. It can be used, no need to configure it, if you still want to configure it yourself, I won’t explain it here, you can Baidu it! !

Finally, if you can’t find the software you want when installing the software you want, don’t panic at this time, maybe the software you are looking for will be in the extended yum source: epel.repo

  • At this point, we only need to execute the following command. At this point, the system will help us find the matching extended yum source based on your base yum source. details as follows:
yum install -y epel-release


(5) Summary

At this point, the introduction of the first [linux] tool we want to learn is over! !

The above is all the knowledge about [yum]. If this article is helpful to you, please give it a thumbs up! ! !

Guess you like

Origin blog.csdn.net/m0_56069910/article/details/129823564