How to Install Node.js on AlmaLinux

/ Category: Linux, Tutorials / Comments: None

how to install node.js on almalinux
Spread the love

In this guide, we will show you, how to install Node.js on Almalinux. It is an open-source JavaScript runtime built on Chrome’s V8 JavaScript engine. Nodejs also provides an event-driven architecture and non-blocking I/O that is optimized & scalable.

There are thousands of open-source libraries for Node.js, most of them hosted on the npm website. Node.js is also a cross-platform server environment that can run on Windows, Linux, Unix, macOS, and more. Let’s get started with the installation.


  • A server with Almalinux as OS
  • User privileges: root or non-root user with sudo privileges

1. Login to your VPS via SSH

# ssh [email protected]_IP

2. Update the system and install the necessary packages

# yum -y update
# yum install curl

3. Install Node.js from the NodeSource repository

You can use the following command to install Nodejs 18 using the nodesource repository.

# curl -fsSL | sudo -E bash - 

after the installation is completed you can check if the nodejs is installed by running the command:

# node -v

4. Install Nodejs using yum package manager

To check which nodejs versions are available you can use the command:

# yum module list nodejs

You should see an output similar to this

Last metadata expiration check: 0:05:17 ago on Thu 12 Jan 2023 10:30:56 AM CST.
AlmaLinux 8 - 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 [e]    common [d], development, minimal, s2i   Javascript runtime
nodejs    18        common [d], development, minimal, s2i   Javascript runtime

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

As you can see there are several versions which are available to install, you can choose the version you want to install on your system and proceed with the installation with the following command:

# yum module install nodejs:18

You will get the following result, where you should enter ‘y’ and click enter to continue the installation:

# yum module install nodejs:18
Last metadata expiration check: 3:12:10 ago on Thu 12 Jan 2023 01:44:08 PM CST.
Dependencies resolved.
 Package      Arch   Version                                    Repo       Size
Installing group/module packages:
 nodejs       x86_64 1:18.12.1-2.module_el8.7.0+3370+40ccb2a8   appstream  13 M
 npm          x86_64 1:8.19.2-
                                                                appstream 2.0 M
Installing weak dependencies:
 nodejs-docs  noarch 1:18.12.1-2.module_el8.7.0+3370+40ccb2a8   appstream 9.5 M
              x86_64 1:18.12.1-2.module_el8.7.0+3370+40ccb2a8   appstream 8.0 M
Installing module profiles:

Enabling module streams:
 nodejs              18

Transaction Summary
Install  4 Packages

Total download size: 33 M
Installed size: 161 M
Is this ok [y/N]: y

Once the installation has been completed, you can check if nodejs is installed and which version:

# node -v 

For testing purposes, you can run a basic Hello World code in nodejs.

You will need to create a new file with whichever name you want just make sure to use the .js extension at the end, for example helloworld.js

# nano helloworld.js

Next you can copy the Nodejs from here:

const http = require('http');

const hostname = '';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World');

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);

Then simply run the Nodejs code with:

# node helloworld.js

You should get the following output.

 Server running at

If you now go on your favorite browser and visit YOUR_IP_ADDRESS:3000 you should be able to see “Hello World,” which verifies that the nodejs is properly installed and running on port 3000.

In the above guide, you learned different ways to install Node.js on the Almalinux server. You can now choose your desired way to install Node.js as per your needs.
Of course, you don’t have to do any of this if you use one of our Node.js VPS Hosting services, in which case you can simply ask our expert Linux admins to set up this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, please share it with your friends on social networks or simply leave a reply below. Thanks.

Be the first to write a comment.

Your feedback