skip to Main Content

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

2

Answers


  1. 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://stackoverflow.com/a/71622285/514608. 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
    
    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search