Installing Caddy 2 on Amazon Linux 2


aws aws-ec2

The installation instructions of Caddy 2 for Fedora, RedHat and CentOS seem to be quite easy. Amazon Linux 2 is based on RedHat Enterprise Linux 5 and 6 (see Serverfault). Also amazon-linux-extras talks about EPEL 7 (Extra Packages for Enterprise Linux):

# amazon-linux-extras 
[…]
 24  epel                     available    [ =7.11  =stable ]
[…]

So this should be a quick thing – no? Let’s try:

$ yum -y install yum-plugin-copr	
[…]
Complete!

$ yum -y copr enable @caddy/caddy
Loaded plugins: copr, extras_suggestions, langpacks, priorities, update-motd
copr done

$ yum -y install caddy
Loaded plugins: copr, extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package caddy.x86_64 0:2.6.2-1.el9 will be installed
--> Processing Dependency: libc.so.6(GLIBC_2.34)(64bit) for package: caddy-2.6.2-1.el9.x86_64
--> Finished Dependency Resolution
Error: Package: caddy-2.6.2-1.el9.x86_64 (copr:copr.fedorainfracloud.org:group_caddy:caddy)
           Requires: libc.so.6(GLIBC_2.34)(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

OK, the installed version of libc is too old.

Of course some other people did have the same problem (see StackOverflow) but the answer suggests compiling from source. That’s a possible solution but I don’t like the burden of maintaining the installation for myself.

The installation page features the link View the Caddy COPR which offers more options and mentions RHEL 7. So it should work. The installation instructions for RHEL 7 on that page are the same as on the main page. But I noticed a little syntax twist in the section for CentOS Stream 91:

dnf copr enable @caddy/caddy epel-9-$(arch)

Perhaps this additional “chroot” argument is applicable for Amazon Linux 2 also – with some adaptions? After cleaning up the previous attempt I tried this:

$ yum -y install yum-plugin-copr
$ yum -y copr enable @caddy/caddy epel-7-$(arch)
$ yum -y install caddy

And that one worked!

Update 2023-02-25: This worked for me only on a fresh install. If the “normal” installation commands had been executed on the machine (i.e. copr enable command without the epel-7-$(arch) argument), then a simple yum -y copr disable @caddy/caddy followed by the “good” copr enable command did not work! After copy disable I had to delete some random cached files. But now copr disable followed by copr enable works for me, too.


  1. Update 2023-02-25: Now this line has been changed and the last argument has been deleted. ↩︎