NodeJS安装
NodeJS安装
cmyang1. windows安装NodeJS
2. Centos安装NodeJS
2.1 下载安装包
从官网下载Linux安装包:https://nodejs.org/en/download/
下载的文件为:node-v20.11.0-linux-x64.tar.xz
2.2 解压
xz -d node-v20.11.0-linux-x64.tar.xz
tar -xvf node-v20.11.0-linux-x64.tar
2.3 添加环境变量
vim /etc/profile
最后增加PATH:export PATH=$PATH:/usr/local/nodejs/node-v20.11.0-linux-x64/bin
source /etc/profile
2.4 问题
安装后报错
1
2
3
4
5
6
7[root@hf2 ~]# node
node: /lib64/libm.so.6: version `GLIBC_2.27' 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 `CXXABI_1.3.9' not found (required by node)
node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by node)更新环境
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40升级GCC
yum install -y centos-release-scl
yum install -y devtoolset-8-gcc*
mv /usr/bin/gcc /usr/bin/gcc_bak
mv /usr/bin/g++ /usr/bin/g++_bak
ln -s /opt/rh/devtoolset-8/root/bin/gcc /usr/bin/gcc
ln -s /opt/rh/devtoolset-8/root/bin/g++ /usr/bin/g++
升级make
cd /usr/local
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
mv /usr/bin/make /usr/bin/make_bak
ln -sv /usr/local/make/bin/make /usr/bin/make
升级bison
yum install -y bison
升级libstdc++
yum whatprovides libstdc++.so.6
yum update -y libstdc++.x86_64
wget http://www.vuln.cn/wp-content/uploads/2019/08/libstdc.so_.6.0.26.zip
unzip libstdc.so_.6.0.26.zip
cp libstdc++.so.6.0.26 /lib64/
cd /lib64
mv libstdc++.so.6 libstdc++.so.6_bak
ln -s libstdc++.so.6.0.26 libstdc++.so.6
重启服务后好像有问题,再执行下libstdc++.so.6的替换
升级glibc
wget http://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
tar -zxvf 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
make && make install