短時間で学ぶサーバ設定術 Technology

Entries tagged [certbot]

How to Install Certbot from Sources Using Python PIP

by e-Manabix


Posted on 2024年5月27日 (月) in Technology


先に、certbot 2.10.0のインストール記事を書きましたが、アプリケーションを更新する段階で、ファイルの依存関係が崩れたようで、使えなくなりました。

このため、Certbotのソースファイルから、Python PIPを使用して、インストールする方法を採用することにしました。

この方法でインストールしたcertbotでも、Let's EncryptによるWeb認証ができますので、お試しください。

なお、前回同様に、無保証ですので、自己責任でお試しください。

 #How to Install Certbot from Sources Using Python Pip for Let's Encrypt on AlmaLinux 9

(1) OS
cat /etc/redhat-release 
Almalinux release 9.4

(2) Pip Install
which pip
dnf -y install pip
##  python3-pip-21.2.3-8.el9.noarch
##完了しました!

(3) Certbot Download
https://sourceforge.net/projects/certbot.mirror/files/v2.10.0/

wget https://sourceforge.net/projects/certbot.mirror/files/v2.10.0/certbot-2.10.0.tar.gz

ls -al certbot*
-rw-r--r--  1 root  root 437757  4月  4 07:16 certbot-2.10.0.tar.gz

gunzip certbot-2.10.0.tar.gz

tar xvf certbot-2.10.0.tar

tree certbot-2.10.0

certbot-2.10.0
├── changelog.md
├── license.txt
├── manifest.in
├── pkg-info
├── readme.rst
├── certbot
│   ├── __init__.py
│   ├── interfaces.py
│   ├── main.py
│   ├── ocsp.py
│   └── util.py
├── setup.cfg
└── setup.py

(4) Certbot Install
pip install ./certbot-2.10.0

##Using legacy 'setup.py install' for certbot, since package 'wheel' is not installed.
##Installing collected packages: pycparser, cffi, cryptography, urllib3, pytz, PyOpenSSL, idna, charset-normalizer, certifi, zipp, requests, pyrfc3339, josepy, parsedatetime, importlib-metadata, configobj, ConfigArgParse, acme, certbot
##    Running setup.py install for certbot ... done
##Successfully installed ConfigArgParse-1.7 PyOpenSSL-24.1.0 acme-2.10.0 certbot-2.10.0 certifi-2024.2.2 cffi-1.16.0 charset-normalizer-3.3.2 configobj-5.0.8 cryptography-42.0.7 idna-3.7 importlib-metadata-7.1.0 josepy-1.14.0 parsedatetime-2.6 pycparser-2.22 pyrfc3339-1.1 pytz-2024.1 requests-2.32.2 urllib3-2.2.1 zipp-3.19.0

which certbot
/usr/local/bin/certbot

/usr/local/bin/certbot --version
certbot 2.10.0


How to Install Certbot for Let's Encrypt on AlmaLinux 9

by e-Manabix


Posted on 2024年4月24日 (水) in OS


CentOS 7のサポート期限が迫ってきたので、新しくAlmaLinux 9.3に移行しようとして、遭遇したトラブル対策のメモです。

一般に、yum updateは、日々実行するコマンドで、非常に、優先度の高いコマンドです。

このため、OSインストール直後に、このコマンドを実行してしまい、パッケージ間の依存関係に問題が生じたようで、certbotがインストールできないという問題に遭遇しました。

結論から言いますと、snapとcertbotをインストールした後で、yum updateコマンドを実行しないと、certbotがインストールできないと言う事です。
このため、メールとWebのためのcertbotのインストールは、ユーザとfirewallの設定に次いで、優先度の高い処理となります。

以下が、実行例で、dnfは、yumの新しいコマンドです。
なお、コピーして、shellスクリプトとして使えるように、実行結果の先頭には、##を付けています。

ただし、内容は、無保証ですので、自己責任で実施ください。
また、問い合わせにも、対応していません。

#How to Install Certbot by Using Snap for Let's Encrypt on AlmaLinux 9.3

cat /etc/redhat-release
##AlmaLinux release 9.3

echo "1. install epel-relese"
dnf -y install epel-release

dnf repolist
##repo id               repo name
##appstream             AlmaLinux 9 - AppStream
##baseos                AlmaLinux 9 - BaseOS
##epel                  Extra Packages for Enterprise Linux 9 - x86_64
##extras                AlmaLinux 9 - Extras

dnf search all snapd
##Extra Packages for Enterprise Linux 9 - x86_64  699 kB/s |  21 MB     00:30    
##========================== Name & URL Matched: snapd ===========================
##snapd.x86_64 : A transactional software package manager
##:省略

echo "2. install snapd"
dnf -y install snapd
##Installing:
## snapd                          x86_64   2.61.2-0.el9         epel         16 M
##:省略
##Complete!

which snap
##/usr/bin/snap

snap version
##snap    2.61.2-0.el9
##snapd   unavailable
##series  -

echo "3. enable snaps.socket"
systemctl enable --now snapd.socket
##Created symlink /etc/systemd/system/sockets.target.wants/snapd.socket → /usr/lib/systemd/system/snapd.socket.

systemctl status snapd.socket
##● snapd.socket - Socket activation for snappy daemon
##     Loaded: loaded (/usr/lib/systemd/system/snapd.socket; enabled; preset: dis>

snap version
##snap       2.61.2-0.el9
##snapd      2.61.2-0.el9
##series     16

echo "4. symbolic link"
ln -s /var/lib/snapd/snap /snap

echo "5. install certbot"
snap install --classic certbot
##certbot 2.10.0 from Certbot Project (certbot-eff✓) installed

ls -al /snap/bin/certbot
##lrwxrwxrwx 1 root root 13 Apr 23 14:14 /snap/bin/certbot -> /usr/bin/snap

which certbot
##/var/lib/snapd/snap/bin/certbot

certbot --version
##certbot 2.10.0

echo "6. yum update"
dnf -y upgrade

#def -y install <packages>

dnf -y upgrade
##Killed

#if you have any trouble such as above, remove repositories of epel and epel-cisco-openh264.

echo "7. remove peel-release"
dnf -y remove epel-release
##Removed:
##  epel-release-9-7.el9.noarch
##Complete!

dnf repolist
##repo id                            repo name
##appstream                          AlmaLinux 9 - AppStream
##baseos                             AlmaLinux 9 - BaseOS
##extras                             AlmaLinux 9 - Extras

echo "8. disable snaps.socket"
systemctl disable snapd.socket