Node.js have been in the development market for sometime now. It is a server-side programming language written in JavaScript. To get started as a Node.js developer, you only need to know JavaScript, making it easy to learn and adopt. Node.js is commonly used when building applications and tools that are executed on the server side. Since it adopt an event-driven architecture, it is suitable for handling multiple concurrent requests and eliminates the need for a thread for each request.
Node.js can also handle thousands of concurrent connections with efficiency as it doesn’t depend on I/O operations completing before it can execute. It is easy to install and manage JavaScript libraries using its built-in package manager called “Node Package Manager”, (commonly known as npm). Hundreds of Node.js packages have been written through open source contributions to empower developers adopt Node.js and be successful in their development journey.
To install Node.js on Ubuntu 24.04 (Noble Numbat), follow these steps.
1. Update system packages
Make sure all your system packages are updated by running the commands below.
sudo apt update
Other installed packages can also be updated.
sudo apt upgrade -y
If you choose to upgrade everything, then reboot your OS.
sudo reboot
2. Install Node.js on Ubuntu 24.04
Next perform the installation of Node.js on Ubuntu 24.04. This can be done in two ways.
1) Install Node.js from apt repositories
Installation can be done from Ubuntu repositories,
sudo apt install nodejs
Check version of Node.js installed
$ node --version
v18.19.1
2) Install Node.js from Node APT repository
To get the most recent releases of Node, install from APT repository provided by Node development team.
Set version to be installed.
# Node.js 20
NODE_MAJOR=20
# Node.js 18
NODE_MAJOR=18
# Node.js 16
NODE_MAJOR=16
Install dependencies required to add a repository.
sudo apt update && sudo apt install -y ca-certificates curl gnupg
Import package signing gpg key.
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
Add the repository into your system.
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
Install specified version of Node.js set in the NODE_MAJOR
variable.
sudo apt update && sudo apt install nodejs -y
Validate successful installation.
$ node --version
v20.12.2
3. Creating sample Node.js application
Let’s create a simple HTTP server application that is powered by Node.js
vim myapp.js
Copy and paste the contents below into the file.
const http = require('http');
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.write('Hello World from Node.js!');
res.end();
});
const port = 3000; // Listening port
const hostIP = '192.168.1.202'; // Replace with your host IP
server.listen(port, () => {
console.log(`Server running at http://${hostIP}:${port}/`);
});
Next run your server using the following command:
$ node myapp.js
Server running at http://192.168.1.202:3000/
You will see a message printed in your console. This indicates the server is running:
$ curl http://192.168.1.202:3000;echo
Hello World from Node.js!
If you open a web browser and visit the URL http://ServerIP:3000/, the response “Hello World from Node.js!” indicate that the server is running.

References: