Location>code7788 >text

centos 7.9 installing nodejs (includes installing fnm, changing yum sources, upgrading gcc, make, glibc, libstdc++)

Popularity:62 ℃/2024-10-15 09:01:02

1. Install fnm

(1) Compressed packagesGet it on the server, I put it in root.
(2) Unzip and set permissions

unzip 
chmod 777 fnm

(3) Set the environment variable, add it to the end of the /etc/profile file, and the configuration will take effect.

export PATH=$PATH:/root  
source /etc/profile

(4) Add to the end of the ~/.bashrc file

eval "$(fnm env --use-on-cd --shell bash)"
source ~/.bashrc

The check fnm version command verifies that the installation was successful

fnm --version
fnm 1.37.2

2、Download and install

fnm use --install-if-missing 20

3、Verify Version

node -v

node: /lib64/.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/.6: version `GLIBC_2.28' not found (required by node)
node: /lib64/.6: version `GLIBC_2.25' not found (required by node)

4, before installing the dependencies, first change the AliCloud yum source (please skip if you have changed)

(1) ReplacementAliCloud yum source

mv /etc// /etc//
wget -O /etc// /repo/

(2) Check your installed scl

yum list installed|grep "scl"

(3) Delete

yum remove 
yum remove 

(4) Reinstallation

yum install -y centos-release-scl centos-release-scl-rh

(5) Configure scl domestic source aliyun
file

[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=/centos/7/sclo/x86_64/sclo/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

file

[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=/centos/7/sclo/x86_64/rh/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

(6) Clearing the cache

yum clean all && yum makecache

I've stepped in the pits. 5, 6, 7, 8. Install them in that order.

5、Upgrade gcc (default is 4 upgrade to 8)

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++

6, upgrade make (default is 3 upgrade to 4)

wget /gnu/make/make-4.
tar -xzvf make-4. && cd make-4.3/
./configure --prefix=/usr/local/make --disable-dependency-tracking
make && make install
cd /usr/bin/ && mv make 
ln -sv /usr/local/make/bin/make /usr/bin/make

7. Upgrade glibc

wget /gnu/glibc/glibc-2.
tar xf glibc-2. 
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

8. Upgrade libstdc++

wget /wp-content/uploads/2019/08/libstdc.so_.6.0.
unzip libstdc.so_.6.0.
cp libstdc++.so.6.0.26 /lib64/
cd /lib64
cp libstdc++.so.6 libstdc++.so.
rm -f libstdc++.so.6
ln -s libstdc++.so.6.0.26 libstdc++.so.6

"8 Palms of the Dragon" is over. Let's call it a day.

node -v
v20.17.0