Deno is a modern, secure runtime for JavaScript and TypeScript built on V8 and Rust. Unlike Node.js, Deno ships TypeScript support out of the box, enforces an explicit permissions model that prevents scripts from accessing files or the network without your consent, and bundles a formatter, linter, and test runner in a single executable. On RHEL 8, the official install script fetches a prebuilt binary, making setup fast with no package repository required. This tutorial covers installing Deno, running TypeScript code, building a simple HTTP server, compiling a standalone binary, and using Deno’s built-in toolchain.
Prerequisites
- A RHEL 8 server or workstation with a non-root sudo user
curlandunzipinstalled (dnf install -y curl unzip)- Internet access to reach
deno.landandgithub.com - No prior Node.js or npm installation required
Step 1 — Install Deno
The official shell script downloads the latest Deno release from GitHub and places the binary at ~/.deno/bin/deno.
curl -fsSL https://deno.land/install.sh | sh
Add Deno’s binary directory to your PATH. Append these lines to ~/.bashrc and reload the shell:
echo 'export DENO_INSTALL="$HOME/.deno"' >> ~/.bashrc
echo 'export PATH="$DENO_INSTALL/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Verify the installation:
deno --version
You should see Deno’s version alongside the V8 engine and TypeScript versions it bundles, for example: deno 1.44.0 (release, x86_64-unknown-linux-gnu).
Step 2 — Run a TypeScript Script with Explicit Permissions
Deno’s security model requires you to grant each capability at the command line. Create a simple TypeScript file that fetches a URL.
cat > hello.ts << 'EOF'
const res = await fetch("https://api.github.com/zen");
const text = await res.text();
console.log("GitHub zen:", text);
EOF
Run it with network access explicitly granted:
deno run --allow-net hello.ts
If you omit --allow-net, Deno will deny the network request and print a PermissionDenied error, demonstrating the security model in action.
Step 3 — Build a Simple HTTP Server
Deno’s standard library provides a high-level Deno.serve() API introduced in Deno 1.35. Create a minimal HTTP server.
cat > server.ts < {
const url = new URL(req.url);
if (url.pathname === "/") {
return new Response("Hello from Deno on RHEL 8!n", {
headers: { "content-type": "text/plain" },
});
}
return new Response("Not Found", { status: 404 });
});
console.log("Listening on http://localhost:8000");
EOF
Run the server:
deno run --allow-net server.ts
In another terminal, test it:
curl http://localhost:8000
Step 4 — Compile a Standalone Binary
Deno can bundle your TypeScript application and the Deno runtime itself into a single self-contained executable that runs on any compatible Linux machine without Deno installed.
deno compile --allow-net --output myserver server.ts
Run the compiled binary directly:
./myserver
The compiled binary is fully portable. Copy it to any RHEL 8 or compatible Linux host and execute it with no runtime dependency.
Step 5 — Use the Built-in Formatter, Linter, and Test Runner
Deno ships opinionated code quality tools so you do not need to install ESLint, Prettier, or a separate test framework.
deno fmt server.ts
Run the linter to catch common issues:
deno lint server.ts
Create a simple test file and run it:
cat > server_test.ts < {
assertEquals(1 + 1, 2);
});
EOF
deno test server_test.ts
Step 6 — Install a Global CLI Tool and Update Deno
deno install fetches a remote script and creates a named executable in ~/.deno/bin. Install the popular deployctl tool as an example.
deno install --allow-read --allow-write --allow-env --allow-net
--name deployctl
https://deno.land/x/deploy/deployctl.ts
Update Deno itself to the latest stable release:
deno upgrade
To pin to a specific version:
deno upgrade --version 1.44.0
Conclusion
You have installed Deno on RHEL 8, run TypeScript scripts with explicit permission grants, built and tested a lightweight HTTP server using Deno.serve(), compiled it into a standalone binary, and used Deno’s integrated formatter, linter, and test runner. Deno’s security-first permission model means every capability a script needs must be explicitly declared, making auditing straightforward and reducing the blast radius of supply-chain attacks. The single-binary distribution and zero-configuration TypeScript support make Deno an excellent choice for scripts, serverless functions, and lightweight microservices on RHEL 8.
Next steps: How to Install Rust and Cargo on RHEL 8, How to Install .NET SDK and Runtime on RHEL 8, and How to Deploy a Ruby on Rails Application on RHEL 8.