CentOS7 升级 Glibc 2.17 到2.28

yum基础源调整

备份原文件

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak

调整为阿里云源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

yum scl源调整

vi /etc/yum.repos.d/CentOS-SCLo-scl.repo

[centos-sclo-sclo]

name=CentOS-7 - SCLo sclo

baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/

# mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-sclo

gpgcheck=0

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

vi /etc/yum.repos.d/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=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh

gpgcheck=0

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

刷新cache

yum repolist

yum clean all

yum makecache

操作流程

https://roy.wang/centos7-upgrade-glibc/

默认的GCC 版本无法无法编译 Glibc 2.28。 安装GLIBC所需的依赖,该版本需要 GCC 4.9 以上 及 make 4.0 以上。 GCC 11.2版本太新,无法与Glibc 2.28兼容。

一、安装gcc-8.2.0所依赖的环境

yum install bison -y

yum -y install wget bzip2 gcc gcc-c++ glibc-headers

二、升级GNU Make 3.82到4.2.1

wget http://ftp.gnu.org/gnu/make/make-4.2.1.tar.gz

tar -zxvf make-4.2.1.tar.gz

cd make-4.2.1

mkdir build

cd build

../configure --prefix=/usr/local/make && make && make install

export PATH=/usr/local/make/bin:$PATH

ln -s /usr/local/make/bin/make /usr/local/make/bin/gmake

make -v

三、升级GCC

yum install -y devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils

echo "source /opt/rh/devtoolset-8/enable" >> /etc/profile

source /etc/profile

四、下载 Glibc

wget https://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.xz

xz -d glibc-2.28.tar.xz

tar -xvf glibc-2.28.tar

cd glibc-2.28

mkdir build

五、编译安装 Glibc

cd build

../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin

make -j4

make install

六、查询支持的 Glibc

strings /lib64/libc.so.6 | grep GLIBC

参考文章

1.https://blog.csdn.net/qq_45748758/article/details/132212591

2.https://roy.wang/centos7-upgrade-glibc/

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容