How To Install Node.js 22 LTS on CentOS Stream 10 | 9

Node.js is an open-source platform built on Chrome’s JavaScript runtime environment to help developers build fast and scalable network applications. It runs on the V8 engine and executes JavaScript code outside a web browser. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

In this short article we see how to install NodeJS 22 on CentOS Stream 10 | 9. As of this article update the latest current release of Node.js is 23.x. This is an LTS release and it is recommended for use in Production environments. The current LTS release is Node.js 22.14, fit for running mission critical production workloads.

Install Node.js 22 LTS on CentOS Stream 10 | 9

Node.js packages are provided through the NodeSource Node.js Binary Distributions via .rpm. Add the repository to the system using the commands below:

curl -fsSL https://rpm.nodesource.com/setup_22.x | sudo bash -

Once the repository has been configured on your CentOS server you can proceed to install Node.js 22 on CentOS Stream 10|9:

sudo dnf install -y nodejs

Confirm that you can start node shell:

$ node
Welcome to Node.js v22.14.0.
Type ".help" for more information.
>

If you need development tools to build native addons:

sudo yum install gcc-c++ make

To install the Yarn package manager run the following commands:

curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn

Testing Node.js 22 installation on CentOS Stream 10|9

Once we have installed Node.js, let’s build our first web server. Create a file named app.js:

vim app.js

The add:

const http = require('http');

const hostname = '127.0.0.1';
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 run your web server using the following command:

$ node app.js

This runs the service on port 3000:

$ sudo ss -tuenlp | grep 3000
tcp     LISTEN   0        128            127.0.0.1:3000          0.0.0.0:*       users:(("node",pid=13377,fd=18)) ino:50295 sk:7 <->

 Visit http://localhost:3000 and you will see a message saying “Hello World“.

Refer to the Introduction to Node.js for a more comprehensive guide to getting started with Node.js.

More on CentOS Linux:

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Unlock the Right Solutions with Confidence

At CloudSpinx, we don’t just offer services - we deliver clarity, direction, and results. Whether you're navigating cloud adoption, scaling infrastructure, or solving DevOps challenges, our seasoned experts help you make smart, strategic decisions with total confidence. Let us turn complexity into opportunity and bring your vision to life.

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

OpenStack private networks enable instances to be reached safely without being exposed to the public internet. Private networks are vital […]

The flavors in OpenStack specify the compute, memory, and storage resources available to virtual machines (instances). The configurations that specify […]

You’ll learn how to install Python 3.13 on a CentOS Stream 10 Linux system in today’s tutorial. Python is a […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.