CentOS Linux release 7.6.1810升级glibc

2019-08-29

CentOS Linux release 7.6.1810升级glibc

一,软件下载

[[email protected]_eos-01 ~]# wget http://ftp.gnu.org/gnu/libc/glibc-2.30.tar.gz
[[email protected]_eos-01 ~]# wget http://ftp.gnu.org/gnu/make/make-4.2.tar.gz
[[email protected]_eos-01 ~]# wget http://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.gz

二,软件安装

[[email protected]_eos-01 ~]# tar -zxf gcc-9.2.0.tar.gz 
[[email protected]_eos-01 ~]# cd gcc-9.2.0
[[email protected]_eos-01 gcc-9.2.0]# ./contrib/download_prerequisites 需要连接网络
[[email protected]_eos-01 gcc-9.2.0]# mkdir build
[[email protected]_eos-01 gcc-9.2.0]# make && make install
[[email protected]_eos-01 gcc-9.2.0]# export PATH=/usr/local/gcc-9.2.0/bin:$PATH
vim ~/.bashrc (最后一行加入 export PATH=/usr/local/gcc-9.2.0/bin:$PATH )
[[email protected]_eos-01 gcc-9.2.0]# find / -name "libstdc++.so*" 查找链接库
将找到的动态库libstdc++.so.6.0.27复制到/usr/lib64
[[email protected]_eos-01 gcc-9.2.0]# cp /root/gcc-9.2.0/build/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.27 /usr/lib64 注意路径拷贝的是在解压包建立的build文件夹
切换工作目录至/usr/lib64,删除原来的软连接, 将默认库的软连接指向最新动态库。
[[email protected]_eos-01 gcc-9.2.0]#cd /usr/lib64
[[email protected]_eos-01 lib64]# rm -rf libstdc++.so.6
[[email protected]_eos-01 lib64]#ln -s libstdc++.so.6.0.27 libstdc++.so.6
[[email protected]_eos-01 lib64]#gcc -v验证是否生效
[email protected]_eos-01 ~]# tar -zxf make-4.2.tar.gz
[[email protected]_eos-01 make-4.2]#./configure
[[email protected]_eos-01 make-4.2]#make && make install
[[email protected]_eos-01 make-4.2]#ln -sf /usr/local/bin/make /usr/bin/make
[[email protected]_eos-01 make-4.2]#make -v
[[email protected]_eos-01 ~]# tar -zxf glibc-2.30.tar.gz 
[[email protected]_eos-01 ~]# cd glibc-2.30/
[[email protected]_eos-01 glibc-2.30]#  cat INSTALL |grep -E "newer|later"决定安装成功的关键,对版本要求。
[[email protected]_eos-01 glibc-2.30]# mkdir build
[[email protected]_eos-01 build]# ../configure --prefix=/usr 部分帖子没有usr实验证明会报错误segmentation fault (core dumped)导致系统无法启动
[[email protected]_eos-01 build]#make 
[[email protected]_eos-01 build]#make install 报错Btw. the script doesn‘t work if you‘re installing GNU libc not as your不影响使用
[[email protected]_eos-01 build]# ll /lib64/libc.so.6 验证模块是正确的
lrwxrwxrwx 1 root root 12 Aug 28 14:21 /lib64/libc.so.6 -> libc-2.30.so
glibc问题参考:https://www.cnblogs.com/juzii/p/4952250.html

三, 语言处理cannot change locale

[[email protected]_eos-01 build]# more /etc/environment 添加如下内容
LANG=en_US.utf-8
LC_ALL=
[[email protected]_eos-01 build]# source /etc/environment 
[[email protected]_eos-01 build]# exit 退出重新连接

CentOS Linux release 7.6.1810升级glibc

CentOS Linux release 7.6.1810升级glibc

原文地址:https://blog.51cto.com/zhangchengjie/2433423