小白学习centos7升级glibc

前言

centos7默认的glibc不支持node v18及以上。

升级

  1. 进入/home/download目录(没有download,则新建一个)
shell 复制代码
cd /home/download
  1. 安装gcc和g++
shell 复制代码
sudo yum check-update

sudo yum install gcc
sudo yum install gcc-c++

gcc --version
g++ --version
  1. 获取glibc-2.28.tar.gz,并解压
shell 复制代码
wget http://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
tar xf glibc-2.28.tar.gz 
  1. 更新glibc
shell 复制代码
cd /home/download/glibc-2.28/ && mkdir build  && cd build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin

可能出现错误:

shell 复制代码
configure: error: 
*** These critical programs are missing or too old: make bison compiler
*** Check the INSTALL file for required versions.

这是make版本太低,走第5步,升级gcc和make。

  1. 升级gcc与make
shell 复制代码
# 升级GCC(默认为4 升级为8)</span>
yum install -y centos-release-scl
yum install -y devtoolset-8-gcc*
mv /usr/bin/gcc /usr/bin/gcc-4.8.5
ln -s /opt/rh/devtoolset-8/root/bin/gcc /usr/bin/gcc
mv /usr/bin/g++ /usr/bin/g++-4.8.5
ln -s /opt/rh/devtoolset-8/root/bin/g++ /usr/bin/g++

# 升级 make(默认为3 升级为4)
wget http://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

这时所有的问题 都已经解决完毕。再重新执行第4步,更新glibc即可。

如果报如下错误:

shell 复制代码
configure: error: 
*** These critical programs are missing or too old: bison 
*** Check the INSTALL file for required versions.

查看bison版本:

shell 复制代码
bison -v
-bash: bison: 未找到命令

安装bison:

shell 复制代码
yum install -y bison

安装完之后,再重新执行第4步,更新glibc即可。

  1. 继续更新 make 和 make install在linux中就是安装软件的意思 简单这么理解就好。如果不在/home/download/glibc-2.28/build目录下,需要先进入该目录。
shell 复制代码
make && make install
  1. 更新libstdc++.so.6.0.26,解决如下错误
log 复制代码
# 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)
shell 复制代码
cd /home/download

# 更新lib libstdc++.so.6.0.26
wget https://cdn.frostbelt.cn/software/libstdc%2B%2B.so.6.0.26

# 替换系统中的/usr/lib64
cp libstdc++.so.6.0.26 /usr/lib64/

cd /usr/lib64/
ln -snf ./libstdc++.so.6.0.26 libstdc++.so.6
  1. 用下面命令查看glibc
shell 复制代码
strings /lib64/libc.so.6 |grep GLIBC_
  1. 解决中文乱码问题
shell 复制代码
cd /home/download/glibc-2.28/build && make localedata/install-locales

参考

相关推荐
Bolt14 小时前
用 pnpm 11 省掉项目里的 .nvmrc 与 .npmrc
前端·npm·node.js
学习使我快乐0120 小时前
Express 学习
学习·node.js·express
小夏子_riotous21 小时前
Kubernetes学习路径——3. Kubernetes 1.25 高可用集群部署实战:从 Docker 到 Calico 全链路详解
linux·运维·学习·docker·容器·kubernetes·centos
Zeluar1 天前
Node.js安装显示旧版本存在且无法覆盖
node.js
孟陬1 天前
Node.js v26.0 新增超甜的语法糖 getOrInsert / getOrInsertComputed 介绍
python·node.js
淼_@淼1 天前
node.js、node、nvm、npm、npx的关系
node.js
小粉粉hhh1 天前
Node.js(四)——npm与包
前端·npm·node.js
weixin_457507211 天前
centos安装docker配置自动HTTPS部署多个项目
docker·https·centos
小周技术驿站1 天前
Linux 基础命令详解
linux·前端·chrome·ubuntu·centos
Zhu7581 天前
软件更新-openssh和openssl-centos
linux·运维·centos