环境CenOS
[root@hncuc ~]# cat /etc/issue
CentOS release 6.2 (Final)
Kernel \r on an \m
安装gcc的时候提示没有包
[root@hncuc ~]# sudo yum install gcc gcc-c++ libstdc++-devel
Loaded plugins: refresh-packagekit, security
Setting up Install Process
No package gcc available.
No package gcc-c++ available.
Nothing to do
设置阿里云镜像
参考centos6 yum源失效的最新操作方式,解决:[Errno 14] PYCURL ERROR 22
1、备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下载新文件
wget --no-check-certificate -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo


文件内容如下:
# 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-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/

文章讲述了在CenOS6.2环境中遇到yum源问题,通过备份原yum源文件、下载阿里云镜像并替换源配置、清理缓存和重新生成缓存,最终成功安装gcc的过程。
最低0.47元/天 解锁文章
2779

被折叠的 条评论
为什么被折叠?



