标签:yum

一看必会系列:yum 安装老版本或指定版本的包

No Comments Linux

 

第一步,导入老版本源

[mariadb]
name = MariaDB-5.5.39
baseurl=https://downloads.mariadb.com/files/MariaDB/mariadb-5.5.39/yum/rhel6-amd64/
# alternative: baseurl=http://archive.mariadb.org/mariadb-5.5.39/yum/rhel6-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
 
将以上内容写入 /etc/yum.repo.d/mariadbxx.repo
 
yum makecache

 

------中间广告---------

[admin@centos73-amd64 ~]$ yum list –showduplicates MariaDB-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.mirrors.ovh.net
* extras: centos.mirrors.ovh.net
* updates: centos.mirrors.ovh.net
Available Packages
MariaDB-server.x86_64                10.1.31-1.el7.centos                mariadb
MariaDB-server.x86_64                10.1.32-1.el7.centos                mariadb
mariadb-server.x86_64                1:5.5.56-2.el7                      base
  
The MariaDB repository in this example contains MariaDB 10.1.31 and MariaDB 10.1.32. There is also MariaDB 5.5.56 in the CentOS base repository.

To install an older version of a package instead of the latest version we just need to specify the package name, a dash, and then the version number. And we only need to specify enough of the version number for it to be unique from the other available versions. So for this example, MariaDB-server-10.1.31 will work.

However, when installing an older version of a package, yum will automatically choose the latest versions of other dependent packages that it installs along side it, so to ensure that all MariaDB packages are on the same version it is necessary to specify them all when we install. The dependent packages installed when the MariaDB-server package is installed are: MariaDB-client, MariaDB-shared, and MariaDB-common, so to install MariaDB 10.1.31 from this repository, we would do the following:

sudo yum install MariaDB-server-10.1.31 MariaDB-client-10.1.31 MariaDB-shared-10.1.31 MariaDB-common-10.1.31

 

yum install  包的名字-版本号

 

完成

The rest of the install and setup process is as normal.

yum使用技巧

No Comments Linux

yum中查找程序由哪个包提供
有时候知道程序的名称,却不知道由那个包提供,也就是说不知道安装那个包,可以使用这个命令。

我们由provides关键字可以使用。

举例:semanage是SELinux的一个管理工具,可是我使用:yum install semanage

却提示我没有这个包。

祭出provides神器,反向查找:

[root@mysql01 etc]# yum provaides ping
Loaded plugins: fastestmirror
No such command: provaides. Please use /usr/bin/yum –help
[root@mysql01 etc]# yum provides ping                                                                                                                   |  10 MB  00:00:22    
iputils-20160308-10.el7.x86_64 : Network monitoring tools including ping
Repo        : base
Matched from:
Filename    : /usr/bin/ping

iputils-20160308-8.el7.x86_64 : Network monitoring tools including ping
Repo        : @anaconda
Matched from:
Filename    : /usr/bin/ping