Certbot クライアントをインストールします。参考:Certbot Instructions
まず、snapd をインストールし、自動起動有効+起動。
:~# dnf --enablerepo=epel install snapd :~# systemctl enable --now snapd.socket
シンボリックリンクを作成。
:~# ln -s /var/lib/snapd/snap /snap
snap のパスが正しく更新されるようにするには、一度ログアウトして再度ログインするか、システムを再起動してください。
certbot をインストール。
:~# snap install --classic certbot
下記エラーが出たら、数分待ってから再度実行する。
error: too early for operation, device not yet seeded or device model not acknowledged
シンボリックリンクを作成。
:~# ln -s /snap/bin/certbot /usr/local/bin/certbot
証明書取得。(80番ポートが外部からアクセス可能であること)
:~# certbot certonly --webroot \ -w /var/www/html \ -m you@example.com \ --agree-tos \ -d xxxxx.xvps.jp
・・・ ・・・ Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/xxxxx.xvps.jp/fullchain.pem Key is saved at: /etc/letsencrypt/live/xxxxx.xvps.jp/privkey.pem This certificate expires on 2026-07-14. These files will be updated when the certificate renews. Certbot has set up a scheduled task to automatically renew this certificate in the background. ・・・ ・・・
mod_ssl インストール。
:~# dnf -y install mod_ssl
SSL 設定ファイル編集。
:~# vi /etc/httpd/conf.d/ssl.conf
変更と追加。
# Use separate log files for the SSL virtual host; note that LogLevel # is not inherited from httpd.conf. ErrorLog logs/ssl_error_log ↓↓↓ ErrorLog logs/error_log TransferLog logs/ssl_access_log ↓↓↓ CustomLog logs/access_log combined env=!no_log LogLevel warn ・・・ ・・・ #SSLProtocol all -SSLv3 #SSLProxyProtocol all -SSLv3 SSLProtocol TLSv1.2 TLSv1.3 SSLProxyProtocol TLSv1.2 TLSv1.3 ・・・ ・・・ SSLHonorCipherOrder on ・・・ ・・・ SSLCipherSuite PROFILE=SYSTEM ↓↓↓ SSLCipherSuite HIGH:!aNULL:!MD5:!3DES:!CAMELLIA:!AESCCM:!ECDSA ・・・ ・・・ SSLCertificateFile /etc/pki/tls/certs/localhost.crt ↓↓↓ SSLCertificateFile /etc/letsencrypt/live/xxxxx.xvps.jp/fullchain.pem ・・・ ・・・ SSLCertificateKeyFile /etc/pki/tls/private/localhost.key ↓↓↓ SSLCertificateKeyFile /etc/letsencrypt/live/xxxxx.xvps.jp/privkey.pem ・・・ ・・・ Header always set Strict-Transport-Security "max-age=15768000" </VirtualHost>
Apache 設定反映。
:~# systemctl reload httpd
ポート開放。
:~# firewall-cmd --add-service=https --zone=public --permanent :~# firewall-cmd --reload
自動更新をテストする。
:~# certbot renew --dry-run