{"id":22514,"date":"2024-05-11T12:14:56","date_gmt":"2024-05-11T09:14:56","guid":{"rendered":"https:\/\/kifarunix.com\/?p=22514"},"modified":"2024-05-11T12:15:00","modified_gmt":"2024-05-11T09:15:00","slug":"install-nodejs-on-ubuntu-24-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-nodejs-on-ubuntu-24-04\/","title":{"rendered":"Install Nodejs on Ubuntu 24.04"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1048\" height=\"585\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/05\/install-nodejs-on-linux.png\" alt=\"install nodejs\" class=\"wp-image-22520\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/05\/install-nodejs-on-linux.png 1048w, https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/05\/install-nodejs-on-linux-768x429.png 768w\" sizes=\"(max-width: 1048px) 100vw, 1048px\" \/><\/figure><\/div>\n\n\n<p>In this tutorial, you will learn how to install Nodejs on Ubuntu 24.04.\u00a0<a href=\"https:\/\/nodejs.org\/en\/about\/\" target=\"_blank\" rel=\"noreferrer noopener\">Nodejs<\/a>\u00a0is a JavaScript runtime built on\u00a0Chrome\u2019s V8 JavaScript engine for easily building fast, scalable network applications. It uses an<br>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. It is also bundled with several useful libraries to handle server tasks: System, Events, Standard I\/O, Modules, Timers, Child Processes, POS<\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#installing-nodejs-on-ubuntu-24-04\">Installing Nodejs on Ubuntu 24.04<\/a><ul><li><a href=\"#install-nodejs-apt-repository\">Install Nodejs APT Repository<\/a><\/li><li><a href=\"#install-nodejs\">Install Nodejs<\/a><\/li><li><a href=\"#install-nodejs-development-tools-to-build-native-addons\">Install Nodejs Development Tools to Build Native Addons<\/a><\/li><li><a href=\"#install-yarn-on-ubuntu-24-04\">Install Yarn on Ubuntu 24.04<\/a><\/li><li><a href=\"#getting-started-with-nodejs\">Getting Started with Nodejs<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installing-nodejs-on-ubuntu-24-04\">Installing Nodejs on Ubuntu 24.04<\/h2>\n\n\n\n<p>Nodejs is available on the default Ubuntu 24.04 main repos. However, the available versions may not be up-to-date.<\/p>\n\n\n\n<p>For example, in the command output below, you can see that Nodejs 18.x is available on the default Ubuntu 24.04 repositories.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-cache policy nodejs<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>nodejs:\n  Installed: (none)\n  Candidate: 18.19.1+dfsg-6ubuntu5\n  Version table:\n     18.19.1+dfsg-6ubuntu5 500\n        500 http:\/\/de.archive.ubuntu.com\/ubuntu noble\/universe amd64 Packages\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-nodejs-apt-repository\">Install Nodejs APT Repository<\/h3>\n\n\n\n<p>Therefore, to install the latest, which is Nodejs 22.x, which is the current stable release as per the\u00a0<a href=\"https:\/\/nodejs.org\/en\/about\/releases\/\" target=\"_blank\" rel=\"noreferrer noopener\">Nodejs releases page<\/a>, you need to install Nodejs APT repository by executing the command below;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -sL https:\/\/deb.nodesource.com\/setup_22.x | sudo -E bash -<\/code><\/pre>\n\n\n\n<p>Sample installation command output;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>2024-05-11 08:58:52 - Installing pre-requisites\nHit:1 http:\/\/de.archive.ubuntu.com\/ubuntu noble InRelease\nHit:2 http:\/\/de.archive.ubuntu.com\/ubuntu noble-updates InRelease          \nHit:3 http:\/\/de.archive.ubuntu.com\/ubuntu noble-backports InRelease        \nHit:4 http:\/\/security.ubuntu.com\/ubuntu noble-security InRelease\nReading package lists... Done\nReading package lists... Done\nBuilding dependency tree... Done\nReading state information... Done\nca-certificates is already the newest version (20240203).\nca-certificates set to manually installed.\ncurl is already the newest version (8.5.0-2ubuntu10.1).\ncurl set to manually installed.\ngnupg is already the newest version (2.4.4-2ubuntu17).\ngnupg set to manually installed.\nThe following NEW packages will be installed:\n  apt-transport-https\n0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.\nNeed to get 3,974 B of archives.\nAfter this operation, 35.8 kB of additional disk space will be used.\nGet:1 http:\/\/de.archive.ubuntu.com\/ubuntu noble\/universe amd64 apt-transport-https all 2.7.14build2 [3,974 B]\nFetched 3,974 B in 0s (13.5 kB\/s)               \nSelecting previously unselected package apt-transport-https.\n(Reading database ... 85165 files and directories currently installed.)\nPreparing to unpack ...\/apt-transport-https_2.7.14build2_all.deb ...\nUnpacking apt-transport-https (2.7.14build2) ...\nSetting up apt-transport-https (2.7.14build2) ...\nScanning processes...                                                                                                                                                \nScanning candidates...                                                                                                                                               \nScanning linux images...                                                                                                                                             \n\nRunning kernel seems to be up-to-date.\n\nRestarting services...\n\nService restarts being deferred:\n systemctl restart unattended-upgrades.service\n\nNo containers need to be restarted.\n\nNo user sessions are running outdated binaries.\n\nNo VM guests are running outdated hypervisor (qemu) binaries on this host.\nHit:1 http:\/\/security.ubuntu.com\/ubuntu noble-security InRelease\nHit:2 http:\/\/de.archive.ubuntu.com\/ubuntu noble InRelease\nHit:3 http:\/\/de.archive.ubuntu.com\/ubuntu noble-updates InRelease\nHit:4 http:\/\/de.archive.ubuntu.com\/ubuntu noble-backports InRelease\nGet:5 https:\/\/deb.nodesource.com\/node_22.x nodistro InRelease [12.1 kB]\nGet:6 https:\/\/deb.nodesource.com\/node_22.x nodistro\/main amd64 Packages [1,278 B]\nFetched 13.4 kB in 0s (27.0 kB\/s)     \nReading package lists... Done\n2024-05-11 08:58:56 - Repository configured successfully. To install Node.js, run: apt-get install nodejs -y\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-nodejs\">Install Nodejs<\/h3>\n\n\n\n<p>Once the repos are installed, you can now install Nodejs.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install nodejs<\/code><\/pre>\n\n\n\n<p>Get the information about installed version of Nodejs on Ubuntu 24.04;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dpkg -l nodejs<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>Desired=Unknown\/Install\/Remove\/Purge\/Hold\n| Status=Not\/Inst\/Conf-files\/Unpacked\/halF-conf\/Half-inst\/trig-aWait\/Trig-pend\n|\/ Err?=(none)\/Reinst-required (Status,Err: uppercase=bad)\n||\/ Name           Version             Architecture Description\n+++-==============-===================-============-=================================================\nii  nodejs         22.1.0-1nodesource1 amd64        Node.js event-based server-side javascript engine\n<\/code><\/pre>\n\n\n\n<p>You can also check installed version of Nodejs on Ubuntu 24.04;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>node -v<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>v22.1.0<\/code><\/pre>\n\n\n\n<p>Note that the command above also installs NPM along with Nodejs. You can verify by checking the version of installed NPM on Ubuntu 24.04.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm -v<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>10.7.0<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-nodejs-development-tools-to-build-native-addons\">Install Nodejs Development Tools to Build Native Addons<\/h3>\n\n\n\n<p>If you need to build native Nodejs addons, you need to install some development tools by running the command below;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install gcc g++ make<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-yarn-on-ubuntu-24-04\">Install Yarn on Ubuntu 24.04<\/h3>\n\n\n\n<p>You may also want to install Yarn on Ubuntu 24.04. To do so, run the command below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -sL https:\/\/dl.yarnpkg.com\/debian\/pubkey.gpg | sudo gpg --dearmor -o  \/etc\/apt\/trusted.gpg.d\/yarnkey.gpg<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"deb https:\/\/dl.yarnpkg.com\/debian stable main\" | sudo tee \/etc\/apt\/sources.list.d\/yarn.list<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install yarn<\/code><\/pre>\n\n\n\n<p>You can now proceed to build your web applications using Nodejs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"getting-started-with-nodejs\">Getting Started with Nodejs<\/h3>\n\n\n\n<p>Read more on&nbsp;<a href=\"https:\/\/nodejs.org\/en\/docs\/guides\/getting-started-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\">Nodejs getting started guide<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to install Nodejs on Ubuntu 24.04.\u00a0Nodejs\u00a0is a JavaScript runtime built on\u00a0Chrome\u2019s V8 JavaScript engine for easily building fast,<\/p>\n","protected":false},"author":10,"featured_media":9382,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121],"tags":[3760,7487,7396],"class_list":["post-22514","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-nodejs","tag-nodejs-22-x","tag-ubuntu-24-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/22514"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=22514"}],"version-history":[{"count":4,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/22514\/revisions"}],"predecessor-version":[{"id":22521,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/22514\/revisions\/22521"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/9382"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=22514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=22514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=22514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}