Step1: 清除原有的yum源
rpm -aq|grep yum|xargs rpm -e --nodeps
Step2:下载新的yum()源进行安装,注意操作系统支持64位还是32位
wget http://mirrors.163.com/centos/6.5/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.163.com/centos/6.5/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6.5/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6.5/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm(有依赖关系,一起安装)
Step3:更改yum源
cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
--将文件中的$releasever全部版本号,我用的RHEL6.2,但我经过查看只有6.5的目录里是有内容的,所以改成6.5即可。 使用命令【:%s/$releasever/6.5/g】
vim CentOS6-Base-163.repo
wget http://mirrors.163.com/centos/6.5/os/x86_64/RPM-GPG-KEY-CentOS-6
rpm --import RPM-GPG-KEY-CentOS-6
Step4: 清理缓存并新建缓存
yum clean all
yum makecache
安装g++ 的命令是 yum install gcc-c++ libstdc++-devel