说明:RHEL6.5 配置yum源后可以使用yum安装软件,但是只执行yum命令后提示如下错误信息
0.查看之前安装yum软件包
[root@dbserver ~]# rpm -qa |grep yum
yum-3.2.29-40.el6.noarch
PackageKit-yum-plugin-0.5.8-21.el6.x86_64
yum-utils-1.1.30-14.el6.noarch
yum-plugin-security-1.1.30-14.el6.noarch
PackageKit-yum-0.5.8-21.el6.x86_64
yum-rhn-plugin-0.9.1-48.el6.noarch
yum-metadata-parser-1.1.2-16.el6.x86_64
[root@dbserver ~]#
1.使用yum安装telnet软件
[root@dbserver ~]# yum install telnet
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package telnet.x86_64 1:0.17-47.el6_3.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================================================================
Package Arch Version Repository Size
Installing:
telnet x86_64 1:0.17-47.el6_3.1 base 58 k
Transaction Summary
Install 1 Package(s)
Total download size: 58 k
Installed size: 109 k
Is this ok [y/N]: y
Downloading Packages:
telnet-0.17-47.el6_3.1.x86_64.rpm | 58 kB 00:04
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 1:telnet-0.17-47.el6_3.1.x86_64 1/1
Verifying : 1:telnet-0.17-47.el6_3.1.x86_64 1/1
Installed:
telnet.x86_64 1:0.17-47.el6_3.1
Complete!
2.单独执行yum命令
[root@dbserver ~]# yum
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
You need to give some command
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 285, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 105, in main
base.getOptionsConfig(args)
File "/usr/share/yum-cli/cli.py", line 310, in getOptionsConfig
self.parseCommands() # before we return check over the base command + args
File "/usr/share/yum-cli/cli.py", line 333, in parseCommands
self.usage()
File "/usr/share/yum-cli/cli.py", line 1340, in usage
sys.stdout.write(self.optparser.format_help())
File "/usr/lib64/python2.6/optparse.py", line 1641, in format_help
result.append(self.get_usage() + "\n")
File "/usr/lib64/python2.6/optparse.py", line 1583, in get_usage
self.expand_prog_name(self.usage))
File "/usr/lib64/python2.6/optparse.py", line 374, in formatusage
return ("Usage: %s\n") % usage
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128)
[root@dbserver ~]#
3.处理方法:
[root@dbserver ~]# cd /var/lib/rpm/
[root@dbserver rpm]# ll
总用量 78136
-rw-r--r--. 1 root root 5517312 12月 23 14:02 Basenames
-rw-r--r--. 1 root root 12288 12月 23 13:56 Conflictname
-rw-r--r-- 1 root root 24576 12月 23 14:03 db.001
-rw-r--r-- 1 root root 229376 12月 23 14:03 db.002
-rw-r--r-- 1 root root 1318912 12月 23 14:03 db.003
-rw-r--r-- 1 root root 753664 12月 23 14:03 db.004
-rw-r--r--. 1 root root 1675264 12月 23 14:02 Dirnames
-rw-r--r--. 1 root root 10510336 12月 23 14:02 Filedigests
-rw-r--r--. 1 root root 24576 12月 23 14:02 Group
-rw-r--r--. 1 root root 20480 12月 23 14:02 Installtid
-rw-r--r--. 1 root root 90112 12月 23 14:02 Name
-rw-r--r--. 1 root root 24576 12月 14 14:11 Obsoletename
-rw-r--r--. 1 root root 60338176 12月 23 14:02 Packages
-rw-r--r--. 1 root root 1327104 12月 23 14:02 Providename
-rw-r--r--. 1 root root 684032 12月 23 14:02 Provideversion
-rw-r--r--. 1 root root 12288 12月 23 13:56 Pubkeys
-rw-r--r--. 1 root root 454656 12月 23 14:02 Requirename
-rw-r--r--. 1 root root 282624 12月 23 14:02 Requireversion
-rw-r--r--. 1 root root 176128 12月 23 14:02 Sha1header
-rw-r--r--. 1 root root 90112 12月 23 14:02 Sigmd5
-rw-r--r--. 1 root root 12288 12月 14 13:58 Triggername
[root@dbserver rpm]# **rm -i db.***
rm:是否删除普通文件 "db.001"?y
rm:是否删除普通文件 "db.002"?y
rm:是否删除普通文件 "db.003"?y
rm:是否删除普通文件 "db.004"?y
[root@dbserver rpm]# rpm --rebuilddb
[root@dbserver rpm]# cd /soft
[root@dbserver soft]# ll
总用量 19904
-rw-r--r-- 1 root root 1565384 12月 23 13:56 openssh-7.9p1.tar.gz
-rw-r--r-- 1 root root 5338192 12月 23 13:56 openssl-1.0.2p.tar.gz
-rw-r--r-- 1 root root 2081413 12月 23 13:56 pcre-8.42.tar.gz
-rw-r--r--. 1 root root 183811 12月 14 14:14 pdksh-5.2.14-8.i386.rpm
drwxrwxr-x. 8 oracle dba 4096 12月 14 15:59 rlwrap-0.37
-rw-r--r--. 1 root root 251438 12月 14 15:58 rlwrap-0.37.tar.gz
-rwxr-xr-x 1 root root 2372 12月 23 13:57 update.sh
-rw-r--r-- 1 root root 1044832 12月 23 14:06 yum-3.2.29-81.el6.noarch.rpm
-rw-r--r-- 1 root root 27240 12月 23 14:06 yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
-rw-r--r-- 1 root root 607698 12月 23 13:56 zlib-1.2.11.tar.gz
-rw-r--r--. 1 root root 9249332 12月 14 14:12 zysong.ttf
[root@dbserver soft]#
安装如下两个文件:
[root@dbserver ~]# rpm -ivh --force yum-3.2.29-81.el6.noarch.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm --nodeps
warning: yum-3.2.29-81.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:yum-metadata-parser ########################################### [ 50%]
2:yum ########################################### [100%]
[root@dbserver ~]# yum clean all
已加载插件:product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: base extras updates
清理一切
4.再次执行yum命令,提示正常
[root@dbserver ~]# yum
已加载插件:product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
你需要给出命令
Usage: yum [options] COMMAND
List of Commands:
check Check for problems in the rpmdb
check-update 检查是否有软件包更新
clean 删除缓存的数据
deplist 列出软件包的依赖关系
distribution-synchronization Synchronize installed packages to the latest available versions
downgrade downgrade a package
erase 从系统中移除一个或多个软件包
groupinfo 显示组的详细信息
groupinstall 向系统中安装一组软件包
grouplist 列出可安装的组
groupremove 从系统中移除一组软件包
help 显示用法信息
history Display, or use, the transaction history
info 显示关于软件包或组的详细信息
install 向系统中安装一个或多个软件包
list 列出一个或一组软件包
load-transaction load a saved transaction from filename
makecache 创建元数据缓存
provides 查找提供指定内容的软件包
reinstall 覆盖安装一个包
repolist 显示已配置的仓库
resolvedep 判断哪个包提供了指定的依赖
search 在软件包详细信息中搜索指定字符串
shell 运行交互式的 yum 外壳
update 更新系统中的一个或多个软件包
update-minimal Works like update, but goes to the 'newest' package match which fixes a problem that affects your system
updateinfo Acts on repository update information
upgrade 更新软件包同时考虑软件包取代关系
version Display a version for the machine and/or available repos.
Options:
-h, --help show this help message and exit
-t, --tolerant 容忍错误
-C, --cacheonly run entirely from system cache, don't update cache
-c [config file], --config=[config file]
配置文件路径
-R [minutes], --randomwait=[minutes]
命令最长等待时间
-d [debug level], --debuglevel=[debug level]
调试输出级别
--showduplicates 在 list/search 命令下,显示仓库里重复的条目。
-e [error level], --errorlevel=[error level]
错误输出级别
--rpmverbosity=[debug level name]
debugging output level for rpm
-q, --quiet 安静的操作
-v, --verbose verbose operation
-y, --assumeyes 回答所有的问题为是
--assumeno answer no for all questions
--version 显示 Yum 版本信息并退出
--installroot=[path] 设置目标根目录
--enablerepo=[repo] 启用一个或多个仓库(支持通配符)
--disablerepo=[repo] 禁用一个或多个仓库(支持通配符)
-x [package], --exclude=[package]
用全名或通配符排除软件包
--disableexcludes=[repo]
禁止从主配置,从仓库或者从任何位置排除
--obsoletes 升级时考虑软件包取代关系
--noplugins 禁用 Yum 插件
--nogpgcheck 禁用 gpg 签名检测
--disableplugin=[plugin]
禁用指定名称的插件
--enableplugin=[plugin]
enable plugins by name
--skip-broken 跳过有依赖问题的软件包
--color=COLOR 配置是否使用颜色
--releasever=RELEASEVER
set value of $releasever in yum config and repo files
--downloadonly don't update, just download
--downloaddir=DLDIR specifies an alternate directory to store packages
--setopt=SETOPTS set arbitrary config and repo options
插件选项:
--security Include security relevant packages
--bugfixes Include bugfix relevant packages
--cve=CVE Include packages needed to fix the given CVE
--bz=BZ Include packages needed to fix the given BZ
--sec-severity=SEVERITY
Include security relevant packages, of this severity
--advisory=ADVISORY
Include packages needed to fix the given advisory
[root@dbserver ~]#
5.yum安装软件
[root@dbserver ~]# yum install gcc
已加载插件:product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
设置安装进程
base | 3.7 kB 00:00
base/primary_db | 4.4 MB 00:55
extras | 2.9 kB 00:00
extras/primary_db | 19 kB 00:00
updates | 2.9 kB 00:00
updates/primary_db | 5.9 MB 01:08
包 gcc-4.4.7-4.el6.x86_64 已安装并且是最新版本
无须任何处理
[root@dbserver ~]#
6.查看现在安装的yum包
[root@dbserver soft]# rpm -qa |grep yum
yum-plugin-security-1.1.30-14.el6.noarch
yum-rhn-plugin-0.9.1-48.el6.noarch
PackageKit-yum-0.5.8-21.el6.x86_64
PackageKit-yum-plugin-0.5.8-21.el6.x86_64
yum-metadata-parser-1.1.2-16.el6.x86_64
yum-3.2.29-81.el6.noarch
yum-3.2.29-40.el6.noarch
yum-utils-1.1.30-14.el6.noarch
[root@dbserver soft]#
[root@dbserver ~]# yum --version
3.2.29
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed: rpm-4.8.0-37.el6.x86_64 at 2017-12-14 13:29
Built : Red Hat, Inc.
Committed: Panu Matilainen
Installed: subscription-manager-1.9.11-1.el6.x86_64 at 2017-12-14 13:32
Built : Red Hat, Inc.
Committed: jesus m. rodriguez
Installed: yum-3.2.29-81.el6.noarch at 2017-12-23 06:07
Built : Red Hat, Inc.
Committed: Valentina Mukhamedzhanova
You have new mail in /var/spool/mail/root
[root@dbserver ~]#
7.执行yum update后提示如下:
问题:
--> 完成依赖关系计算
错误:ksh conflicts with pdksh-5.2.14-8.i386
You could try using --skip-broken to work around the problem
** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
ksh-20120801-10.el6.x86_64 has installed conflicts pdksh: pdksh-5.2.14-8.i386
yum-3.2.29-81.el6.noarch has missing requires of python-urlgrabber >= ('0', '3.9.1', '10')
分析:
根据提示需要安装python-urlgrabber的版本大于3.9.1.10.
查看当前系统的python-urlgrabber版本
[root@dbserver ~]# rpm -qa |grep python-urlgrabber
python-urlgrabber-3.9.1-9.el6.noarch
[root@dbserver ~]#
升级安装更高版本的python-urlgrabber
[root@dbserver soft]# yum install python-urlgrabber-3.9.1-11.el6.noarch.rpm
已加载插件:product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
设置安装进程
诊断 python-urlgrabber-3.9.1-11.el6.noarch.rpm: python-urlgrabber-3.9.1-11.el6.noarch
python-urlgrabber-3.9.1-11.el6.noarch.rpm 将作为 python-urlgrabber-3.9.1-9.el6.noarch 的更新
解决依赖关系
--> 执行事务检查
---> Package python-urlgrabber.noarch 0:3.9.1-9.el6 will be 升级
---> Package python-urlgrabber.noarch 0:3.9.1-11.el6 will be an update
--> 完成依赖关系计算
依赖关系解决
============================================================================================================================================================
软件包 架构 版本 仓库 大小
正在升级:
python-urlgrabber noarch 3.9.1-11.el6 /python-urlgrabber-3.9.1-11.el6.noarch 316 k
事务概要
Upgrade 1 Package(s)
总文件大小:316 k
确定吗?[y/N]:y
下载软件包:
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
正在升级 : python-urlgrabber-3.9.1-11.el6.noarch 1/2
清理 : python-urlgrabber-3.9.1-9.el6.noarch 2/2
Verifying : python-urlgrabber-3.9.1-11.el6.noarch 1/2
Verifying : python-urlgrabber-3.9.1-9.el6.noarch 2/2
更新完毕:
python-urlgrabber.noarch 0:3.9.1-11.el6
完毕!
[root@dbserver soft]# rpm -qa |grep python-urlgrabber
python-urlgrabber-3.9.1-11.el6.noarch
[root@dbserver soft]#
[root@dbserver soft]# yum version
已加载插件:product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed: 6Server/x86_64 1547:6e0f44b505b273501b4ff684b93334e8f53347ff
Group-Installed: yum 15:a19b761ff479b73d703258c649352f7ca61f4c0e
version
[root@dbserver soft]#
[root@dbserver soft]# yum --version
3.2.29
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed: rpm-4.8.0-37.el6.x86_64 at 2017-12-14 13:29
Built : Red Hat, Inc.
Committed: Panu Matilainen
Installed: subscription-manager-1.9.11-1.el6.x86_64 at 2017-12-14 13:32
Built : Red Hat, Inc.
Committed: jesus m. rodriguez
Installed: yum-3.2.29-81.el6.noarch at 2017-12-23 06:07
Built : Red Hat, Inc.
Committed: Valentina Mukhamedzhanova
[root@dbserver soft]#
问题2:执行yum update的问题
--> 完成依赖关系计算
错误:ksh conflicts with pdksh-5.2.14-8.i386
You could try using --skip-broken to work around the problem
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
ksh-20120801-10.el6.x86_64 has installed conflicts pdksh: pdksh-5.2.14-8.i386
分析:ksh-20120801-10.el6.x86_64已经安装并且和pdksh-5.2.14-8.i386有冲突
解决:删除ksh-20120801-10.el6.x86_64或pdksh-5.2.14-8.i386然后再次执行yum update即可
[root@dbserver soft]# rpm -e pdksh-5.2.14-8.i386
[root@dbserver soft]# rpm -qa |grep ksh
ksh-20120801-10.el6.x86_64
[root@dbserver soft]# yum update
事务概要
Install 3 Package(s)
Upgrade 229 Package(s)
总下载量:377 M
确定吗?[y/N]:y
下载软件包:
(1/232): abrt-2.0.8-21.el6.centos.x86_64.rpm | 208 kB 00:01
(2/232): abrt-addon-ccpp-2.0.8-21.el6.centos.x86_64.rpm | 116 kB 00:05
(3/232): abrt-addon-kerneloops-2.0.8-21.el6.centos.x86_64.rpm | 65 kB 00:01
(4/232): abrt-addon-python-2.0.8-21.el6.centos.x86_64.rpm | 65 kB 00:01
(5/232): abrt-cli-2.0.8-21.el6.centos.x86_64.rpm | 54 kB 00:01
(6/232): abrt-desktop-2.0.8-21.el6.centos.x86_64.rpm | 54 kB 00:02
(7/232): abrt-gui-2.0.8-21.el6.centos.x86_64.rpm | 150 kB 00:07
(8/232): abrt-libs-2.0.8-21.el6.centos.x86_64.rpm | 64 kB 00:01
(9/232): abrt-tui-2.0.8-21.el6.centos.x86_64.rpm | 61 kB 00:01
(10/232): at-3.1.10-44.el6_5.2.x86_64.rpm | 60 kB 00:00