在Debian系統上安裝Caddy主要有兩種方法:通過包管理器或從源碼編譯。以下是詳細步驟:
首先,打開終端并更新你的包列表,以確保你獲取的是最新的軟件包信息。
sudo apt update
接下來,你需要添加Caddy的官方APT存儲庫。這可以通過添加GPG密鑰和存儲庫列表文件來完成。
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
現在,你可以通過APT包管理器安裝Caddy了。
sudo apt install caddy
安裝完成后,你可以啟動Caddy服務并設置為開機自啟。
sudo systemctl start caddy
sudo systemctl enable caddy
最后,你可以通過運行以下命令來驗證Caddy服務是否已成功安裝并正在運行。
systemctl status caddy