标签:
Redhat Enterprise Linux 6.1 x86_64 使用官方yum源是需要收费的,本文将讲解如何使用免费的CentOS的yum源来安装/更新软件。分成以下几步:
1.卸载已有的yum
查看已安装的yum包有哪些:
#rpm -aq|grep yum
卸载已安装的yum包:
#rpm -aq|grep yum | xargs rpm -e --nodeps
从这里发现xargs犇死了。
2.下载CentOS的yum包
从163镜像(http://mirrors.163.com/centos/6/os/x86_64/Packages/)下载以下几个包(不同时间下载包的版本或许不同):
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-30.el6.centos.noarch.rpm wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
3.安装CentOS的yum包
#rpm -ivh *.rpm
4.更新repo文件
进入配置目录:
#cd /etc/yum.repos.d
如果目录中没有rhel-debuginfo.repo文件,则新建一个,修改内容为:
[base] name=CentOS-$releasever - Base baseurl=http://mirrors.163.com/centos/6/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-$releasever - Updates baseurl=http://mirrors.163.com/centos/6/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #packages used/produced in the build but not released #[addons] #name=CentOS-$releasever - Addons #baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/ #gpgcheck=1 #gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras baseurl=http://mirrors.163.com/centos/6/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/ gpgcheck=1 enabled=0
5.清除旧缓存
#yum clean all
6.使用测试
列举yum包:
#yum list
安装g++
g++为何物?g++可以用来编译C++代码啦。linux默认安装gcc,但往往没有安装g++。
首先查找g++:
#yum list gcc-c++
返回的信息中包含有:
gcc-c++.x86_64
所以,安装g++的命令为:
#yum install gcc-c++.x86_64
安装过程中,如果提示需要安装某些依赖的包,那么根据指示安装即可。
若要验证是否成功安装g++,查看版本吧:
#g++ -v
[转载]Redhat Enterprise 6.1 如何使用免费的CentOS的yum源
标签:
原文地址:http://www.cnblogs.com/stevensfollower/p/4614394.html