yum

yum command

按版本安装

1
2
3
4
5
6
7
8
9
yum list|grep filebeat

# 回显
filebeat.x86_64                         7.2.0-1                         @elastic
filebeat.i686                           7.2.1-1                         elastic
filebeat.x86_64                         7.2.1-1                         elastic

# 安装 指定版本7.2.0-1
yum install filebeat-7.2.0-1
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#search
yum search iostat

#search
yum list java*

# HTTP Error 404 - Not Found
yum clean all
rpm --rebuilddb
yum update

#check package installed
yum list installed xxx

# 列出所有已安装的软件包 
yum list installed

#升级所有包同时也升级软件和系统内核
yum -y update 

#只升级所有包,不升级软件和系统内核
yum -y upgrade 

#check installed package
rpm -qa|grep jdk

#安装
yum install httpd
yum -y install httpd

## yum 安装 本地 rpm 包, local install
sudo yum localinstall influxdb-1.2.4.x86_64.rpm

#yum mirror
/etc/yum.repos.d
#Yum更新中排除特定的包
yum update --exclude=kernel* --exclude=php*
https://www.howtoing.com/exclude-packages-from-yum-update

卸载

1
2
3
4
5
6
# 默认会卸载依赖包
yum remove httpd
yum -y remove httpd

# 不卸载依赖
rpm -e --nodeps foo

Delta RPMs disabled because /usr/bin/applydeltarpm not installed

1
2
3
4
    # 查看哪个包提供 applydeltarpm
    yum provides '*/applydeltarpm'  
    # 安装 deltarpm
    yum install deltarpm -y

清除metadata

1
    run yum --enablerepo=updates clean metadata

yum 安装报错“rpmdb: BDB0113”

1
2
3
4
error: rpmdb: BDB0113 Thread/process ****/************* failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
1
2
rm -f /var/lib/rpm/__db*
rpm --rebuilddb

https://my.oschina.net/andyfeng/blog/601291

http://gzmaster.blog.51cto.com/299556/72278

http://www.cnblogs.com/kevingrace/p/6252659.html

rpm repo

https://www.rpmfind.net/linux/RPM/index.html

yum 安装报错The GPG keys listed for the “CentOS-7 - Base - 163.com” repository are already installed but they are not correct for this package.

安装现有的 gpg 公钥,在 /etc/pki/rpm-gpg/ 下,可以 sudo rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY*,直接把所有的都安装。。。 还是不行的话,就通过参数指定不检查数字签名,sudo yum -y install * –nogpgcheck

Yum crashed with Keyboard Interrupt error

yum 跟 python3 不兼容, 得手动改成 python2

vi /usr/bin/yum, change /usr/bin/python to /usr/bin/python2 in first line.