Skip to content
xzeu edited this page Jul 4, 2024 · 2 revisions

生成免费SSL证书前,请使用Linux/BSD系统更新工具更新CA包和系统补丁,以避免在生成证书过程中出现未预料到的问题。完成更新后,可以按照以下步骤进行安装。

步骤1: 安装 acme.sh

在线安装方式:https://get.acme.sh

使用 curl 安装:

curl https://get.acme.sh | sh -s [email protected]

或者使用 wget 安装:

wget -O -  https://get.acme.sh | sh -s [email protected]

使用 GitHub 安装:

使用curl安装:

curl https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh | sh -s -- --install-online -m [email protected]

或者使用wget安装:

wget -O -  https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh | sh -s -- --install-online -m [email protected]

步骤2: 使用 git 克隆并安装

git clone --depth 1 https://github.com/acmesh-official/acme.sh.git
cd acme.sh
./acme.sh --install -m [email protected]

步骤3: 高级安装选项

git clone --depth 1 https://github.com/acmesh-official/acme.sh.git
cd acme.sh
./acme.sh --install \
--home ~/myacme \
--config-home ~/myacme/data \
--cert-home ~/mycerts \
--accountemail "[email protected]" \
--accountkey ~/myaccount.key \
--accountconf ~/myaccount.conf \
--useragent "this is my client."

你不需要设置所有选项,只需设置你关心的那些选项即可。这些选项的详细说明如下:

  • --home 是安装 acme.sh 的自定义目录,默认安装在 ~/.acme.sh 中。
  • --config-home 是一个可写文件夹,acme.sh 将所有文件(包括证书/密钥、配置文件)写入其中,默认为 --home 中。
  • --cert-home 是用于保存你发行的证书的自定义目录,默认保存在 --config-home 中。
  • --accountemail 是用于注册到 Let's Encrypt 的电子邮件地址,你将在此处接收到更新通知邮件。
  • --accountkey 是保存你的账户私钥的文件。默认保存在 --config-home 中。
  • --useragent 是发送给 Let's Encrypt 的用户代理标头值。
  • --nocron 安装 acme.sh 时不安装 cron 作业。

特殊情况: 从 certbot 转换 LE 账户数据到 acme.sh

如果已经使用 certbot,并希望转换其 LE 账户数据到 acme.sh 格式,请参考以下链接进行转换:https://github.com/maddes-b/linux-stuff/tree/main/acme.sh

如果要重新使用从 certbot 创建的 LE 账户,请在安装过程中不要指定 -m/--email

以上是安装和配置 acme.sh 以生成免费SSL证书的详细步骤和说明。

Clone this wiki locally