本想将mongodb安装到redhat中,yum不能使用,看网上说可以另外安装。
试了几次网上的,没有成功。看着看着也发现规律,知道怎样改了。
先把自带的卸载:
rpm -aq | grep yum | xargs rpm -e --nodeps
下载几个必要的包:(我这是64位的,不是的话先访问http://ftp.sjtu.edu.cn/centos/6/os/肯定)
wget http://ftp.sjtu.edu.cn/centos/6/os/x86_64/Packages/python-iniparse-0.3.1⑵.1.el6.noarch.rpm
wget http://ftp.sjtu.edu.cn/centos/6/os/x86_64/Packages/yum-metadata-parser⑴.1.2⑴6.el6.x86_64.rpm
wget http://ftp.sjtu.edu.cn/centos/6/os/x86_64/Packages/yum⑶.2.29⑹0.el6.centos.noarch.rpm
wget http://ftp.sjtu.edu.cn/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror⑴.1.30⑶0.el6.noarch.rpm
安装yum:
rpm -ivh python-iniparse-0.3.1⑵.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser⑴.1.2⑴6.el6.x86_64.rpm
rpm -ivh yum⑶.2.29⑹0.el6.centos.noarch.rpm yum-plugin-fastestmirror⑴.1.30⑶0.el6.noarch.rpm
编辑repo包:(如果也能够先把它删除)
vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS⑹-Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever6&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://ftp.sjtu.edu.cn/centos/6/os/$basearch/
gpgcheck=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS⑹
#released updates
[update]
name=CentOS⑹-Updates
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/6/updates/$basearch/
gpgcheck=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS⑹
#packages used/produced in the build but not released
[extras]
name=CentOS⑹-Extras
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras
baseurl=http://ftp.sjtu.edu.cn/centos/6/extras/$basearch/
gpgcheck=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS⑹
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS⑹-Plus
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus
baseurl=http://ftp.sjtu.edu.cn/centos/6/centosplus/$basearch/
gpgcheck=0
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS⑹
#contrib - packages by Centos Users
[contrib]
name=CentOS⑹-Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib
baseurl=http://ftp.sjtu.edu.cn/centos/6/contrib/$basearch/
gpgcheck=0
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS⑹
注意检查上面的每一个网址路径,在网页上访问看看是不是存在,如果是其他版本,把上面的6更改掉,其他版本可能还有其他配置(如 centos5还有[addons])。
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS⑹ #这个也要对应版本
导入gpgkey:(当前是使用第2行导入)
#rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS⑹
rpm --import http://ftp.sjtu.edu.cn/centos/6/os/x86_64/RPM-GPG-KEY-CentOS⑹
清除缓存:
yum clean all
测试yum安装:
yum install vim
yum install mysql*
成功安装!~
参考:
http://blog.itpub.net/23890223/viewspace⑺57724/
http://blog.itpub.net/25313300/viewspace⑺08509/
http://blog.chinaunix.net/uid⑵0729583-id⑵972852.html