检查 Glibc 版本 安装 glibc-2.28 编译时间可能会很长,最好找个空闲时间来升级。
1 2 3 4 5 6 7 8 9 10 11 12 13 yum install -y bison cd /usr/src/wget https://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz tar -xzvf glibc-2.28.tar.gz cd glibc-2.28mkdir build && cd build../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
升级 GCC 与 Make 安装 GLIBC 所需的依赖可以在 glibc 目录下的 INSTALL 中找到,该版本需要 GCC 4.9 以上及 make 4.0 以上。
升级 Make 1 2 3 4 5 6 7 8 9 10 11 12 13 14 cd /usr/src/wget https://ftp.gnu.org/gnu/make/make-4.3.tar.gz tar -xzvf make-4.3.tar.gz cd make-4.3/./configure --prefix=/usr/local/make make make install cd /usr/bin/mv make make.bak ln -sv /usr/local/make/bin/make /usr/bin/make
升级 GCC mirrorlist.centos.org 源不再维护,当执行 yum 指令时可能报错:Could not resolve host: mirrorlist.centos.org; Unknown error。
可参考 CentOS 7 源替换成可用源。
1 2 3 4 5 6 7 8 9 10 11 yum install centos-release-scl-rh -y yum install -y devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils scl enable devtoolset-8 bash echo "source /opt/rh/devtoolset-8/enable" >> /etc/profilesource /etc/profile
继续编译 glibc 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 cd /usr/src/glibc-2.28/build../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin make -j 4 make install strings /lib64/libc.so.6 | grep GLIBC ldd --version
升级 libstdc++.so.6 当安装 nodejs18+ 发现以下错误:
1 2 3 node: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by node) node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by node)node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by node)
升级 libstdc++.so.6:
1 2 3 4 cd /usr/local/lib64wget http://www.vuln.cn/wp-content/uploads/2019/08/libstdc.so_.6.0.26.zip mv /usr/local/lib64/libstdc++.so.6.0.26 /usr/local/lib64/libstdc++.so.6ln -fs /usr/local/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6
问题 升级完后报错:can't set the locale; make sure $LC_* and $LANG are correct。
查看以下几个文件中是否有多余的语言配置,如果有,清除掉:
1 2 3 /etc/environment /etc/locale.gen /etc/locale.conf
然后执行:
1 localedef -i en_US -f UTF-8 en_US.UTF-8