You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将CentOS 6.9中的GCC 4.7.2升级至GCC 4.8.5

Upgrading GCC to 4.8.5 on CentOS 6.9

Hey there! CentOS 6.9’s default package repositories only ship with GCC 4.7.2, so we’ll use the Software Collections (SCL) to install GCC 4.8.5—this method keeps your system’s default GCC intact (critical for avoiding dependency issues with core system tools). Here’s a straightforward step-by-step guide:

Step 1: Add the CentOS Software Collections Repository

First, we need to enable the SCL repo, which isn’t active by default on CentOS 6.9:

sudo yum install -y centos-release-scl

Step 2: Install GCC 4.8.5 via Devtoolset-2

The SCL package for GCC 4.8.5 is bundled under devtoolset-2. Install the required compiler packages:

sudo yum install -y devtoolset-2-gcc devtoolset-2-gcc-c++

Step 3: Activate the GCC 4.8.5 Environment

SCL packages don’t overwrite your system’s default tools—you need to explicitly activate the environment to use them. For a temporary activation (only applies to your current shell session):

scl enable devtoolset-2 bash

Verify the upgrade worked with these commands:

gcc --version
g++ --version

You should see output confirming gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44) or similar.

Step 4: Make Activation Permanent (Optional)

If you want GCC 4.8.5 to be available every time you log in, add the activation command to your user’s ~/.bashrc file:

echo 'source /opt/rh/devtoolset-2/enable' >> ~/.bashrc

Apply the change right away:

source ~/.bashrc

Quick Note

Your system’s original GCC 4.7.2 remains untouched and will still be used by system processes. The SCL version only takes precedence when you’ve enabled the devtoolset-2 environment, so you won’t break existing dependencies.

内容的提问来源于stack exchange,提问作者lonecoder

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:56:20