以centos 6.9为例子
首先切换至root用户
检查当前系统是否安装了crontab
如果没有安装crontab则执行以下命令安装,已经安装则跳过该步骤
yum install -y vixie-cron
检查当前系统是否安装了wget或者curl
如果没有则安装,比如安装wget
yum install -y wget
安装acme.sh
wget -O - https://get.acme.sh | sh
或者
curl https://get.acme.sh | sh
安装程序将执行3个操作:
Cron示例:
0 0 * * * "/home/user/.acme.sh"/acme.sh --cron --home "/home/user/.acme.sh" > /dev/null
注意默认是没有添加到用户环境变量的,编辑root用户变量配置文件添加.acme目录到用户变量中
编辑文件
vi /root/.bash_profile
配置添加.acme目录
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:$HOME/.acme.sh
export PATH
acme.sh --issue -d -d *.a.com -d *.b.com --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please
执行上面的命令,会在控台输出以下内容
[2018年 11月 25日 星期日 09:45:47 CST] Creating domain key
[2018年 11月 25日 星期日 09:45:47 CST] The domain key is here: /root/.acme.sh/a.net/a.net.key
[2018年 11月 25日 星期日 09:45:47 CST] Multi domain='DNS:a.net,DNS:*.a.net'
[2018年 11月 25日 星期日 09:45:47 CST] Getting domain auth token for each domain
[2018年 11月 25日 星期日 09:45:50 CST] Getting webroot for domain='ifok.net'
[2018年 11月 25日 星期日 09:45:50 CST] Getting webroot for domain='*.ifok.net'
[2018年 11月 25日 星期日 09:45:50 CST] Add the following TXT record:
[2018年 11月 25日 星期日 09:45:50 CST] Domain: '_acme-challenge.a.net'
[2018年 11月 25日 星期日 09:45:50 CST] TXT value: 'nroAAsv36T_Nzdi4tbQ1IHuZHA9KlCzRE0cz7EcOvwU'
[2018年 11月 25日 星期日 09:45:50 CST] Please be aware that you prepend _acme-challenge. before your domain
[2018年 11月 25日 星期日 09:45:50 CST] so the resulting subdomain will be: _acme-challenge.ifok.net
[2018年 11月 25日 星期日 09:45:50 CST] Please add the TXT records to the domains, and re-run with --renew.
[2018年 11月 25日 星期日 09:45:50 CST] Please check log file for more details: /root/.acme.sh/acme.sh.log
去域名服务商的控制台添加dns txt记录
记录名称:_acme-challenge.a.net
记录值:nroAAsv36T_Nzdi4tbQ1IHuZHA9KlCzRE0cz7EcOvwU
注意:记录值和名称会变动的参考你自己控制台输出的内容
添加完成txt记录以后,执行检查命令,如果检查通过则生成ssl证书,存放路径在/root/.acme.sh/域名/
检查命令:
acme.sh --renew -d -d *.a.com -d *.b.com --yes-I-know-dns-manual-mode-enough-go-ahead-please
更多模式参考:点击前往
https://www.leftso.com/article/540.html