问题:linux安装node 18版本及以上都报错:
[root@master1 ~]# cd node-v20.10.0-linux-x64
[root@master1 node-v20.10.0-linux-x64]# ls
bin CHANGELOG.md include lib LICENSE README.md share
[root@master1 node-v20.10.0-linux-x64]# cd bin/
[root@master1 bin]# ls
corepack node npm npx
[root@master1 bin]# ./node -v
./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)
检查glibc的情况:
strings /usr/lib64/libstdc++.so.6 | grep GLIBC
安装glibc-2.28
[root@master1 local]# wget http://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
[root@master1 local]# tar -xzvf glibc-2.28.tar.gz
[root@master1 local]# cd glibc-2.28
[root@master1 glibc-2.28]# mkdir build && cd build
[root@master1 build]# ../configure --prefix=/usr/local/glibc-2.28 --disable-profile --enable-add-ons --with-headers=/usr/local/glibc-2.28 --with-binutils=/usr/local/glibc-2.28/bin
报错:
configure: error:
*** These critical programs are missing or too old: make compiler
*** Check the INSTALL file for required versions.
需要升级gcc与make
[root@master1 local]# wget https://ftp.gnu.org/gnu/gcc/gcc-8.4.0/gcc-8.4.0.tar.gz
[root@master1 local]# tar -xzvf gcc-8.4.0.tar.gz
[root@master1 local]# cd gcc-8.4.0
[root@master1 local]# mkdir build && cd build
[root@master1 build]# ../configure --prefix=/usr/local/gcc-8.4.0/build --enable-threads=posix --disable-checking --disable-multilib --enable-languages=c,c++,fortran --with-gmp=/usr/local/gcc-8.4.0/build --with-mpfr=/usr/local/gcc-8.4.0/build --with-mpc=/usr/local/gcc-8.4.0/build
[root@master1 build]# make -j4
[root@master1 build]# make install
...
时间很长
...
[root@master1 build]# mv /usr/bin/gcc /usr/bin/gcc.2024.3.26
[root@master1 build]# ln -s /usr/local/gcc-8.4.0/build/bin/gcc /usr/bin/gcc
[root@master1 build]# mv /usr/bin/g++ /usr/bin/g++.2024.3.26
[root@master1 build]# ln -s /usr/local/gcc-8.4.0/build/bin/g++ /usr/bin/g++
[root@master1 local]# wget http://ftp.gnu.org/gnu/make/make-4.3.tar.gz
[root@master1 local]# tar -zxvf make-4.3.tar.gz
[root@master1 local]# cd make-4.3
[root@master1 make-4.3]# ./configure --prefix=/usr/local/make-4.3
[root@master1 make-4.3]# make && make install
[root@master1 make-4.3]# mv /usr/bin/make make.2024.3.26
[root@master1 make-4.3]# ln -sv /usr/local/make-4.3/bin/make /usr/bin/make
然后返回继续升级glibc-2.28
[root@master1 build]# ../configure --prefix=/usr/local/glibc-2.28 --disable-profile --enable-add-ons --with-headers=/usr/local/glibc-2.28 --with-binutils=/usr/local/glibc-2.28/bin
报错:系统内核版本太低了
checking whether the linker provides working __ehdr_start... yes
checking for __builtin_trap with no external dependencies... yes
checking whether the C++ compiler supports thread_local... no
running configure fragment for sysdeps/unix/sysv/linux/x86_64/64
running configure fragment for sysdeps/unix/sysv/linux/x86_64
running configure fragment for sysdeps/unix/sysv/linux
checking installed Linux kernel header files... missing or too old!
configure: error: GNU libc requires kernel header files from
Linux 3.2.0 or later to be installed before configuring.
The kernel header files are found usually in /usr/include/asm and
/usr/include/linux; make sure these directories use files from
Linux 3.2.0 or later. This check uses <linux/version.h>, so
make sure that file was built correctly when installing the kernel header
files. To use kernel headers not from /usr/include/linux, use the
configure option --with-headers.
升级系统内核