大家好!我现如今已经学习到Linux-Redis了,在前期安装编译环境真的是痛疼,特别是这个gcc,看了网上很多水文,确实很水。今天在这里把我失败N多次的成功经验分享给大家!
程序员废话不多说,直接上教程
安装gcc(C语言的编译环境)
yum install gcc
如果通过yum安装源出现如下错误
[root@localhost tmp]# yum install gcc
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
原因:2020年11月30日开始 centos6各大开源镜像站已经停止维护了。需要配置阿里云镜像。解决方式:
依次执行!!
1、通过执行如下命令修改fastestmirror.conf的配置参数
sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf
2、备份文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
3.国内建议使用阿里云镜像,执行如下
curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo
然后!!!
访问网址:https://www.xmpan.com/Centos-6-Vault-Aliyun.repo
会自动下载一个文件!
然后在linux执行:
vim /etc/yum.repos.d/CentOS-Base.repo
将下载的文件的所有内容全部复制到执行后的 vim /etc/yum.repos.d/CentOS-Base.repo中
保存退出后再执行yum install gcc!
全部选y
注意:一定要检查一下下载文件的内容是否完整无缺的复制到了,缺一点都会报错
例如:
Loaded plugins: refresh-packagekit, security
File contains no section headers.
file: file:/etc/yum.repos.d/CentOS-Base.repo, line: 1
'entOS-Base.repo\n'
如果文件下载失败,请访问我的阿里云盘地址:
精细手打不易,欢迎留言