【Linux】Tool Yum package (C++)

Table of contents

1. What is a software package?

2. Check the software package with yum

3. yum installation software

4. Yum uninstall software


1. What is a software package?

  • When installing 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 and make it into a software package (which can be understood as an installation program on Windows) and put it on a server. This compilation can be easily obtained through the package manager. Good software package, install it directly.

  • Software packages and software package managers are like the relationship between "App" and "App Store".

  • yum (Yellow dog Updater, Modified) is a very commonly used package manager under Linux. It is mainly used in Fedora, RedHat, Centos and other distributions.

2. Check the software package with yum

        You can use the yum list command to list the current software packages. Since the number of packages may be very large, here we need to use the grep command to filter out only the packages we care about. For example:

yum list                    // 搜索所有可安装的软件
yum list | grep sl          // 搜索指定的软件
​
// 搜索结果:
lrzsz.x86_64                             0.12.20-36.el7                @os 
//.......会搜索出很多.

Precautions

  • Software package name: major version number. minor version number. source program release number - software package release number. host platform. cpu architecture.

  • The "x86_64" suffix indicates the installation package for 64-bit systems, and the "i686" suffix indicates the installation package for 32-bit systems. When selecting the package, it must match the system.

  • "el7" represents the operating system release version. "el7" represents centos7/redhat7. "el6" represents centos6/redhat6.

  • The last column, base, represents the name of the "software source", similar to concepts such as "Xiaomi App Store" and "Huawei App Store".

3. yum installation software

Through yum, we can complete the installation of gcc         with a very simple command .

        yum will automatically find which software packages need to be downloaded. At this time, type "y" to confirm the installation. The word "complete" will appear , indicating that the installation is complete.

sudo yum install sl     // 普通的安装.
sudo yum install sl -y  // -y安装时不提示询问信息.


    
// 查询结果:
[shaxiang@VM-8-14-centos myTmp]$ sudo yum install sl -y
[sudo] password for shaxiang: 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
epel                                                          | 4.7 kB  00:00:00     
extras                                                        | 2.9 kB  00:00:00     
os                                                            | 3.6 kB  00:00:00     
updates                                                       | 2.9 kB  00:00:00     
updates/7/x86_64/primary_db                                   |  20 MB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package sl.x86_64 0:5.02-1.el7 will be installed
--> Finished Dependency Resolution
​
Dependencies Resolved
​
=====================================================================================
 Package         Arch                Version                 Repository         Size
=====================================================================================
Installing:
 sl              x86_64              5.02-1.el7              epel               14 k
​
Transaction Summary
=====================================================================================
Install  1 Package
​
Total download size: 14 k
Installed size: 17 k
Downloading packages:
sl-5.02-1.el7.x86_64.rpm                                      |  14 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : sl-5.02-1.el7.x86_64                                              1/1 
  Verifying  : sl-5.02-1.el7.x86_64                                              1/1 
​
Installed:
  sl.x86_64 0:5.02-1.el7                                                             
​
Complete!

Precautions

  • When installing software, because you need to write content to the system directory, you generally need to sudo or switch to the root account to complete.

  • You can only install one software with yum before installing another. During the process of installing a software with yum, if you try to use yum to install another software, yum will report an error.

  • If yum reports an error, please go to Baidu.

4. Yum uninstall software

// 指令格式
sudo yum remove sl


​
// 执行结果:
[shaxiang@VM-8-14-centos myTmp]$ sudo yum remove sl
[sudo] password for shaxiang: 
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package sl.x86_64 0:5.02-1.el7 will be erased
--> Finished Dependency Resolution
​
Dependencies Resolved
​
=====================================================================================
 Package        Arch               Version                   Repository         Size
=====================================================================================
Removing:
 sl             x86_64             5.02-1.el7                @epel              17 k
​
Transaction Summary
=====================================================================================
Remove  1 Package
​
Installed size: 17 k
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : sl-5.02-1.el7.x86_64                                              1/1 
  Verifying  : sl-5.02-1.el7.x86_64                                              1/1 
​
Removed:
  sl.x86_64 0:5.02-1.el7                                                             
​
Complete!

Guess you like

Origin blog.csdn.net/lx473774000/article/details/132769610