Deno 2 is a modern JavaScript and TypeScript runtime that is secure by default, requires no package.json, and has first-class TypeScript support. Released in 2024, it is now Node.js-compatible. This guide installs Deno 2 on Ubuntu 24.04 LTS.
Tested and valid on:
- Ubuntu 24.04 LTS
Prerequisites
- Ubuntu 24.04 LTS server or desktop
- A user account with internet access
Step 1 – Install Deno
Install Deno using the official installer script:
curl -fsSL https://deno.land/install.sh | sh
Step 2 – Add Deno to PATH
Add the Deno binary location to your PATH:
echo 'export DENO_INSTALL="$HOME/.deno"' >> ~/.bashrc
echo 'export PATH="$DENO_INSTALL/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Step 3 – Verify the Installation
Check the Deno version:
deno --version
Step 4 – Run a Hello World Script
Create and run a simple TypeScript script:
echo "console.log('Hello from Deno 2 on Ubuntu 24.04!');" > hello.ts
deno run hello.ts
Step 5 – Run a Web Server
Deno has a built-in HTTP server. Create server.ts:
Deno.serve({ port: 8000 }, (_req) => {
return new Response('Hello from Deno 2!', { status: 200 });
});
Run it:
deno run --allow-net server.ts
Step 6 – Use Deno with npm Packages
Deno 2 supports npm packages with the npm: specifier:
deno run --allow-net npm:express
Step 7 – Update Deno
Update Deno to the latest version:
deno upgrade
Conclusion
Deno 2 is now installed on Ubuntu 24.04 LTS. Its built-in TypeScript support, secure-by-default permissions, and npm compatibility make it a compelling alternative to Node.js for new projects.