rename '.repo' '.repo.bak' /etc/yum.repos.d/*.repo
wget https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo -O /etc/yum.repos.d/CentOS-Base.repo
没有wget命令就直接浏览器下载再上传。
yum makecache
dnf search toolset
dnf search gcc-toolset
dnf install gcc-toolset-9-gcc gcc-toolset-9-gcc-c++
以下直接装gcc-toolset-9的没试过,可以一试。
-
安装
gcc-toolset-9:bashCopy code
sudo dnf install -y gcc-toolset-9 -
启用 GCC 9 环境:
bashCopy code
scl enable gcc-toolset-9 bash这将在当前终端中启用 GCC 9 环境。你可以在这个终端中使用 GCC 9 编译器和相关工具。
-
验证 GCC 版本:
bashCopy code
gcc --version确保输出显示 GCC 9 版本。
请注意,使用 scl enable 启用的环境仅对当前终端有效,关闭终端后环境将返回到默认状态。如果希望在每次登录时自动启用 GCC 9 环境,可以考虑将 scl enable 命令添加到 shell 配置文件(如 .bashrc 或 .bash_profile)中。
本文介绍了如何在CentOS8中通过`wget`下载并安装GCC9工具集,包括使用`dnf`管理和启用GCC9环境,以及如何在shell配置中设置自动加载。
1793

被折叠的 条评论
为什么被折叠?



