Redhat Enterprise 6.1 如何使用免费的CentOS的yum源 - graybull's Blog

Redhat Enterprise 6.1 如何使用免费的CentOS的yum源

graybull posted @ 2013年2月18日 22:29 in Unix/Linux with tags centos free redhat Source yum , 7890 阅读

 

    Redhat Enterprise Linux 6.1 x86_64 使用官方yum源是需要收费的,本文将讲解如何使用免费的CentOS的yum源来安装/更新软件。分成以下几步:

  • 卸载已有的yum
  • 下载CentOS的yum包
  • 安装CentOS的yum包
  • 更新repo文件
  • 清除旧缓存
  • 使用测试

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/)下载以下几个包(不同时间下载包的版本或许不同):

 

python-iniparse-0.3.1-2.1.el6.noarch.rpm
yum-3.2.29-30.el6.centos.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
 
下载方法:
可以直接从镜像网站下载;或者使用wget下载:
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

 

 

 

 

 

Avatar_small
Celeb Networth 说:
2020年9月22日 04:28

I learned a lot from the insight you shared here. It's good to learn more about this topic, and if you have some free time or you're curious about some celebrity basic information, you can visit Idol Worth and search for it.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee