Install Caddy On Ubuntu

Installation

By Chandrashekhar Fakirpure

Updated on Jan 27, 2024

In this article, we'll explain you how to install Caddy on Ubuntu 22.04 using package. We will guide you with the installation process of the Caddy web server.

Written in Go, Caddy offers greater memory safety than servers written in C. A hardened TLS stack powered by the Go standard library serves a significant portion of all Internet traffic.

It is designed around simplicity and security that comes with a number of features that are useful for hosting websites. Caddy is both a flexible, efficient static file server and a powerful, scalable reverse proxy.

Prerequisites:

  • A Ubuntu 22.04 installed dedicated server or KVM VPS.
  • A root user access or normal user with the sudo privileges.

Install Caddy on Ubuntu

Step 1 - Update the server

Run following command to update the Ubuntu server:

apt update && apt upgrade -y

2. Install Dependencies

We need to install some dependencies before we install Caddy.

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https

3. Install Caddy web server

First, add GPG key using following command:

curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg

Next, add repository and update it.

curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
apt update

Finally, install Caddy using following command:

sudo apt install caddy

Check the version using following command:

caddy -v

Output:

v2.7.5 h1:HoysvZkLcN2xJExEepaFHK92Qgs7xAiCFydN5x5Hs6Q=

Now, navigate to your browser and enter your server IP or domain name:

http://Server-IP
OR
http://example.com

Install Caddy on Ubuntu HostnExtra

That's it. We have seen how to install Caddy on Ubuntu 22.04 using package.