nvm - Node version manager is probably the most effective means to install and manage Node.js installations in linux environment. It provides ways to have multiple node versions installed in a machine and abilities to switch between versions. Install a particular version of nvm using either curl or wget. Just change the version number to get the specific version of nvm.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
You can install a particular version of Node.js by using the following command. For eg. to install Node.js 10.16.3,
nvm install 10.16.3
You can also install the latest lts version of Node.js
nvm install --lts
You can switch between multiple node versions by specifying the target node version in nvm use command.
nvm use 12.16.2
You can also set the default Node.js version by creating an alias and using it
nvm alias default 12.16.2