一.准备工作
下载nodejs:https://nodejs.org/download/release/v12.10.0/node-v12.10.0-linux-x64.tar.gz
(1)查看GLIBCXX版本,node需要 GLIBCXX_3.4.18版本以上,如果版本过低需要升级libstdc++.so.6.0.26 否则直接跳过 这一步
strings /usr/lib64/libstdc++.so.6 | grep GLIBC 1.下载libstdc++.so.6.0.26 2.解压并且把解压的文件复制到 /usr/lib64/目录下 cp libstdc++.so.6.0.26 /usr/lib64/ 3. 进入到/usr/lib64/ 目录下删除软连接 cd /usr/lib64/ rm libstdc++.so.6 4.新建软连接 ln -s libstdc++.so.6.0.26 libstdc++.so.6
(2)查看glibc,node需要GLIBC_2.17 ,如果版本过低需要升级。否则跳过这一步。
strings /lib64/libc.so.6 |grep GLIBC_ 1.升级glibc至 2.17版本 下载7个包 wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-utils-2.17-55.el6.x86_64.rpm & wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-static-2.17-55.el6.x86_64.rpm & wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-2.17-55.el6.x86_64.rpm & wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-common-2.17-55.el6.x86_64.rpm & wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-devel-2.17-55.el6.x86_64.rpm & wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-headers-2.17-55.el6.x86_64.rpm & wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/nscd-2.17-55.el6.x86_64.rpm & 3.执行升级命令 rpm -Uvh *-2.17-55.el6.x86_64.rpm --force --nodeps
二.正式安装
1.获取Node.js 安装包并安装
Node.js 安装包及源码下载地址为:https://nodejs.org/en/download/
wget https://nodejs.org/dist/v12.18.1/node-v12.18.1-linux-x64.tar.xz // 下载 tar xf node-v12.18.1-linux-x64.tar.xz // 解压
vim /etc/profile
export NODE_HOME=/nodejs解压路径 export PATH=$PATH:$NODE_HOME/bin export NODE_PATH=$NODE_HOME/lib/node_modules
source /etc/profile 刷新配置
node -v 查看node版本
三.教程涉及的安装包百度云盘下载
链接:https://pan.baidu.com/s/1vYLV8LIi0N2KqWrXTa8fww
提取码:1234
备用下载连接:https://files.cnblogs.com/files/dch0/libstdc.so_.6.0.26.zip
原文地址:https://blog.csdn.net/qq_29372275/article/details/107550881