How to Install Deno on Ubuntu 20.04

Install Deno on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure Deno on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Deno is a simple, modern, and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust. Secure by default. No file, network, or environment access, unless explicitly enabled. Supports TypeScript out of the box. Ships only a single executable file. Has built-in utilities like a dependency inspector (deno info) and a code formatter (deno fmt).

Install Deno on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Install Deno on the Ubuntu system.

  • Install Deno from the official page.

Run the following commands to download installer Deno:

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

Once download complete, run the following command to move Deno environment file to /usr/bin directory:

mv /root/.deno/bin/deno /usr/bin/
  • Install Deno via Snap.

To install Deno, simply use the following command:

sudo snap install deno

Now verify the installation by checking the version using the following command:

deno –version

Step 3. Accessing Deno.

Try running a simple program:

deno run https://deno.land/std/examples/welcome.ts

Or a more complex one:

import { serve } from "https://deno.land/[email protected]/http/server.ts";
const s = serve({ port: 8000 });
console.log("http://localhost:8000/");
for await (const req of s) {
req.respond({ body: "Hello World\n" });
}

That’s all you need to do to install Deno on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. For further reading on Install Deno, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.