How to Install Deno on Ubuntu 26.04 and 24.04

Share

To install Deno on Ubuntu 26.04 or 24.04, install curl and unzip, then run the official shell installer as your normal user. It puts Deno in your home directory, so you do not need Node.js, npm or a separate TypeScript compiler for the examples below.

Deno runs JavaScript and TypeScript outside a browser. Use it for scripts, command-line tools and web applications. This guide covers installation, a first TypeScript file, permissions, package tools, updates and removal. If a step fails, leave a comment with the error or contact us.

Before you begin
  • Use Ubuntu 26.04 or 24.04 Desktop or Server, internet access and a Bash terminal. Open Terminal with Ctrl+Alt+T on Ubuntu Desktop.
  • You need sudo for Ubuntu packages only. Run the Deno installer and your programs without sudo.
  • The official Linux downloads support 64-bit Intel/AMD and ARM64. Check uname -m: expect x86_64 or aarch64.
  • Install the prerequisites below. The installer downloads a .zip archive and fails on minimal Ubuntu servers without unzip unless 7z is already available.
Ubuntu terminal
sudo apt update && sudo apt install -y curl unzip

The && runs installation only if the package-list update succeeds. The -y accepts APT’s confirmation. These instructions use the default ~/.deno location and Bash; a custom shell or DENO_INSTALL setting needs its matching configuration.

1. Install Deno with the official script

Step 1: Check for an existing Deno installation

Check the release, architecture and command locations:

Ubuntu terminal
cat /etc/os-release
uname -m
type -a deno dx

Missing commands are normal on a new installation. If deno already exists, check deno --version and identify how it was installed before adding another copy. The first PATH match is the one your shell runs.

Step 2: Run the official installer

The following command downloads and immediately executes Deno’s installation script. Continue only if you trust this official source:

Ubuntu terminal
curl -fsSL https://deno.land/install.sh | sh

Run it without sudo. The script downloads the binary for your architecture into ~/.deno/bin. In an interactive terminal it prompts to configure your shell PATH automatically; accept that setup if you want deno available by name in new terminals. Use the current https://deno.land/install.sh address.

For an installation that accepts the setup defaults without prompting, use this alternative instead of the previous command:

Ubuntu terminal
curl -fsSL https://deno.land/install.sh | sh -s -- -y

Here, -s makes sh read the script from standard input, and -- -y passes -y to the installer. It can modify your shell startup files. To inspect the script before running it, use this alternative workflow in the same terminal:

Ubuntu terminal
deno_setup_dir=$(mktemp -d) &&
curl -fsSL https://deno.land/install.sh -o "$deno_setup_dir/install.sh" &&
less "$deno_setup_dir/install.sh"

If less is unavailable, use cat "$deno_setup_dir/install.sh". Read the full script; press q to leave less. If the download failed, stop. If you trust the script, execute the saved copy:

Ubuntu terminal
sh "$deno_setup_dir/install.sh"

Choose one installer workflow. The official installation guide recommends the shell installer on Linux. Deno does not provide an official APT repository; you do not need to add a PPA for this route.

Step 3: Load Deno in your current Bash terminal

The installer’s PATH changes normally apply to a new terminal. To use the default installation immediately, run:

Ubuntu terminal
export DENO_INSTALL="$HOME/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
deno --version
command -v deno

Expect a Deno 2.x version plus V8 and TypeScript version lines. The command path should be under your home directory at .deno/bin/deno. The installer selects the current stable release, so the exact patch version changes over time.

Step 4: Repair Bash PATH if you skipped shell setup

First inspect the file so you do not add duplicate entries:

Ubuntu terminal
grep -nE "DENO_INSTALL|\.deno|deno/env" ~/.bashrc

If the installer already configured Deno, keep its working setup. Otherwise, open ~/.bashrc in your preferred text editor and add these two lines at the end. They are shell configuration, not a TypeScript file:

Ubuntu terminal
export DENO_INSTALL="$HOME/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"

Save the file, then reload it in Bash:

Ubuntu terminal
source ~/.bashrc
deno --version
command -v deno

PATH tells the shell where to find executable commands. A missing grep match above is expected if no Deno entry exists. These Bash steps do not configure Zsh, Fish, a service or another user’s account.

2. Run your first TypeScript file

Step 1: Create a new practice directory

This creates a unique folder under your home directory so the exercise does not overwrite an existing project:

Ubuntu terminal
deno_demo_dir=$(mktemp -d "$HOME/deno-demo.XXXXXX") &&
cd "$deno_demo_dir" &&
cat > hello.ts <<'TS'
const name: string = "Ubuntu";
console.log(`Hello from Deno on ${name}!`);
TS

Keep this terminal open for the next exercises. Run pwd to see the practice directory’s actual path.

Step 2: Run and type-check the program

From the directory containing hello.ts:

Ubuntu terminal
deno run hello.ts
deno check hello.ts

The run command executes the TypeScript file directly. The check command separately checks its types; ordinary deno run does not perform a full type check. The greeting should be:

Hello from Deno on Ubuntu!
Step 3: Format and lint the file

Deno includes these tools, so this example needs no extra packages:

Ubuntu terminal
deno fmt hello.ts
deno lint hello.ts

Formatting may rewrite hello.ts to the standard layout. Lint checks for common code problems. All these commands run as your normal user.

3. See how Deno permissions work

A normal deno run program needs permission for actions such as reading files and using the network. Loading the entry-point source file is separate from granting the running program access to other files. The greeting above needs neither file-read nor network access.

Step 1: Create a file-reading example

In the same practice directory, create a harmless text file and a program that reads it:

Ubuntu terminal
printf 'Deno can read this note.\n' > note.txt
cat > read-note.ts <<'TS'
const note = await Deno.readTextFile("./note.txt");
console.log(note.trim());
TS

These filenames are new within the practice directory. Repeating this block replaces those exercise files.

Step 2: Run it without granting access

Disable interactive permission prompts so the denial is visible and repeatable:

Ubuntu terminal
deno run --no-prompt read-note.ts

Expect an error saying the program requires read access to ./note.txt. That is the intended result. Without –no-prompt, an interactive terminal can ask you whether to grant permission instead.

Step 3: Grant access only to that file

Place permission flags before the script filename:

Ubuntu terminal
deno run --allow-read=./note.txt read-note.ts

Expect Deno can read this note.. The shorthand is deno run -R=./note.txt read-note.ts. A bare –allow-read or -R grants broader read access; limiting the path is preferable when one file is enough.

Step 4: Try a network request

Create this optional example in the practice directory:

Ubuntu terminal
cat > fetch-example.ts <<'TS'
const response = await fetch("https://example.com");
await response.body?.cancel();
console.log(`HTTP status: ${response.status}`);
TS

The program contacts example.com and prints its HTTP status. It needs internet access but no API key.

Ubuntu terminal
deno run --no-prompt fetch-example.ts

Expect a network-permission error. Grant access to the requested host and retry:

Ubuntu terminal
deno run --allow-net=example.com fetch-example.ts

A successful request normally prints HTTP status: 200. -N=example.com is the short form; a bare –allow-net grants network access without that host restriction. A connection or certificate error after permission is granted is a separate network problem. Avoid -A or --allow-all as a routine fix. See Deno’s security and permissions guide for the full model.

4. Run package tools with dx

The current installer’s shell setup also sets up dx alongside deno in ~/.deno/bin. dx is a convenient form of deno x, similar to npx: it runs command-line tools from npm or JSR without adding them as permanent project dependencies. Downloaded packages can remain in Deno’s cache.

Step 1: Check both commands

For the default installation, check:

Ubuntu terminal
command -v deno
command -v dx

Both should resolve inside ~/.deno/bin. If shell setup was skipped or dx is missing, use your installed Deno to create its alias:

Ubuntu terminal
deno x --install-alias
hash -r
command -v dx
Step 2: Run a trusted package tool

For example, display the help for a pinned version of the standard-library HTTP file-server tool:

Ubuntu terminal
dx jsr:@std/[email protected]/file-server --help

This downloads the JSR package on first use and displays its help. The –help option exits without starting a server or sharing files. Version 1.1.4 is pinned for this exercise; omit the version only when you deliberately want the current release.

dx has a different permission default

dx runs with all permissions by default. Run only packages you trust. Do not assume the restricted behavior of deno run applies to dx, and do not run dx with sudo. The deno x documentation explains package binaries, JSR exports and the dx alias.

5. Update Deno or use the LTS channel

Option 1: Update to the latest stable release

For the user-owned installation from this guide, run without sudo:

Ubuntu terminal
deno upgrade
deno --version

This updates Deno itself. It does not upgrade every npm or JSR dependency in your projects. Run your project checks after changing runtime versions.

Option 2: Install the latest Long-Term Support release

Use this when you deliberately want Deno’s LTS channel:

Ubuntu terminal
deno upgrade lts
deno --version

LTS means Long-Term Support. Repeat deno upgrade lts for later LTS updates: a plain deno upgrade selects the latest stable channel instead. Ubuntu LTS and Deno LTS are independent release policies.

See the upgrade command reference for version selection and other channels. If you installed Deno through another package manager, update it through that manager instead of mixing installation methods.

6. Fix common installation problems

Issue 1: unzip is missing

If the installer says either unzip or 7z is required, install the prerequisites, then rerun your chosen official installer command:

Ubuntu terminal
sudo apt update && sudo apt install -y curl unzip

Minimal Ubuntu Server images may omit archive tools even when curl is already installed.

Issue 2: deno: command not found

Check whether the default binary exists and can run by its full path:

Ubuntu terminal
ls -l "$HOME/.deno/bin/deno"
"$HOME/.deno/bin/deno" --version

If it works, fix PATH using the Bash steps above or reopen the terminal. If the file is absent, read the installer error or check your custom DENO_INSTALL location.

Issue 3: dx: command not found

First make sure deno works. Then create the alias with deno x --install-alias, run hash -r and check command -v dx. On an older Deno version that lacks deno x, update Deno first.

Issue 4: PermissionDenied or NotCapable when running a script

Read which operation was denied. Grant the specific file or host the program needs, as in the permission exercises. Put flags before the filename; flags after it become script arguments. Do not replace a narrow permission with –allow-all just to hide the error.

Issue 5: download, TLS or certificate failure

Check your internet connection and system clock, then test the installer endpoint:

Ubuntu terminal
date -Is
curl -fsSI https://deno.land/install.sh

On minimal systems, installing ca-certificates may be needed. On managed networks, follow your organization’s proxy and trusted-certificate settings. Do not disable TLS verification. Binary downloads and shell setup also contact Deno’s download service and JSR.

Issue 6: wrong version or permission error during upgrade

Inspect every command match:

Ubuntu terminal
type -a deno dx
command -v deno
ls -ld "$HOME/.deno" "$HOME/.deno/bin"

A different PATH entry may select an older installation. A default install made with sudo may have files owned by root. Identify that installation before repairing ownership or removing it; do not use sudo deno upgrade as the default workaround.

Resume after an installation error

After repairing the dependency, connection or PATH issue, retry the same official installer route without sudo. Verify deno --version before returning to the examples. If Deno already works, a failed script does not require reinstalling the runtime: return to the practice directory and rerun it with the needed permission. Keep your project source files.

7. Uninstall Deno from the default location

Step 1: Inspect the installation before deleting it

These instructions remove the default ~/.deno installation only:

Ubuntu terminal
type -a deno dx
ls -la "$HOME/.deno"
grep -nE "DENO_INSTALL|\.deno|deno/env" ~/.bashrc ~/.profile

Check that the selected installation really uses ~/.deno. This directory can also contain globally installed Deno tools. Back up anything you need before deleting it. Use the relevant package manager for an installation it manages.

Step 2: Remove the default installation directory

The following command permanently deletes ~/.deno, including deno, dx and any other tools stored there. Use it only after the inspection above:

Ubuntu terminal
rm -rf -- "$HOME/.deno"

It does not delete the practice project under your home directory. If DENO_INSTALL points somewhere else, inspect that location separately instead of substituting an unverified path into a recursive delete.

Step 3: Remove the shell configuration

Open ~/.bashrc in a text editor and remove the two Deno-only lines you added earlier:

Ubuntu terminal
export DENO_INSTALL="$HOME/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"

This block identifies the lines to remove; do not execute or add them again. If the installer created a Deno-only source line, such as a line loading ~/.deno/env, remove that too. Inspect ~/.profile for installer-added Deno setup. Preserve unrelated PATH entries and shell settings.

Step 4: Start a fresh terminal and verify removal

Close the current terminal and open a new one so it does not retain the old environment:

Ubuntu terminal
type -a deno dx

Command-not-found messages are expected when no installation remains. If another copy appears, identify its installation method. The package cache is separate from ~/.deno; removing the runtime does not necessarily remove cached downloads. Keep projects unless you deliberately choose to delete them.

Helpful Deno resources

Continue learning

Frequently asked questions

Do I need Node.js or npm to install Deno?

No. The official shell installer downloads Deno directly. The examples in this guide do not require Node.js, npm or a separate TypeScript compiler.

Why does the Deno installer need unzip on Ubuntu?

The shell installer downloads a ZIP archive. It needs unzip or 7z to extract the executable. Installing curl and unzip first avoids this failure on minimal Ubuntu servers.

Where are deno and dx installed?

The default shell installation uses ~/.deno/bin. A custom DENO_INSTALL setting changes the installation directory. If dx is missing, run deno x –install-alias after verifying that deno works.

Does deno run automatically type-check TypeScript?

No. Deno can execute supported TypeScript directly, but ordinary deno run does not perform a full type check. Run deno check on the file or project when you want type checking.

Why does my Deno script ask for file or network access?

A normal deno run program needs permission for protected operations. Grant only the file paths or hosts it needs, using flags such as –allow-read=./note.txt or –allow-net=example.com before the script filename.

Does dx use the same permission defaults as deno run?

No. The dx alias runs package tools with all permissions by default. Use trusted packages and avoid sudo. Do not assume that the restrictions of an ordinary deno run command apply to dx.

How do I keep Deno on the LTS channel?

Use deno upgrade lts to install the latest Long-Term Support release and use the same command for later LTS updates. A plain deno upgrade selects the latest stable channel instead.

Related Ubuntu guides: Set up TypeScript for npm projects · Install Visual Studio Code · Install and use curl.