Let’s Encryptの更新に失敗する

# /usr/local/certbot/certbot-auto renew --post-hook "service httpd restart" 1 > /dev/null 2 > /dev/null

を実行すると以下のようなエラーが出ました。どうやらPythonのバージョンが良くないようです。

/root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6
  DeprecationWarning
usage: 
  certbot-auto [SUBCOMMAND] [options] [-d DOMAIN] [-d DOMAIN] ...

Certbot can obtain and install HTTPS/TLS/SSL certificates.  By default,
it will attempt to use a webserver both for obtaining and installing the
certificate. 
certbot: error: unrecognized arguments: 1 2
# python -V
Python 2.6.6

以下の手順でPython2.7を使えるようにします。

# yum install centos-release-scl
# yum install python27 python27-python-tools
# sudo scl enable python27 bash
# python -V
Python 2.7.13

2.6の方を見てしまうため、以下を削除します。

rm -Rf /root/.local/share/letsencrypt
usage: 
  certbot-auto [SUBCOMMAND] [options] [-d DOMAIN] [-d DOMAIN] ...

Certbot can obtain and install HTTPS/TLS/SSL certificates.  By default,
it will attempt to use a webserver both for obtaining and installing the
certificate. 
certbot: error: unrecognized arguments: 1 2

のエラーが出たため、よくわからない引数を消します。

# /usr/local/certbot/certbot-auto renew --post-hook "service httpd restart"

参考

https://letsencrypt.jp/usage/centos6-error.html#Error2

https://community.letsencrypt.org/t/redhat-centos-6-x-users-need-python-2-7/2190/6

http://knowledge.sakura.ad.jp/knowledge/5573/