How to Install Node.js on CentOS 9 Stream
Introduction
Node.js is a JavaScript runner for server-side programming. It allows developers to create extensible backend functionality using JavaScript, a language many people are familiar with in browser-based web development.
In the article, we will show you how to install Node.js on CentOS 9 simply and easily.
Install Node.js on CentOS 9 Stream
To install Node.js 12 on CentOS 9 we follow these 3 steps.
Step 1: SSH into your CentOS 9 server
To install Node.js on CentOS 9 stream, we need to SSH or access your VPS or server with root privileges first.
After successfully SSH, we continue with step 2 to perform the update of the CentOS operating system.
Step 2: Update CentOS
To update CentOS operating system we execute the following command.
dnf update
dnf groupinstall "Development Tools"
Depending on what internal software you use will have a different interface.
After the update is successful, we continue with step 3 to execute the commands to install Node.js on CentOS 9 stream.
Step 3: Commands to install Node.js on CentOS 9 stream.
We use the commands to install Node.js on CentOS 9 stream. as below. I will explain the commands right below so that you can clearly understand the function of each command.
dnf install nodejs 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
Explanation of the above commands:
- Command 1: Node.js is available on the CentOS Stream 9 base repository. We install the default Node.js package.
- Command 2,3: You can install a specific Node.js version using NVM.You can use any of the cmd above
Below is the image after I have run the above 4 commands.
So we have completed the installation of Node.js on CentOS 9 stream.
Then, execute the command below:
source ~/.bash_profile nvm list-remote nvm install 16.13.2
Now we use the following command to check the installed Node.js version.
node -v
And this is the result.
If you wish to uninstall Node.js and npm packages, you can run the command:
sudo dnf module remove nodejs
Summary
Through this article, I showed you how to install Node.js on CentOS 9 Stream as well as check the version after the installation is complete.
Hope you can do it successfully.