Learn how to install the latest Node.js LTS on Ubuntu 26.04 using the official NodeSource repository. Follow this easy step by step guide to install Node.js, npm, verify the installation, create your first project, and manage updates.
Node.js is one of the most popular JavaScript runtimes for building web applications, REST APIs, automation scripts, and command line tools. It also comes with npm, the default package manager used to install JavaScript libraries and frameworks.
Prerequisites
Before you begin, make sure you have:
-
Ubuntu 26.04 installed dedicated server.
-
A user account with sudo privileges
-
Internet access
Let's learn how to install the latest Node.js LTS on Ubuntu 26.04 LTS latest version.
Step 1: Update Your System
First, update the package list so your system knows about the latest available packages.
sudo apt update
If your system has pending updates, install them as well.
sudo apt upgrade -y
Step 2: Install Required Packages
NodeSource requires a few packages before adding its repository.
sudo apt install -y ca-certificates curl gnupg
Step 3: Add the NodeSource Repository
The easiest way to install the latest Node.js LTS version is by using the official NodeSource setup script.
For the current LTS release (Node.js 24.x), run:
curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
This command adds the official NodeSource repository to your Ubuntu system so you can install the latest supported LTS version directly with APT.
Step 4: Install Node.js
Now install Node.js.
sudo apt install -y nodejs
The package also installs npm, so you do not need to install it separately.
Step 5: Verify the Installation
Check the installed Node.js version.
node -v
Example output:
v24.x.x
Now check the npm version.
npm -v
Example output:
11.x.x
If both commands display version numbers, the installation completed successfully.
Step 6: Test Node.js
Create a simple JavaScript file.
nano hello.js
Paste the following code.
console.log("Hello, Node.js!");
Save the file and exit.
Run it using Node.js.
node hello.js
You should see:
Hello, Node.js!
This confirms that Node.js is working correctly.
Create Your First Node.js Project
Create a new project directory.
mkdir myapp
Move into it.
cd myapp
Initialize a new Node.js project.
npm init -y
This creates a package.json file, which stores your project's information and dependencies.
Install a Package
To test npm, install the Express framework.
npm install express
After the installation finishes, a node_modules directory will be created along with a package-lock.json file.
Update Node.js
Since Node.js was installed from the NodeSource repository, future updates are simple.
sudo apt update
sudo apt upgrade
Whenever a newer release becomes available in the NodeSource repository, Ubuntu will install it during the upgrade process.
Uninstall Node.js
If you no longer need Node.js, remove it using:
sudo apt remove nodejs
To remove packages that are no longer needed:
sudo apt autoremove
Conclusion
You have successfully seen how to install Node.js LTS on Ubuntu 26.04. You also verified the installation, created your first project, installed an npm package, and learned how to update or remove Node.js later. With everything set up, you're ready to start building JavaScript applications, APIs, or backend services on Ubuntu.

