Centos7升级Glibc-2.28,线上环境安装部署教程
一 检查glibc版本
ldd --version二 安装 glibc-2.28
编辑时间可能会很长,最好找个空闲时间来升级
# 下载并解压 glibc-2.28
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.28
# 创建临时文件
mkdir build && cd build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
# 这一步时, 如果发生如下错误, 则需要进行gcc & make的升级,否则进行最后一步【继续编译glibc】
These critical programs are missing or too old: make compiler三 升级gcc与make
安装GLIBC所需的依赖 可以在 glibc 目录下的INSTALL中找到, 该版本需要 GCC 4.9 以上 及 make 4.0 以上
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 # backup
ln -sv /usr/local/make/bin/make /usr/bin/make四 升级gcc
mirrorlist.centos.org源不再维护,当执行yum指令时可能报错:Could not resolve host: mirrorlist.centos.org; Unknown error
可参考cenos7源替换成可用源
# 直接安装 GCC-8.3.1
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
# 会新创建一个bash会话,键入exit即可退出。
# 如果想要永久生效,可以执行:
echo "source /opt/rh/devtoolset-8/enable" >> /etc/profile
source /etc/profile五 继续编译 glibc
# 进入之前的 `~/glibc-2.28/build`目录下
cd /usr/src/glibc-2.28/build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
# 每4条指令并行执行
make -j 4
# 此步可能会遇到报错:`Btw. the script doesn't work if you're installing GNU libc not as your`,但似乎不影响
make install
# 查询
strings /lib64/libc.so.6 | grep GLIBC
...
GLIBC_2.22
GLIBC_2.23
GLIBC_2.24
GLIBC_2.25
GLIBC_2.26
GLIBC_2.27
GLIBC_2.28
GLIBC_PRIVATE
...
# 版本验证
ldd --version六 升级libstdc++.so.6
当安装nodejs18+发现以下错误:
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
cd /usr/local/lib64
wget 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.6
ln -fs /usr/local/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6七 问题
升级完后报错:can't set the locale; make sure $LC_* and $LANG are correct
查看以下几个文件中是否有多余的语言配置,如果有,清除掉
/etc/environment
/etc/locale.gen
/etc/locale.conf然后执行
localedef -i en_US -f UTF-8 en_US.UTF-8