在 CentOS 上安裝 Certbot,您需要首先確保已經安裝了 Python 和 pip
sudo yum install epel-release
sudo yum install certbot python3-certbot-nginx
如果您使用的是 Apache 服務器,可以使用以下命令安裝 certbot-apache:
sudo yum install certbot python3-certbot-apache
對于 Nginx 服務器:
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
將 yourdomain.com
和 www.yourdomain.com
替換為您的域名。
對于 Apache 服務器:
sudo certbot --apache -d yourdomain.com -d www.yourdomain.com
同樣,將 yourdomain.com
和 www.yourdomain.com
替換為您的域名。
按照提示完成證書的安裝過程。Certbot 將自動為您的服務器配置 SSL 證書。
最后,您可以使用以下命令檢查證書是否已成功安裝:
sudo certbot certificates
現在,您的 CentOS 服務器應該已經成功安裝了 Certbot 并配置了 SSL 證書。