使用yum安裝軟件報錯:
[root@cloud yum-3.4.3]# ./yummain.py install yum
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
You can enable repos with yum-config-manager --enable <repo>
沒有啟用的repo源,查看了很多解決方案
參考文章https://blog.csdn.net/juiyy/article/details/52123518修復
主要用了這四步,
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum clean all
yum makecache
還參考這文章http://www.cnblogs.com/J0der/p/5566610.html繼續修復yum源,具體哪一步解決問題了我也不清楚,反正之后就可以成功聯網安裝package了。
cd /etc/yum.repos.d
mkdir yum.repos.d
wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo
估計可能是上面的部分修復了問題。
下面貼上兩篇文章https://blog.csdn.net/juiyy/article/details/52123518
xenserver 更新源
https://www.centos.org/download/mirrors/
https://wiki.centos.org/HowTos/CreatePublicMirrors
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum clean all
yum makecache
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-7.2.1511 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7.2.1511/os/$basearch/
http://mirrors.aliyuncs.com/centos/7.2.1511/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/7.2.1511=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-7.2.1511 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7.2.1511/updates/$basearch/
http://mirrors.aliyuncs.com/centos/7.2.1511/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/7.2.1511=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-7.2.1511 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7.2.1511/extras/$basearch/
http://mirrors.aliyuncs.com/centos/7.2.1511/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/7.2.1511e=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7.2.1511 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7.2.1511/centosplus/$basearch/
http://mirrors.aliyuncs.com/centos/7.2.1511/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/7.2.1511=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
http://www.cnblogs.com/J0der/p/5566610.html
yum指令之修復
折騰着搞openvpn 網站服務器yum指令出了點問題
------------------------------------------------------------
[root@cloud ~]# yum
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
No module named yum
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.6.6 (r266:84292, Feb 22 2013, 00:00:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
-----------------------------------------------------------
原因是python版本與yum不兼容.
解決過程:1.准備
[root@cloud ~]# lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.4 (Final)
Release: 6.4
Codename: Final
那么系統是CentOS release 6.4 (Final).
[root@cloud ~]# uname -a
Linux cloud 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
那么安裝的系統是64位.
2.安裝yum程序
先下載所需要的rpm包;
2)下載並安裝python-urlgrabber,python-pycurl,yum-metadata-parser(yum需要這三個東西)
centos5 下載地址:http://tel.mirrors.163.com/centos/5/os/x86_64/CentOS/
centos6 下載地址:http://mirrors.163.com/centos/6/os/x86_64/Packages/
使用 wget 下載,然后 rpm -ivh xxx.rpm 安裝
3)安裝yum
到官網或其他地址下載yum源碼包(例如:yum-3.4.3)
wget http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz
tar xvf yum-3.4.3.tar.gz
cd yum-3.4.3
./yummain.py install yum
錯誤又出來了
CRITICAL:yum.cli:Config Error: Error accessing file for config file:///etc/yum.conf
其實是因為/etc/yum.conf之前被我刪了
那么touch保險下吧 touch /etc/yum.conf
再執行./yummain.py install yum
[root@cloud yum-3.4.3]# ./yummain.py install yum
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
You can enable repos with yum-config-manager --enable <repo>
又是問題。。。坑
沒有repo源 又是被我刪了的。。。有的話請略過
cd /etc/yum.repos.d
mkdir yum.repos.d
wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo
./yummain.py install yum
出現
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
No module named yum
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.6.6 (r266:84292, Feb 22 2013, 00:00:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq