You can save time by using a precompiled build, generously made available unofficially (and guarantee to work — recent NodeJs versions do not build on Centos 7 due to missing libraries and/or need to customize includes) by a group of volunteers at https://unofficial-builds.nodejs.org/
For instance, the latest (as of today) Node 20 LTS that you can install on Opalstack (shared hosting) is node-v20.13.1-linux-x64-glibc-217.tar.gz
. If you try to build this version from Node's official source, it will fail due to dependencies not up to date on glibc
.
cd ~/apps/name_of_app
wget https://unofficial-builds.nodejs.org/download/release/v20.13.1/node-v20.13.1-linux-x64-glibc-217.tar.gz
tar zxf node-v20.13.1-linux-x64-glibc-217.tar.gz
mv ~/opt/node ~/opt/node.old
cp -r node-v20.13.1-linux-x64-glibc-217 ~/opt/node
node -v
it should not be necessary to restart the shell, and by using the default path, node should be available and first in the user PATH.
Hope I'll save you people (and your CPU!) some time ;-)