YUM centos SCLo-scl.repo CentOS-SIG-SCLo CentOS-SCLo-scl-rh.repo SCL
YUM centos SCLo-scl.repo CentOS-SIG-SCLo CentOS-SCLo-scl-rh.repo SCL
[root@localhost yum.repos.d]# more CentOS-SCLo-scl.repo
[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/
# mirrorlist=https://mirrors.aliyun.com?arch=$basearch&release=7&repo=sclo-sclo
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# more CentOS-SCLo-scl-rh.repo
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
#mirrorlist=https://mirrors.aliyun.com?arch=$basearch&release=7&repo=sclo-rh
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[root@localhost yum.repos.d]#
# 操作3、配置SCL国内源
# 编辑CentOS-SCLo-scl.repo,将[centos-sclo-sclo]的baseurl修改为国内镜像源的地址
[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
# 编辑CentOS-SCLo-scl-rh.repo文件,将[centos-sclo-sclo]的baseurl修改为国内镜像源的地址
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
# 操作1、安装SCL源相关软件包 yum install -y centos-release-scl \ centos-release-scl-rh
# 操作2、检查.repo文件 # 检查/etc/yum.repos.d/目录下是否存在与SCL相关的.repo文件 # 通常会有CentOS-SCLo-scl.repo和 # CentOS-SCLo-scl-rh.repo两个文件 ls /etc/yum.repos.d
# 操作3、配置SCL国内源 # 编辑CentOS-SCLo-scl.repo,将[centos-sclo-sclo]的baseurl修改为国内镜像源的地址 [centos-sclo-sclo] name=CentOS-7 - SCLo sclo baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/ gpgcheck=0 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
# 编辑CentOS-SCLo-scl-rh.repo文件,将[centos-sclo-sclo]的baseurl修改为国内镜像源的地址 [centos-sclo-rh] name=CentOS-7 - SCLo rh baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/ gpgcheck=0 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
===================================================
随笔-centos7-更换源|升级gcc
更换源
CentOS-Base.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
CentOS-Base.repo
yum clean all && yum makecache
升级gcc版本
CentOS-SCLo-scl.repo
[centos-sclo-sclo] name=CentOS-7 - SCLo sclo baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/ # mirrorlist=https://mirrors.aliyun.com?arch=$basearch&release=7&repo=sclo-sclo gpgcheck=0 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
CentOS-SCLo-scl-rh.repo
[centos-sclo-rh] name=CentOS-7 - SCLo rh baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/ #mirrorlist=https://mirrors.aliyun.com?arch=$basearch&release=7&repo=sclo-rh gpgcheck=0 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
yum clean all && yum makecache
#安装 devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-binutils
yum list devtoolset-*-gcc yum -y install centos-release-scl yum -y install devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-binutils #启用新的 GCC 环境,当前控制台生效:
scl enable devtoolset-11 bash
#如果需要重启后也要生效:(可选)
echo "source /opt/rh/devtoolset-11/enable" >>/etc/profile
建议小优化: 为了防止重复添加或脚本报错,建议你这样写: bash 复制 编辑 grep -q "devtoolset-11/enable" /etc/profile || echo "source /opt/rh/devtoolset-11/enable" >> /etc/profile 或者更安全一些,用 if 判断文件是否存在: bash 复制 编辑 if [ -f /opt/rh/devtoolset-11/enable ]; then echo "source /opt/rh/devtoolset-11/enable" >> /etc/profile fi
浙公网安备 33010602011771号