Apacheが動いていると、証明書を取得できないので、
1 |
$ sudo systemctl stop apache2 |
を実行していったん停止します。次のコマンドでCertbotを入手・導入して、証明書と、証明に必要な鍵を取得します。
1 2 3 4 |
$ cd $ git clone https://github.com/certbot/certbot $ cd certbot $ ./certbot-auto certonly --standalone -t |
最後のコマンドを実行すると、最初にCertbotの動作に必要なパッケージがインストールされます。「[sudo] taro のパスワード:」のように表示されたら、ユーザーのパスワードを入力してください。「続行しますか? [Y/n] 」が表示されたら、[Enter]キーを押します。
「Enter email address (used for urgent renewal and security notices) (Enter ‘c’ to cancel):」が表示されたら、自分のメールアドレスを入力して[Enter]キーを押します。ライセンスに関するリンクが示されるので確認した上で、「(A)gree/(C)ancel:」の後に「A」を入力して[Enter]キーを押します。次に、Let’s Encryptプロジェクトの創設パートナーである非営利団体「Electronic Frontier Foundation」にメールアドレスを共有してよいかどうかの確認メッセージが表示されます。メールアドレスを共有してよいのなら「Y」を入力して[Enter]キーを押します。
最後に「Please enter in your domain name(s) (comma and/or space separated) (Enter ‘c’ to cancel):」にホスト名を入力して[Enter]キーを押します。「- Congratulations! Your certificate and chain have been saved at:」が表示されたら、証明書の取得完了です。証明書は「/etc/letsencrypt/live/ホスト名/fullchain.pem」ファイルから、秘密鍵は「/etc/letsencrypt/live/ホスト名/privkey.pem」ファイルから参照できます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
Requesting to rerun ./certbot-auto with root privileges... Bootstrapping dependencies for Debian-based OSes... (you can skip this with --no-bootstrap) (略) 続行しますか? [Y/n] (略) Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): メールアドレス ------------------------------------------------------------------------------- Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v01.api.letsencrypt.org/directory ------------------------------------------------------------------------------- (A)gree/(C)ancel: A ------------------------------------------------------------------------------- Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about EFF and our work to encrypt the web, protect its users and defend digital rights. ------------------------------------------------------------------------------- (Y)es/(N)o: Y Please enter in your domain name(s) (comma and/or space separated) (Enter 'c' to cancel): ホスト名 Obtaining a new certificate Performing the following challenges: http-01 challenge for ホスト名 Waiting for verification... Cleaning up challenges IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/ホスト名/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/ホスト名/privkey.pem Your cert will expire on 2018-XX-XX. To obtain a new or tweaked version of this certificate in the future, simply run certbot-auto again. To non-interactively renew *all* of your certificates, run "certbot-auto renew" - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le |