CentOS 7.9非X86架构系统生命周期结束后(2024-6-30)配置在线可用yum源 —— 筑梦之路_centos7.9 arm-CSDN博客
以前的做法
sudo yum install centos-release-scl-rh
sudo yum install devtoolset-8-build
sudo yum install devtoolset-8-gdb
sudo yum install devtoolset-8-gcc devtoolset-8-gcc-c++
# 临时启用
source /opt/rh/devtoolset-8/enable
# 永久启用
echo "source /opt/rh/devtoolset-8/enable" >>/etc/profile
2024年6月30日后,这种方式不行了,官方停止维护更新了
现在的做法
基于以前的,修改repo文件
cat CentOS-SCLo-scl-rh.repo | grep -v ^# | grep -v ^$
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-rh-testing]
name=CentOS-7 - SCLo rh Testing
baseurl=http://buildlogs.centos.org/centos/7/sclo/$basearch/rh/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-rh-source]
name=CentOS-7 - SCLo rh Sources
baseurl=http://vault.centos.org/centos/7/sclo/Source/rh/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-rh-debuginfo]
name=CentOS-7 - SCLo rh Debuginfo
baseurl=http://debuginfo.centos.org/centos/7/sclo/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
# 阿里云的源
文件 CentOS-SCLo-scl.repo
将 # baseurl=http://mirror.centos.org/centos/7/sclo/$basearch/sclo/ 修改为
baseurl=https://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/sclo/
删除以下行
mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-sclo
最终为:
name=CentOS-7 - SCLo sclo
baseurl=https://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/sclo/
gpgcheck=1
enabled=1
文件 CentOS-SCLo-scl-rh.repo
将 #baseurl=http://mirror.centos.org/centos/7/sclo/$basearch/rh/ 修改为
baseurl=https://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/rh/
删除以下行
mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh
最终为:
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/rh/
gpgcheck=1
enabled=1
yum clean all
yum makecache fast
其他操作跟上面的一样,比如安装gcc9
yum install devtoolset-9-gcc devtoolset-9-gcc-c++
启用新版gcc
scl enable devtoolset-9 bash
添加到用户环境变量 ~/.bashrc
source /opt/rh/devtoolset-9/enable
升级libstdc++.so.6
# 更新lib libstdc++.so.6.0.26
wget https://cdn.frostbelt.cn/software/libstdc%2B%2B.so.6.0.26
# 替换系统中的/usr/lib64
把下载的libstdc++.so.6.0.26 cp 到 /usr/lib64/
cd /usr/lib64/
ln -snf ./libstdc++.so.6.0.26 libstdc++.so.6
https://buildlogs.centos.org/