Cannot download caddy package on yum
Asked Answered
D

2

4

I using AWS EC2 on Amazon Linux and when i trying to download the caddy (yum install caddy) i have the following error. (shown on screenshot)

enter image description here

Donor answered 13/8, 2022 at 20:8 Comment(1)
I had this issue and answered a similar question here: https://mcmap.net/q/1372778/-error-package-caddy-2-4-6-1-el9-x86_64-copr-copr-fedorainfracloud-org-group_caddy-caddy-requires-libc-so-6-glibc_2-34-64bit it only requires building caddy from source and downloading Go which is easy. Does that help?Instructions
C
12

For me this recipe worked for Amazon Linux 2:

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

Note the additional argument to copr enable!

Here is a little more background for debugging the issue.

Comfit answered 14/11, 2022 at 18:47 Comment(3)
i think this will work, let me try... i'll be backSharkey
I get Requires: libc.so.6(GLIBC_2.34)(64bit). I have a libc.so.6 in /usr/lib64Exasperate
For those who have tried the above commands and still getting errors, try to remove the yum-plugin-copr and delete the cache by this commands: sudo yum clean packages > sudo yum clean headers > sudo yum clean metadata > sudo yum clean allGlynis
J
7

Edit Nov 19 2022 - A.H.'s answer worked for me, and is probably what you want. The solution I gave below works but is more complicated and takes 20 minutes; A.M.'s answer takes < 2 min to be up and running.


As of Oct 2022, you can build Caddy 2 without needing to know any golang.

Thanks to this answer: https://mcmap.net/q/1372778/-error-package-caddy-2-4-6-1-el9-x86_64-copr-copr-fedorainfracloud-org-group_caddy-caddy-requires-libc-so-6-glibc_2-34-64bit. I give a bit more detail below, using a couple docs at caddyserver.org. I ran this on Amazon Linux 2 Kernel 5.10 AMI 2.0.20220912.1 x86_64 HVM gp2.

The steps I give use "xcaddy". The "go/bin/xcaddy build" command takes a long time, over 20 minutes for me. I did the plain-old-build, without xcaddy, a few days ago. Today, when I do it I am getting a security warning from go about bits not matching. As described in the docs, if you don't use "xcaddy" the resulting caddy executable's "version" subcommand doesn't work. With xcaddy it does.

Steps


sudo yum install go -y

go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest

go/bin/xcaddy build
./caddy version
sudo cp caddy /usr/bin
# /usr/bin is the path used in example systemd unit files from
# caddy server.org, so if you don't use this path, you'd edit those
caddy version

#  following: see https://caddyserver.com/docs/running

sudo groupadd --system caddy
sudo useradd --system \
    --gid caddy \
    --create-home \
    --home-dir /var/lib/caddy \
    --shell /usr/sbin/nologin \
    --comment "Caddy web server" \
    caddy
#  not shown but required: you create a file named  /etc/systemd/system/caddy.service
#  as per docs/running link above, use one of the two unit files
#  as a templat.  After which, if you are using a Caddyfile:

sudo mkdir /etc/caddy

#  And then create a Caddyfile in there at /etc/caddy/Caddyfile

sudo systemctl daemon-reload
sudo systemctl enable --now caddy
systemctl status -l caddy
Jacob answered 3/10, 2022 at 1:51 Comment(6)
This didnt work. When i tried doing go/bin/xcaddy build -bash: go/bin/xcaddy: No such file or directoryElveraelves
@Adam, does go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest complete without error? Try again, I just cut-and-paste the commands into a fresh ec2 without problem.Jacob
@Adam, A.H gave another answer which is fast and for me it worked. https://mcmap.net/q/1472863/-cannot-download-caddy-package-on-yumJacob
this is currently failing with the following:Belovo
get"rsc.io/binaryregexp": found meta tag vcs.metaImport{Prefix:"rsc.io/binaryregexp", VCS:"git", RepoRoot:"github.com/rsc/binaryregexp"} at //rsc.io/binaryregexp?go-get=1 go: github.com/caddyserver/[email protected] requires golang.org/x/[email protected]: invalid version: git fetch --unshallow -f origin in /home/ec2-user/go/pkg/mod/cache/vcs/7d9b3b49b55db5b40e68a94007f21a05905d3fda866f685220de88f9c9bad98a: exit status 128: fatal: Out of memory, malloc failed (tried to allocate 944857 bytes) fatal: fetch-pack: invalid index-pack output [FATAL] exit status 1Belovo
@Belovo I had that type of issue a few months ago and it went away few days later.Jacob

© 2022 - 2024 — McMap. All rights reserved.