How To Install Node.js on AlmaLinux 9
In this tutorial, we will show you how to install Node.js on AlmaLinux 9. For those of you who didn’t know, Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that executes JavaScript code outside a web browser. It should be noted that Nodejs is used for traditional websites and API support services, but is designed with real-time, push-based architectures. This allows users to write websites in JavaScript whose code runs on the server instead of the client browser.
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 the Node.js JavaScript runtime environment on AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux.
Prerequisites
- A server running one of the following operating systems: AlmaLinux 9.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Node.js on AlmaLinux 9
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf clean all sudo dnf update sudo dnf groupinstall "Development Tools"
Step 2. Installing Node.js on AlmaLinux 9.
By default, Node.js is available on the AlmaLinux 9 base repository. Now, checklist the available Nodejs streams by running the following command:
sudo dnf module list nodejs
Output:
AlmaLinux 9 - AppStream Name Stream Profiles Summary nodejs 10 [d] common [d], development, minimal, s2i Javascript runtime nodejs 12 common [d], development, minimal, s2i Javascript runtime nodejs 14 common [d], development, minimal, s2i Javascript runtime nodejs 16 common [d], development, minimal, s2i Javascript runtime Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
From the above output, Node.js version 10 is the default. To install another latest version, we need to enable and install it using this command below:
sudo dnf module enable nodejs:16 sudo dnf install nodejs
Finally, verify Node.js and npm versions using this command:
$ node -v v16.15.1
For npm:
$ npm -v 8.2.2
Congratulations! You have successfully installed Node.js. Thanks for using this tutorial for installing the Node.js JavaScript runtime environment on your AlmaLinux 9 system. For additional help or useful information, we recommend you check the official Node.js website.