CentOS7 使用 centos-release-scl-rh yum库安装 devtoolset

  1. 用华为云镜像源替换 CentOS7 yum Base仓库
  • x86-64
bash 复制代码
curl -sL -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.huaweicloud.com/repository/conf/CentOS-7-anon.repo

yum makecache
  • arm64
bash 复制代码
curl -sL -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.huaweicloud.com/repository/conf/CentOS-AltArch-7.repo

yum makecache
  1. 安装 centos-release-scl-rh 仓库
bash 复制代码
yum makecache
yum install -y centos-release-scl centos-release-scl-rh scl-utils
  1. 使用华为云镜像替换 centos-release-sclcentos-release-scl-rh 仓库地址
  • x86-64
bash 复制代码
# 移除 baseurl注释
sed -i "s/# *baseurl=/baseurl=/g" /etc/yum.repos.d/CentOS-SCLo-scl.repo
# 注释 mirrorlist
sed -i "s/mirrorlist=/#mirrorlist=/g" /etc/yum.repos.d/CentOS-SCLo-scl.repo
# 更换仓库地址为华为云 centos-vault 镜像
sed -i "s/http:\/\/mirror.centos.org\/centos\/7/https:\/\/repo.huaweicloud.com\/centos-vault\/7.9.2009/g" /etc/yum.repos.d/CentOS-SCLo-scl.repo

# 对 CentOS-SCLo-scl-rh.repo 执行同样的操作
sed -i "s/# *baseurl=/baseurl=/g" /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
sed -i "s/mirrorlist=/#mirrorlist=/g" /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
sed -i "s/http:\/\/mirror.centos.org\/centos\/7/https:\/\/repo.huaweicloud.com\/centos-vault\/7.9.2009/g" /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo

yum makecache
yum search devtoolset # 搜索结果会显示多个 devtoolset 版本
  • arm64
bash 复制代码
# 移除 baseurl注释
sed -i "s/# *baseurl=/baseurl=/g" /etc/yum.repos.d/CentOS-SCLo-scl.repo
# 注释 mirrorlist
sed -i "s/mirrorlist=/#mirrorlist=/g" /etc/yum.repos.d/CentOS-SCLo-scl.repo
# 更换仓库地址为华为云 centos-vault 镜像
sed -i "s/http:\/\/mirror.centos.org\/centos\/7/https:\/\/mirrors.huaweicloud.com\/centos-altarch\/7/g" /etc/yum.repos.d/CentOS-SCLo-scl.repo

# 对 CentOS-SCLo-scl-rh.repo 执行同样的操作
sed -i "s/# *baseurl=/baseurl=/g" /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
sed -i "s/mirrorlist=/#mirrorlist=/g" /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
sed -i "s/http:\/\/mirror.centos.org\/centos\/7/https:\/\/mirrors.huaweicloud.com\/centos-altarch\/7/g" /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo

yum makecache
yum search devtoolset # 搜索结果会显示多个 devtoolset 版本
  1. 安装指定版本的 devtoolset
bash 复制代码
yum install -y devtoolset-8
  1. 验证安装
bash 复制代码
scl -l # 输出包含 devtoolset-8
scl enable devtoolset-8 bash # 切换到 devtoolset-8 的 bash
gcc -v # 输出包含 gcc version 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC)
相关推荐
开源量化GO7 分钟前
期货 K 线算信号 tick 级止损:天勤双序列 wait_update 触发规则
linux·运维·服务器·python
m0_738120728 分钟前
HVV应急溯源基础——Linux 系统安全加固配置指南(一)
linux·运维·服务器·安全·网络安全·系统安全
RisunJan15 分钟前
Linux命令-perl (perl语言解释器)
linux·perl
vortex51 小时前
Linux日志轮转管理:logrotate 完全指南
linux·运维·服务器
ggaofeng1 小时前
如何通过uboot加载硬盘
linux·qemu·uboot
尔染君子2 小时前
嵌入式Linux驱动开发(按键驱动)
linux·驱动开发
kebidaixu2 小时前
BCU 平台 Modbus 主机功能开发:液冷机组 & 消防传感器
linux
vsropy2 小时前
安装虚拟机VMware
linux·windows
Jason_chen2 小时前
Linux 3.0 串口机制深度解析:传统8250驱动与基础RS-232/485支持
linux·前端
Jason_chen2 小时前
Linux 5.10 串口机制深度解析:serial_core重构与RS-485自动方向控制革命
linux