In this article, we are going to shows how to Install Deno runtime on Ubuntu 20.04 | 18.04 . If you are interested to Install Deno on Ubuntu then this post is ideal for you.
Deno is a popular, simple, modern and secure runtime for JavaScript/TypeScript that is based on the V8 JavaScript engine and the Rust programming language.
Features:
- It is secure by default. No file, network, or environment access, unless explicitly enabled.
- It is 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
).
For more details about Deno, please check its official page.
Ubuntu is a Linux Operating System based on Debian and mostly composed of non-profit(free) and open-source software. It is a complete Linux operating system that compatible with desktops, laptops, server and other devices. Ubuntu is Open Source so it is freely available for both community and professional support.
if you are a learner and looking for a Linux distribution for Learning then Ubuntu Linux Operating System is best for you as a beginning.
How to Install Deno on Ubuntu 20.04
You can install Deno on Ubuntu using below two methods:
- Install Deno using the installer.
- Install Deno via Snap.
Method 1 : Install Deno using the installer:
Deno comes as a single executable with no other required dependencies. So you can install it using the installer or download a latest release binary from its releases page.
To install Deno, first update the default package index in your system by running commands below:
sudo apt update
sudo apt upgrade
After that, run the commands below to install Deno:
sudo apt install curl
curl -fsSL https://deno.land/x/install/install.sh | sh
Once the installation process completed, move the Deno environment file to /usr/bin
directory by running command below:
mv /root/.deno/bin/deno /usr/bin/
At this point, Deno is successfully installed in your Ubuntu system and ready to use.
To verify the installation of Deno, run the command below:
deno –version
Method 2 : Install Deno via Snap:
Snap is a cross-distribution software deployment and package management system. Snap packages are safe to install and run, they auto-update and we can also roll-back the changes easily.
If Snap is not installed on your system then you will need to install it before you install Deno. Installing via snap is the best and easiest way to install packages on Linux machine, including Ubuntu.
To Install snap package manager , run the commands below :
sudo apt update
sudo apt install snapd
Next, run the command below to install Deno from Snap package management:
sudo snap install deno
The command above will install the Deno on your Ubuntu system.
To verify the installation of Deno, run the command below:
deno –version
Access Deno:
To accessing Deno, simply run the command below:
deno run https://deno.land/std/examples/welcome.ts
Or you can also use a more complex method below to accessing Deno:
import { serve } from "https://deno.land/std@0.99.0/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
If you face any error and issue in above steps , please use comment box below to report.
If our tutorials helped you, please consider buying us a coffee. We appreciate your support!
Thank you for your support.