{"id":1217,"date":"2026-12-01T09:00:00","date_gmt":"2026-12-01T09:00:00","guid":{"rendered":"https:\/\/vpslake.com\/blog\/?p=1217"},"modified":"2026-12-01T09:00:00","modified_gmt":"2026-12-01T09:00:00","slug":"install-latest-nodejs-ubuntu-24-04-ppa","status":"publish","type":"post","link":"https:\/\/vpslake.com\/blog\/2026\/12\/01\/install-latest-nodejs-ubuntu-24-04-ppa\/","title":{"rendered":"How to Install Latest Node.js on Ubuntu 24.04 with PPA"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Install latest Node.js on Ubuntu 24.04 with PPA-style APT packages and finish with both <code>node<\/code> and <code>npm<\/code> working in about ten minutes. This guide uses NodeSource\u2019s current-release repository, verifies the installed runtime, and runs a private HTTP test without exposing an application port.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>A fresh 64-bit Ubuntu 24.04 LTS server with at least 1 GB of RAM and 2 GB of free disk space for Node.js, npm, and a small project.<\/li>\n\n\n<li>SSH access as <code>root<\/code>, or a normal user with working <code>sudo<\/code> privileges and permission to install APT packages.<\/li>\n\n\n<li>Outbound HTTPS access to <code>deb.nodesource.com<\/code> and Ubuntu package mirrors. No domain name is needed for the local verification test.<\/li>\n\n\n<li>A <a href=\"https:\/\/vpslake.com\/buy-vps\">VPSLake Linux VPS<\/a> if you need a root-access Ubuntu server for Node.js applications.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The commands use <code>sudo<\/code>. If you are logged in as <code>root<\/code>, remove <code>sudo<\/code> from each command. NodeSource\u2019s <code>setup_current.x<\/code> selector follows the current Node.js major release; at the time of writing, that is the Node.js 26 line. Use the LTS selector described in the FAQ if your application prioritizes long-term maintenance over the newest features.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Confirm Ubuntu 24.04 and prepare APT<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Checking the release and CPU architecture first prevents you from adding a repository intended for a different system.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>. \/etc\/os-release &amp;&amp; printf 'ID=%s\\nVERSION_ID=%s\\nVERSION_CODENAME=%s\\n' \"$ID\" \"$VERSION_ID\" \"$VERSION_CODENAME\"\ndpkg --print-architecture\nsudo apt-get update\nsudo apt-get install -y ca-certificates curl gnupg<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The first checks should identify Ubuntu Noble and an architecture supported by NodeSource, normally <code>amd64<\/code> or <code>arm64<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ID=ubuntu\nVERSION_ID=\"24.04\"\nVERSION_CODENAME=noble\namd64<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the release is not <code>24.04<\/code> or the architecture is not <code>amd64<\/code>\/<code>arm64<\/code>, stop and use instructions for that operating system or architecture. Do not force Noble repository metadata onto another Ubuntu release.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Add the NodeSource current-release repository<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The setup script installs the repository key and a signed APT source file, so APT can receive current Node.js packages without the deprecated <code>apt-key<\/code> workflow.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Download the script first, then execute the local copy with <code>sudo<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -fsSL https:\/\/deb.nodesource.com\/setup_current.x -o \/tmp\/nodesource_setup.sh\nsudo -E bash \/tmp\/nodesource_setup.sh\nrm -f \/tmp\/nodesource_setup.sh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The output should end with a successful repository message and an instruction to install <code>nodejs<\/code>. The script currently maps <code>setup_current.x<\/code> to the Node.js 26 repository and uses the <code>nodistro<\/code> suite, which is normal for this NodeSource feed. NodeSource lists Ubuntu 24.04 Noble as a supported Debian-based target in its <a href=\"https:\/\/github.com\/nodesource\/distributions#debinstall\" target=\"_blank\" rel=\"noopener\">distribution instructions<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Confirm that APT sees a candidate before installing it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-cache policy nodejs | sed -n '1,8p'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected output resembles this; the exact patch number changes as Node.js releases updates:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nodejs:\n  Installed: (none)\n  Candidate: 26.x.y-1nodesource1\n  Version table:\n *** 26.x.y-1nodesource1 600\n        600 https:\/\/deb.nodesource.com\/node_26.x nodistro\/main amd64 Packages<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Install Node.js and npm<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>nodejs<\/code> package from NodeSource includes the Node.js runtime and npm, so one APT installation gives you the tools needed to run and install JavaScript applications.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install -y nodejs\nnode --version\nnpm --version\ncommand -v node\ncommand -v npm<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The version numbers will vary, but the result should show a <code>v26<\/code> Node.js release, a numeric npm version, and binaries under <code>\/usr\/bin<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>v26.x.y\n10.x.y\n\/usr\/bin\/node\n\/usr\/bin\/npm<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you had an older Node.js installation from Ubuntu, APT may replace it when the NodeSource candidate has the higher priority. Check the selected origin with <code>apt-cache policy nodejs<\/code> before proceeding.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Run a private Node.js HTTP test<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A loopback-only server proves that Node.js can execute JavaScript and accept an HTTP request while keeping port 3000 inaccessible from the public network.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Run this temporary test in one Bash session:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>node -e 'require(\"node:http\").createServer((request, response) =&gt; response.end(\"Node.js is working on Ubuntu 24.04\\\\n\")).listen(3000, \"127.0.0.1\")' &gt;\/tmp\/node-check.log 2&gt;&amp;1 &amp;\nNODE_PID=$!\nsleep 1\ncurl -fsS http:\/\/127.0.0.1:3000\nkill \"$NODE_PID\"\nwait \"$NODE_PID\" 2&gt;\/dev\/null || true<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The curl request should return:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Node.js is working on Ubuntu 24.04<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The process listens only on <code>127.0.0.1<\/code>, and the final <code>kill<\/code> removes it. For a real application, put the service behind a TLS-enabled reverse proxy and open only the required web ports in UFW; do not expose a development listener just to test it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Verify the Node.js installation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">These checks confirm the major release, npm availability, the active APT source, and the runtime\u2019s ability to load a built-in module:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>node --version\nnpm --version\nnode -p 'process.platform + \" \" + process.arch'\nnode -e 'console.log(require(\"node:fs\").existsSync(\"\/etc\/os-release\") ? \"Node.js runtime check passed\" : \"Runtime check failed\")'\napt-cache policy nodejs | sed -n '1,7p'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expect a <code>v26<\/code> version, a numeric npm version, <code>linux amd64<\/code> or <code>linux arm64<\/code>, a passed runtime message, and a NodeSource candidate in the policy output. For runtime APIs and supported behavior, use the <a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/\" target=\"_blank\" rel=\"noopener\">official Node.js API documentation<\/a>.<\/p>\n\n\n\n<aside class=\"vl-element vl-cta-banner\" aria-label=\"Run Node.js on Ubuntu\">\n\t<div class=\"vl-cta-banner__content\">\n\t\t<p class=\"vl-cta-banner__eyebrow\">Ubuntu VPS hosting<\/p>\n\t\t<h3 class=\"vl-cta-banner__title\">Run Node.js on Ubuntu<\/h3>\n\t\t<p class=\"vl-cta-banner__text\">Deploy current Node.js applications on a root-access Ubuntu 24.04 VPS.<\/p>\n\t<\/div>\n\t<a class=\"vl-cta-banner__button\" href=\"\/buy-vps\" aria-label=\"View Linux VPS plans\">View Linux VPS plans<\/a>\n<\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><code>apt-cache policy nodejs<\/code> still shows Ubuntu\u2019s old version<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The setup script may not have completed, or APT may still have stale package metadata. Confirm that the source file exists, refresh APT, and inspect the candidate again:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo test -f \/etc\/apt\/sources.list.d\/nodesource.sources &amp;&amp; echo \"NodeSource source file found\"\nsudo apt-get update\napt-cache policy nodejs<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The policy output should include <code>https:\/\/deb.nodesource.com\/node_26.x<\/code>. If it does not, rerun Step 2 and read the first error from the setup script instead of installing the Ubuntu package by accident.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>Could not resolve host: deb.nodesource.com<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This is a DNS or outbound-network problem, not a Node.js package problem. Check the resolver and HTTPS path, then correct the VPS network settings or provider firewall before repeating the download:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>getent hosts deb.nodesource.com\ncurl -I https:\/\/deb.nodesource.com<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Do not replace the repository URL with an untrusted mirror. A working result returns an address from <code>getent<\/code> and an HTTPS response header from <code>curl<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>Could not get lock \/var\/lib\/dpkg\/lock-frontend<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Another APT process, commonly unattended upgrades, is using the package database. Wait for that operation to finish, then retry; never delete the lock file while <code>apt<\/code> or <code>dpkg<\/code> is active.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ps -ef | grep -E '[a]pt|[d]pkg|unattended'\nsudo dpkg --configure -a\nsudo apt-get install -y nodejs<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If <code>dpkg --configure -a<\/code> reports an active package process, wait and run it again after the process exits.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>npm ERR! EACCES<\/code> during a global install<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The system Node.js installation is owned by APT, so a normal user should not write packages into its protected global directory. Prefer project-local dependencies:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir -p ~\/YOUR_APP\ncd ~\/YOUR_APP\nnpm init -y\nnpm install YOUR_PACKAGE<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>YOUR_APP<\/code> with your application directory and <code>YOUR_PACKAGE<\/code> with the dependency name you actually need. The resulting <code>package.json<\/code> and lockfile remain owned by your user, which avoids turning the system installation into a shared writable directory.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use <code>sudo npm install -g<\/code> only for a package you deliberately want system-wide, and review its publisher and permissions first. Avoid making <code>\/usr<\/code> or npm\u2019s global directories writable by every user.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Hardening and next steps<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>Keep the Node.js package on the current branch with <code>sudo apt-get update &amp;&amp; sudo apt-get upgrade<\/code>, and test application dependencies before accepting major updates.<\/li>\n\n\n<li>Run production applications under a dedicated non-root account and a systemd service; never run an internet-facing app as <code>root<\/code> just because Node.js was installed with <code>sudo<\/code>.<\/li>\n\n\n<li>Allow only SSH, HTTP, and HTTPS as needed in UFW. You can draft a narrow rule set with the <a href=\"https:\/\/vpslake.com\/ufw-firewall-generator\">VPSLake UFW firewall generator<\/a>, then review every rule before applying it.<\/li>\n\n\n<li>Store secrets outside source files, commit <code>package-lock.json<\/code>, and use <code>npm audit<\/code> as one input to dependency review rather than blindly upgrading production packages.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Is NodeSource a real Ubuntu PPA?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It is not a Launchpad PPA; it is a signed third-party APT repository commonly called a PPA in installation searches. The setup script creates the repository configuration and signing-key association for Node.js packages on Ubuntu.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Should I install the current release or Node.js LTS?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Choose the current release when you specifically need its newest runtime features. For most production websites and APIs, use NodeSource\u2019s LTS selector instead by changing <code>setup_current.x<\/code> in Step 2 to <code>setup_lts.x<\/code>; that tracks the supported long-term-maintenance branch rather than the newest major.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Does the Node.js package include npm?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. The NodeSource <code>nodejs<\/code> package installs npm alongside the runtime, so <code>npm --version<\/code> should work immediately after the APT installation. Project dependencies should still be installed locally inside each application directory.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I update Node.js later?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For updates within the selected major line, run <code>sudo apt-get update<\/code> followed by <code>sudo apt-get upgrade<\/code>. Switching from Current to LTS, or from one major line to another, is a deliberate repository change; check application compatibility and remove conflicting NodeSource source files before changing branches.<\/p>\n\n\n\n<script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"Is NodeSource a real Ubuntu PPA?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"It is not a Launchpad PPA; it is a signed third-party APT repository commonly called a PPA in installation searches. The setup script creates the repository configuration and signing-key association for Node.js packages on Ubuntu.\"}}, {\"@type\": \"Question\", \"name\": \"Should I install the current release or Node.js LTS?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Choose the current release when you specifically need its newest runtime features. For most production websites and APIs, use NodeSource\u2019s LTS selector instead by changing `setup_current.x` in Step 2 to `setup_lts.x`; that tracks the supported long-term-maintenance branch rather than the newest major.\"}}, {\"@type\": \"Question\", \"name\": \"Does the Node.js package include npm?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Yes. The NodeSource `nodejs` package installs npm alongside the runtime, so `npm --version` should work immediately after the APT installation. Project dependencies should still be installed locally inside each application directory.\"}}, {\"@type\": \"Question\", \"name\": \"How do I update Node.js later?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"For updates within the selected major line, run `sudo apt-get update` followed by `sudo apt-get upgrade`. Switching from Current to LTS, or from one major line to another, is a deliberate repository change; check application compatibility and remove conflicting NodeSource source files before changing branches.\"}}]}<\/script>\n\n","protected":false},"excerpt":{"rendered":"Learn to install latest node.js on ubuntu 24.04 with ppa using NodeSource, verify npm and versions, run a private test server, and fix common APT errors.","protected":false},"author":1,"featured_media":1218,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_singular_sidebar":"","csco_page_header_type":"","csco_page_load_nextpost":"","footnotes":""},"categories":[5,9],"tags":[156,64,65,102],"class_list":["post-1217","post","type-post","status-publish","format-standard","has-post-thumbnail","category-guides","category-vps-hosting","tag-javascript","tag-nodejs","tag-npm","tag-ubuntu-24-04","cs-entry"],"_links":{"self":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1217","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/comments?post=1217"}],"version-history":[{"count":1,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1217\/revisions"}],"predecessor-version":[{"id":4432,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1217\/revisions\/4432"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/media\/1218"}],"wp:attachment":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/media?parent=1217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/categories?post=1217"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/tags?post=1217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}