はじめに
本来はOSアップグレードすべきな CentOS 6 で必要に迫られて、certbotを動作させたときのメモ。
certbot導入していた方法
もうこの方法は使えませんし、cartbot-auto自体も全てのシステムで非推奨。
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
./certbot-auto
certbot-auto のエラー
sudo certbot-auto renew --dry-run
Bootstrapping dependencies for Legacy RedHat-based OSes that will use Python3... (you can skip this with --no-bootstrap)
yum is /usr/bin/yum
To use Certbot on this operating system, packages from the SCL repository need to be installed.
Enable the SCL repository and try running Certbot again.
Pythonのバージョンが3.6以上が必要らしい。
yum
リポジトリをvaultを使うように変更
cd /etc/yum.repos.d/
sudo cp CentOS-Base.repo??CentOS-Base.repo.baksudo sed -i -e "s/^mirrorlist=http:\/\/mirrorlist.centos.org/#mirrorlist=http:////mirrorlist.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo
sudo sed -i -e "s/^#baseurl=http:\/\/mirror.centos.org/baseurl=http:////vault.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo
python3.6
iusポジトリを使って、Python3.6をインストール
iusリポジトリがなくなっていたので、SCLを利用
SCLリポジトリ導入とURL修正
sudo yum install centos-release-SCL
sudo vi /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
....
[centos-sclo-rh]
name=CentOS-6 - SCLo rh
baseurl=http://vault.centos.org/centos/6/sclo/$basearch/rh/
#mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=6&repo=sclo-rh
.....
python3.6をインストール
sudo yum install -y rh-python36 rh-python36-pip
python3.6が /opt/rh/rh-python36/root/usr/bin/python3 にインストールされる。
python3設定
cd /usr/bin
sudo unlinlk python3
sudo ln -s /opt/rh/rh-python36/root/usr/bin/python3 python3
certbotのインストール
certbot用のvirtual envを作成し pipをアップデートしてからインストール
sudo python3 -m venv /opt/certbot/ # venv
sudo /opt/certbot/bin/pip install --upgrade pip
sudo /opt/certbot/bin/pip install certbot
/opt/certbot/bin/certbot にインストールされる。
動作確認
/opt/certbot/bin/certbot/certbot --version
certbot 1.13.0
あとは、certbot-autoコマンドの代わりにcertbotコマンドを使用するようにすれば、問題なくSSL証明書の更新や取得が利用可能になるはずです。
let’sencryptの設定(/etc/letsencrypt)の移動も必要ありません。