How to install Node.js 20 on Debian 12
To Install Node.js 20 On Debian 12
Introduction
Node (or more formally Node.js) is an open-source, cross-platform runtime environment that allows developers to create various server-side tools and applications in JavaScript.
Procedure Steps
Step 1: Check the Ubuntu version by using the below command
root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
Step 2: Update the repository by using the below command
root@linuxhelp:~# apt update
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://security.debian.org/debian-security bookworm-security InRelease
Hit:4 http://repo.netdata.cloud/repos/edge/debian bookworm/ InRelease
Hit:5 http://repo.netdata.cloud/repos/repoconfig/debian bookworm/ InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
106 packages can be upgraded. Run 'apt list --upgradable' to see them.
Step 3: Install the curl package by using the below command
root@linuxhelp:~# apt install curl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
curl is already the newest version (7.88.1-10+deb12u5).
0 upgraded, 0 newly installed, 0 to remove and 106 not upgraded.
Step 4: Download the node packages by using the below command
root@linuxhelp:~# curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -
2024-05-14 03:52:45 - Installing pre-requisites
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://security.debian.org/debian-security bookworm-security InRelease
Hit:4 http://repo.netdata.cloud/repos/edge/debian bookworm/ InRelease
Hit:5 http://repo.netdata.cloud/repos/repoconfig/debian bookworm/ InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20230311).
curl is already the newest version (7.88.1-10+deb12u5).
gnupg is already the newest version (2.2.40-1.1).
gnupg set to manually installed.
The following NEW packages will be installed:
apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 106 not upgraded.
Need to get 25.2 kB of archives.
After this operation, 35.8 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main amd64 apt-transport-https all 2.6.1 [25.2 kB]
Fetched 25.2 kB in 0s (205 kB/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 170625 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_2.6.1_all.deb ...
Unpacking apt-transport-https (2.6.1) ...
Setting up apt-transport-https (2.6.1) ...
Hit:1 http://repo.netdata.cloud/repos/edge/debian bookworm/ InRelease
Get:2 https://deb.nodesource.com/node_20.x nodistro InRelease [12.1 kB]
Hit:3 http://deb.debian.org/debian bookworm InRelease
Hit:4 http://security.debian.org/debian-security bookworm-security InRelease
Hit:5 http://deb.debian.org/debian bookworm-updates InRelease
Get:6 https://deb.nodesource.com/node_20.x nodistro/main amd64 Packages [7,318 B]
Hit:7 http://repo.netdata.cloud/repos/repoconfig/debian bookworm/ InRelease
Fetched 19.5 kB in 1s (24.1 kB/s)
Reading package lists... Done
2024-05-14 03:52:50 - Repository configured successfully. To install Node.js, run: apt-get install nodejs -y
Step 5: Install the node packages by using the below command
root@linuxhelp:~# apt-get install nodejs -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 106 not upgraded.
Need to get 31.6 MB of archives.
After this operation, 196 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_20.x nodistro/main amd64 nodejs amd64 20.13.1-1nodesource1 [31.6 MB]
Fetched 31.6 MB in 3s (10.0 MB/s)
Selecting previously unselected package nodejs.
(Reading database ... 170629 files and directories currently installed.)
Preparing to unpack .../nodejs_20.13.1-1nodesource1_amd64.deb ...
Unpacking nodejs (20.13.1-1nodesource1) ...
Setting up nodejs (20.13.1-1nodesource1) ...
Processing triggers for man-db (2.11.2-2) ...
Step 6: Find the version of a node by using the below command
root@linuxhelp:~# node -v
v20.13.1
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to install Node.js 20 on Debian 12. Your feedback is much welcome.
Q
What is Node.js?
A
Node.js is a server-side scripting based on Google’s V8 JavaScript engine.
Q
Where can you use Node.js?
A
Node.js is used to build scalable programs especially web applications which are computationally simple but are frequently accessed.
Q
Node.js and Ajax (Asynchronous JavaScript and XML) are the advanced implementations of JavaScript. They all serve completely different purposes.
A
Ajax is primarily designed for dynamically updating a particular section of a page’s content, without having to update the entire page.
Node.js is used for developing client-server applications.
Node.js is used for developing client-server applications.
Q
What is the difference between Node.js and Ajax?
A
Node.js and Ajax (Asynchronous JavaScript and XML) are the advanced implementations of JavaScript. They all serve completely different purposes.
Ajax is primarily designed for dynamically updating a particular section of a page’s content, without having to update the entire page.
Node.js is used for developing client-server applications.
Ajax is primarily designed for dynamically updating a particular section of a page’s content, without having to update the entire page.
Node.js is used for developing client-server applications.
Q
What are the functionalities of NPM in Node.js?
A
NPM (Node Package Manager) provides two functionalities:
-Online repository for Node.js packages.
-Command line utility for installing packages, version management, and dependency management of Node.js packages.
-Online repository for Node.js packages.
-Command line utility for installing packages, version management, and dependency management of Node.js packages.