As @mckenzm had pointed out the approach of dumping the contents of the archive into the in-path folders like /usr/local/bin/
is not a great one. You will be in a lot of trouble when you have to remove this and upgrade to the next version due to some security issue.
The following are two approaches to follow
Manual installation
The approach to follow is to keep it in a way that it is easy to remove and upgrade, the way to do it is to keep all the stuff in one place and add that place to your path, for that One can do
sudo tar -xf node-v20.11.0-linux-x64.tar.xz --directory=/opt/
and add the bin folder to your $PATH
variable using the following
echo 'export PATH="/opt/node-v20.11.0-linux-x64/bin/:$PATH"' >> ~/.bashrc && source ~/.bashrc
This is a better approach because you can remove it, and upgrade it easily compared to just dumping all the files in the /bin
folder, like many, including my previously written answer ( deleted now ), are telling.
Now on any given day, you can remove the entire folder from /opt
and replace it with the version you want or even you can use multiple versions at the same time.
Using tools like nvm
node version manager is a tool, that can be very useful, specially for personal use, when you might need more than one version, you can install it via reading the documentation - it is very simple to do and nvm is a very useful script - for more visit https://github.com/nvm-sh/nvm?tab=readme-ov-file#install--update-script
If you ask me, I prefer the nvm
approach.