1. 概要
2023年12月21日に、本記事を書いております。
「FreeBSD 14.0 RELEASE」「python311」の環境を新しく作成しまして、「certbot」を使おうと思いまして、インストールしてみます。
2. インストール
「pkg」を見てみます。
$ pkg search certbot
py39-certbot-2.6.0,1 Let's Encrypt client
py39-certbot-apache-2.6.0 Apache plugin for Certbot
py39-certbot-dns-cloudflare-2.6.0 Cloudflare DNS plugin for Certbot
・・・略・・・
「pkg」上では、py39-certbot」しかないことになっている。
「puthon」を見てみると。
$ ls /usr/local/bin/py*
/usr/local/bin/pybabel /usr/local/bin/pygmentize /usr/local/bin/python3.11
/usr/local/bin/pybabel-3.11 /usr/local/bin/pygmentize-3.11 /usr/local/bin/python3.11-config
/usr/local/bin/pydoc3.11 /usr/local/bin/pyproject-build /usr/local/bin/python3.9
/usr/local/bin/pydoc3.9 /usr/local/bin/pyproject-build-3.11 /usr/local/bin/python3.9-config
てなことになっている。
/etc/make.conf
には
DEFAULT_VERSIONS+=python=3.11 python3=3.11
と書いてるんだけどな。
「py39-certbot」と同じようなことになるのかしら。
やってみます。
あらかじめ、下記のものをインストールします。
/usr/ports/security/py-acme
/usr/ports/security/py-josepy
/usr/ports/sysutils/py-distro
/usr/ports/textproc/py-charset-normalizer
/usr/ports/www/py-requests
上記、アルファベット順に記述しちゃいましたが、依存関係があるので、順番を変える必要があるかもしれません。
各々
cd ディレクトリ
make deinstall clean
make
make install
していくのですが、「make」「make install」時に、依存関係とは別に、「conflict」が発生して、エラーになることがあります。
これは、「make deinstall clean」では、削除されない「pkg」が存在するためで、これらは
pkg delete pyxx-パッケージ名
で、削除していくしかありません。
最終的に。
cd /usr/ports/security/py-certbot
make
make install
で、インストールまで行きます。
インストール時のメッセージを残しておきます。
===> Installing for py311-certbot-2.7.4,1
===> Checking if py311-certbot is already installed
===> Registering installation for py311-certbot-2.7.4,1
Installing py311-certbot-2.7.4,1...
This port installs the "standalone" client only, which does not use and
is not the certbot-auto bootstrap/wrapper script.
The simplest form of usage to obtain certificates is:
# sudo certbot certonly --standalone -d <domain>, [domain2, ... domainN]>
NOTE:
The client requires the ability to bind on TCP port 80 or 443 (depending
on the --preferred-challenges option used). If a server is running on that
port, it will need to be temporarily stopped so that the standalone server
can listen on that port to complete the challenge authentication process.
For more information on the 'standalone' mode, see:
https://certbot.eff.org/docs/using.html#standalone
The certbot plugins to support apache and nginx certificate installation
will be made available in the following ports:
* Apache plugin: security/py-certbot-apache
* Nginx plugin: security/py-certbot-nginx
In order to automatically renew the certificates, add this line to
/etc/periodic.conf:
weekly_certbot_enable="YES"
More config details in the certbot periodic script:
/usr/local/etc/periodic/weekly/500.certbot-3.11
どうやら、「py311-certbot」になっているようで安心しました。
ウィークリーに、実行するスクリプトファイルがあって。
/etc/periodic.conf
を上記のようにいじればよろしいと書いてありますが。
わたしの場合、バーチャルホストも同時に動作させているので、オリジナルのままではあかんのです。
なので、もともと書いてあるスクリプトで動作させます。
そのスクリプトを動作させるには、上記のメッセージに書いてあるように「py-certbot-apache」をいれなければなりません。
cd /usr/ports/security/py-certbot-apache
make deinstall clean
make
make install