Cannot install Caddy on new Raspian

On a brand-new Raspian Raspberry Pi4 (running version 10, buster).

I can install plenty of other packages with apt install, but “apt install caddy” fails with the message “Unable to locate package caddy”.

Which is strange because that worked on other Raspberry Pi’s. Is it something to do with the buster version?

Any suggestions?

Did you add the repo? Caddy is not part of official debian/raspbian repos.

1 Like

@francislavoie
That’s strange, because Caddy Documentation specifically mentions “Debian, Ubuntu, Raspbian”.

Which is a good thing, because this is the line I’d mistyped earlier :slight_smile:

echo “deb [trusted=yes] https://apt.fury.io/caddy/ /”
| sudo tee -a /etc/apt/sources.list.d/caddy-fury.list

After that, apt install caddy does work.

I don’t understand what you mean. Yes, that’s the repo the Caddy team provides, but it’s not the official debian repo (as in provided by debian).

Glad you got it working!

I’m glad you’ve said that’s not the official repo.

That might explain why I got the wrong caddy package and the error mentioned here.

How can I find and install the official Caddy package?

You misunderstood. “Official” can be interpreted in different ways. There’s “official” in the sense that the Caddy team maintains the https://apt.fury.io/caddy/ repo, but it’s “unofficial” in the sense that it doesn’t ship alongside debian.

You probably installed it correctly, but you have two caddy things in your PATH. One from the package we provide, and one from some Python thing. If you do which caddy, you should see /usr/bin/caddy If you see something else, then it’s because something else is taking precedence over caddy the web server. If you run caddy version you should see something like this:

$ caddy version
v2.2.1 h1:Q62GWHMtztnvyRU+KPOpw6fNfeCD3SkwH7SfT1Tgt2c=

It’s up to you to figure out what installed this other “caddy” thing. I’ve never heard of it.

It might be this:

You probably need to uninstall that.

Thanks, I have just run this :
“apt remove caddy”.

“which caddy” just shows one line
/usr/local/bin/caddy

Is the way shown here a safer way?

curl https://getcaddy.com | bash -s personal

That’s from 2017. Those are installation instructions for Caddy v1. Please refer to our official documentation, i.e. https://caddyserver.com/docs/download.

Like I’ve already said, /usr/local/bin/caddy is not the Caddy Web Server. You installed something entirely different which also uses the name caddy. You need to uninstall that.

By running apt remove caddy, you removed Caddy Web Server, which was correctly installed.

You have to remove the other thing.

I think I have found the other thing and uninstalled it :slight_smile:
python3 -m pip uninstall caddy
That removed
/usr/local/lib/python3.7/dist-packages/caddy/-1.3.2.dist-info/*
/usr/local/lib/python3.7/dist-packages/caddy/*

1 Like

I’ve run “apt install caddy” again. It setup caddy 2.2.1
“which caddy” says /usr/bin/caddy

1 Like

@francislavoie - thank you for your patience and your help, much appreciated :grinning:

1 Like