今天在安裝程序時(shí),發(fā)現(xiàn)有一個(gè)插件未安裝,我就隨手敲了一個(gè)命令,看都沒看
yum remove yum
然后就杯具了...
1
[root@localhost ~]# yum
2
-bash: /usr/bin/yum: No such
file
or directory
?
這個(gè)粗心的手誤倒不至于讓整個(gè)系統(tǒng)癱瘓,yum 卻無法使用了。于是,我試著折騰了一番
1
rpm -ivh --nodeps http:
//
mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
2
rpm -ivh --nodeps http:
//
mirrors.163.com/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
3
rpm -ivh --nodeps http:
//
mirrors.163.com/centos/5/os/x86_64/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm
關(guān)于rpm --nodeps的解釋
1
--nodeps don
'
t verify package dependencies
接下來,再次嘗試輸入yum,結(jié)果再次出現(xiàn)莫名錯(cuò)誤
1
[root@localhost ~]# yum
2
There was a problem importing one of the Python modules
3
required to run yum. The error leading to this problem was:
4
5
libxml2.so.
2
: cannot open shared
object
file
: No such
file
or directory
6
7
Please
install
a package
which
provides this module, or
8
verify that the module is installed correctly.
9
10
It
'
s possible that the above module doesn
'
t match the
11
current version of Python,
which
is:
12
2.4
.
3
(#
1
, Nov
11
2010
,
13
:
30
:
19
)
13
[GCC
4.1
.
2
20080704
(Red Hat
4.1
.
2
-
48
)]
14
15
If you cannot solve this problem yourself, please go to
16
the yum faq at:
17
http:
//
wiki.linux.duke.edu/YumFaq
因?yàn)閥um調(diào)用的是python,運(yùn)行 Python,試下是否可行
1
[root@localhost~
]# python
2
Python
2.4
.
3
(#
1
, Nov
11
2010
,
13
:
30
:
19
)
3
[GCC
4.1
.
2
20080704
(Red Hat
4.1
.
2
-
48
)] on linux2
4
Type
"
help
"
,
"
copyright
"
,
"
credits
"
or
"
license
"
for
more
information.
5
>>>
import yum
6
Traceback (most recent call
last
):
7
File
"
<stdin>
"
, line
1
,
in
?
8
File
"
/usr/lib/python2.4/site-packages/yum/__init__.py
"
, line
54
,
in
?
9
import transactioninfo
10
File
"
/usr/lib/python2.4/site-packages/yum/transactioninfo.py
"
, line
31
,
in
?
11
from sqlitesack import YumAvailablePackageSqlite
12
File
"
/usr/lib/python2.4/site-packages/yum/sqlitesack.py
"
, line
26
,
in
?
13
import yumRepo
14
File
"
/usr/lib/python2.4/site-packages/yum/yumRepo.py
"
, line
32
,
in
?
15
import sqlitecachec
16
File
"
/usr/lib64/python2.4/site-packages/sqlitecachec.py
"
, line
19
,
in
?
17
import _sqlitecache
18
ImportError: libxml2.so.
2
: cannot open shared
object
file
: No such
file
or directory
19
>>>
?
?
?
提示缺少libxml2.so.2,安裝一下試試
rpm -ivh http:
//
mirrors.163.com/centos/5/os/x86_64/CentOS/libxml2-2.6.26-2.1.2.8.x86_64.rpm
再次測(cè)試運(yùn)行下yum命令,結(jié)果正常了,大喜
?
1
[root@localhost ~
]# yum
2
Loaded plugins: fastestmirror
3
You need to give some command
4
usage: yum [options] COMMAND
5
6
List of Commands:
7
8
check-update Check
for
available package updates
9
clean Remove cached data
10
deplist List a package
'
s dependencies
11
downgrade downgrade a package
12
erase Remove a package or packages from your system
13
groupinfo Display details about a package group
14
groupinstall Install the packages
in
a group on your system
15
grouplist List available package
groups
16
groupremove Remove the packages
in
a group from your system
17
help Display a helpful usage message
18
info
Display details about a package or group of packages
19
install
Install a package or packages on your system
20
list List a package or
groups
of packages
21
localinstall Install a local RPM
22
makecache Generate the metadata cache
23
provides Find what package provides the given value
24
reinstall reinstall a package
25
repolist Display the configured software repositories
26
resolvedep Determine
which
package provides the given dependency
27
search Search package details
for
the given
string
28
shell Run an interactive yum shell
29
update Update a package or packages on your system
30
upgrade Update packages taking obsoletes into account
31
32
33
options:
34
-h, --
help show this help message and exit
35
-t, --
tolerant be tolerant of errors
36
-C run entirely from cache, don
'
t update cache
37
-c [config
file
] config
file
location
38
-R [minutes] maximum command
wait
time
39
-
d [debug level] debugging output level
40
--showduplicates show duplicates,
in
repos,
in
list/
search commands
41
-
e [error level] error output level
42
-q, --
quiet quiet operation
43
-v, --
verbose verbose operation
44
-y answer yes
for
all questions
45
--
version show Yum version and exit
46
--installroot=[path] set
install
root
47
--enablerepo=[repo] enable one or
more
repositories (wildcards allowed)
48
--disablerepo=[repo] disable one or
more
repositories (wildcards allowed)
49
-x [package], --exclude=
[package]
50
exclude package(s) by name or glob
51
--disableexcludes=
[repo]
52
disable exclude from main,
for
a repo or
for
53
everything
54
--
obsoletes enable obsoletes processing during updates
55
--
noplugins disable Yum plugins
56
--
nogpgcheck disable gpg signature checking
57
--disableplugin=
[plugin]
58
disable plugins by name
59
--enableplugin=
[plugin]
60
enable plugins by name
61
--skip-
broken skip packages with depsolving problems
62
--color=
COLOR control whether color is used
63
64
Plugin Options:
最后,趕緊更新一下系統(tǒng)吧
1
yum update
好了 這樣yum問題就完全解決了!
linux輸入yum后提示: -bash: /usr/bin/yum: No such file or directory的解決方案
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061
微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元

