yum的更新方法,可以到网上搜一下,这里不再累述。
我的yum更新后,出现的问题如下所示:
![ContractedBlock.gif](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
[root@sunss
-
22
yum
.
repos
.
d]
#
yum search php
================================================================== Matched : php ===================================================================
php - pear . noarch : PHP Extension and Application Repository framework
compat - readline43 . i386 : edline 4.3
compat - readline43 . x86_64 : edline 4.3
fonts - arabic . noarch : gollem - h3 . noarch : The Horde web - based File Manager .
hddtemp . x86_64 : Hard disk temperature tool
horde . noarch : The common Horde Framework for all Horde modules .
imp - h3 . noarch : The Internet Messaging Program : webmail access to IMAP / POP3 accounts .
ingo - h3 . noarch : The Horde web - based Email Filter Rules Manager .
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 309 , in user_main
errcode = main(args)
File " /usr/share/yum-cli/yummain.py " , line 178 , in main
result , resultmsgs = base . doCommands()
File " /usr/share/yum-cli/cli.py " , line 349 , in doCommands
return self . yum_cli_commands[self . basecmd] . doCommand(self , self . basecmd , self . extcmds)
File " /usr/share/yum-cli/yumcommands.py " , line 627 , in doCommand
return base . search(extcmds)
File " /usr/share/yum-cli/cli.py " , line 813 , in search
self . matchcallback(po , matched_value , args)
File " /usr/share/yum-cli/output.py " , line 818 , in matchcallback
print msg
UnicodeEncodeError : ' gb2312 ' codec can ' t encode character u ' \ufffd ' in position 17: illegal multibyte sequence
================================================================== Matched : php ===================================================================
php - pear . noarch : PHP Extension and Application Repository framework
compat - readline43 . i386 : edline 4.3
compat - readline43 . x86_64 : edline 4.3
fonts - arabic . noarch : gollem - h3 . noarch : The Horde web - based File Manager .
hddtemp . x86_64 : Hard disk temperature tool
horde . noarch : The common Horde Framework for all Horde modules .
imp - h3 . noarch : The Internet Messaging Program : webmail access to IMAP / POP3 accounts .
ingo - h3 . noarch : The Horde web - based Email Filter Rules Manager .
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 309 , in user_main
errcode = main(args)
File " /usr/share/yum-cli/yummain.py " , line 178 , in main
result , resultmsgs = base . doCommands()
File " /usr/share/yum-cli/cli.py " , line 349 , in doCommands
return self . yum_cli_commands[self . basecmd] . doCommand(self , self . basecmd , self . extcmds)
File " /usr/share/yum-cli/yumcommands.py " , line 627 , in doCommand
return base . search(extcmds)
File " /usr/share/yum-cli/cli.py " , line 813 , in search
self . matchcallback(po , matched_value , args)
File " /usr/share/yum-cli/output.py " , line 818 , in matchcallback
print msg
UnicodeEncodeError : ' gb2312 ' codec can ' t encode character u ' \ufffd ' in position 17: illegal multibyte sequence
试了各种办法:
1.yum clean all
2.修改/etc/yum.conf,
![ContractedBlock.gif](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
[root
@
sunss
-
22
yum.repos.d]
#
[root @ sunss - 22 yum.repos.d] # cat /etc/yum.conf
[main]
cachedir =/ var / cache / yum
keepcache = 0
debuglevel = 2
logfile =/ var / log / yum.log
distroverpkg = redhat - release
tolerant = 1
exactarch = 1
obsoletes = 1
gpgcheck = 1
plugins = 1 # 替换为plugins=0
# Note: yum-RHN-plugin doesn't honor this.
metadata_expire = 1h
# Default.
# installonly_limit = 3
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
[root @ sunss - 22 yum.repos.d] # cat /etc/yum.conf
[main]
cachedir =/ var / cache / yum
keepcache = 0
debuglevel = 2
logfile =/ var / log / yum.log
distroverpkg = redhat - release
tolerant = 1
exactarch = 1
obsoletes = 1
gpgcheck = 1
plugins = 1 # 替换为plugins=0
# Note: yum-RHN-plugin doesn't honor this.
metadata_expire = 1h
# Default.
# installonly_limit = 3
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
3.修改fastestmirror.conf
![ContractedBlock.gif](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
fastestmirror.conf
[root @ sunss - 22 pluginconf.d] # cat fastestmirror.conf
[main]
enabled = 1 # 替换为enabled=0
verbose = 0
socket_timeout = 3
hostfilepath =/ var / cache / yum / timedhosts.txt
maxhostfileage = 10
maxthreads = 15
# exclude=.gov, facebook
[root @ sunss - 22 pluginconf.d] #
[root @ sunss - 22 pluginconf.d] # cat fastestmirror.conf
[main]
enabled = 1 # 替换为enabled=0
verbose = 0
socket_timeout = 3
hostfilepath =/ var / cache / yum / timedhosts.txt
maxhostfileage = 10
maxthreads = 15
# exclude=.gov, facebook
[root @ sunss - 22 pluginconf.d] #
等等,一系列工作都不行,最后解决办法:
#yum clean all
#rm -f /var/lib/rpm/__db*
#rpm --rebuilddb
#yum update