This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Node.js on a CentOS Stream 9.
- A server running one of the following operating systems: CentOS 9 Stream.
- It’s recommended that you use a fresh OS install to prevent any potential issues
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Node.js on CentOS Stream 9
Step 1. First of all, make sure that all packages are up to date.
sudo dnf update sudo dnf groupinstall "Development Tools"
Step 2. Installing Node.js on CentOS Stream 9.
By default, Node.js is available on CentOS Stream 9 base repository. Now we install the default Node.js package on your CentOS system:
sudo dnf install nodejs
Check the version once the installation is complete:
In addition, you can install a specific Node.js version using NVM. Now run the following command below to install it:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
Then, execute the command below:
source ~/.bash_profile nvm list-remote nvm install 16.13.2
Verify your version of Node.js installed:
If you wish to uninstall Node.js and npm packages, you can run the command:
sudo dnf module remove nodejs
Congratulations! You have successfully installed Node.js. Thanks for using this tutorial for installing Node.js on CentOS Stream 9 system. For additional help or useful information, we recommend you check the official Node.js website.