CentOS6 无法更新问题
问题:YumRepo Error:All mirror URLs are not using http or file
01 CentOS6 官方停止更新
诸如关停防火墙;重置DNS 8.8.8.8;切换成国内阿里云,网易等yum源,修改 /etc/yum.repos.d/CentOS-Base.repo文件等方法,依旧没法通过yum命令调用资源
CentoS 6 停止维护更新日期:2020年11月30日
CentOS 7 停止维护更新日期:2024年6月
CentOS 8 停止维护更新日期:2029年5月
02 可用的更新源
centos 6.10 dvd1
centos 6.10 dvd2
尝试了很多方法,目前(20201229)这个是可用的。
sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo
yum clean all
yum makecache
https://www.xmpan.com/Centos-6-Vault-Aliyun.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-6.10 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-6.10 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
03 更新系统
su root # 进入root用户环境
chmod +w /etc/sudoers
vim /etc/sudoers
# 添加自己用户,模仿root用户
root ALL(ALL) ALL
user ALL(ALL) ALL
# 保存/etc/sudoers
chmod -w /etc/sudoers
exit #推出root用户环境
# 更新系统
sudo yum update
04 更新gcc到7.3.1版本
04.01 修改CentOS-SCLo-rh.repo,支持gcc 命令安装
修改 vim /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
更新
修改baseurl为baseurl=https://vault.centos.org/6.9/sclo/x86_64/rh/
。
然后更新yum缓存,yum clean all && yum makecache
# CentOS-SCLo-rh.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
# information
[centos-sclo-rh]
name=CentOS-$releasever - SCLo rh
#baseurl=http://mirror.centos.org/centos/$releasever/sclo/$basearch/rh/
baseurl=https://vault.centos.org/6.9/sclo/x86_64/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-rh-testing]
name=CentOS-$releasever - SCLo rh Testing
baseurl=http://buildlogs.centos.org/centos/$releasever/sclo/$basearch/rh/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
04.02 命令安装gcc7.3.1
yum install centos-release-scl scl-utils-build
yum install -y devtoolset-7-toolchain
scl enable devtoolset-7 bash
echo "source /opt/rh/devtoolset-7/enable" >> /etc/profile
source /etc/profile
reboot