linux下gcc升级
1、命令行升级gcc
yum -y install centos-release-scl
yum -y install devtoolset-9
scl enable devtoolset-9 bash
echo "source /opt/rh/devtoolset-9/enable">> /etc/profile
执行过程中出现异常信息:
1.安装:centos-release-scl时正常,安装:devtoolset-9-gcc、devtoolset-9-gcc-c++、devtoolset-9-binutilse时出现报错
解决方法: 查看报错信息,报错为:CentOS-SCLo-scl-rh.repo文件地址无法访问
使用阿里对应的配置文件,修改改文件内容
CentOS-SCLo-scl-rh.repo文件全内容
[centos-sclo-rh]
name=CentOS-$releasever - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/rh/
gpgcheck=1
enabled=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
CentOS-SCLo-scl.repo文件内容
[centos-sclo-sclo]
name=CentOS-$releasever - SCLo sclo
baseurl=https://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/sclo/
gpgcheck=1
enabled=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
2.清除缓存,重新创建缓存后,再次安装devtoolset-9出现异常信息
解决方法: --nogpgcheck查看报错信息为密钥问题,尝试在安装时候,直接安装,不校验密钥
yum clean all
yum makecache
yum -y install devtoolset-9 --nogpgcheck
scl enable devtoolset-9 bash
echo "source /opt/rh/devtoolset-9/enable">> /etc/profile
验证