Apacheを番外の最新バージョンにしてみた

ubuntu server 22.04 LTSのデフォルトのapache2のバージョンは2.4.52で固定されているらしい。
リリース日を見ると2021年12月と少しだけ古いバージョンとなっている。
安定して動くものを採用しているのでしょう。

OSApacheリリース日
Ubuntu 18.04 LTS2.4.292017/10/23
Ubuntu 20.04 LTS2.4.412019/08/14
Ubuntu 22.04 LTS2.4.522021/12/20

新しいものが大好きな者としてはどうにかして最新バージョンを導入できないか調べてみた。

この記事を書いている2022年7月27日時点の最新バージョンはどうやら2022年6月8日にリリースされた2.4.54らしいことはわかった。

しかし上述のとおりUbuntu 22.04 LTSのApacheは2.4.52で固定されているため、公式リポジトリに2.4.52より新しいバージョンが登録されない限り通常のアップデート作業は無効だ。

そこでPPAの登場。
個人が管理しているリポジトリで非公式アップデートになりますがうまく動作してくれれば文句はありません。
これが原因で致命的なトラブルになることはまず無いでしょう。トラブったらその時はその時です。(笑)

それでは早速PPAの導入をば(非公式リポジトリの登録)

sudo add-apt-repository ppa:ondrej/apache2

PPAが導入できたらインストールできる最新バージョンを確認してみます。

$ sudo apt show apache2
Package: apache2
Version: 2.4.54-1+ubuntu22.04.1+deb.sury.org+1
Priority: optional
Section: httpd
Maintainer: Debian Apache Maintainers <debian-apache@lists.debian.org>
Installed-Size: 523 kB
Provides: httpd, httpd-cgi
Depends: apache2-bin (= 2.4.54-1+ubuntu22.04.1+deb.sury.org+1), apache2-data (= 2.4.54-1+ubuntu22.04.1+deb.sury.org+1), apache2-utils (= 2.4.54-1+ubuntu22.04.1+deb.sury.org+1), lsb-base, mime-support, perl:any, procps
Recommends: ssl-cert
Suggests: apache2-doc, apache2-suexec-pristine | apache2-suexec-custom, www-browser
Download-Size: 165 kB
APT-Manual-Installed: yes
APT-Sources: https://ppa.launchpadcontent.net/ondrej/apache2/ubuntu jammy/main amd64 Packages
Description: Apache HTTP サーバ

最新バージョンとして2.4.54表示されたので後はいつものアップデートとインストールコマンドを叩きます

sudo apt update
sudo apt install apache2 -y

ほどなくしてインストールが完了、あとは新しいバージョンがうまく稼働しているか確認

$ sudo service apache2 status
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-07-27 12:07:10 JST; 49min ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 34669 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 34675 (apache2)
      Tasks: 11 (limit: 37630)
     Memory: 231.9M
        CPU: 18.237s
     CGroup: /system.slice/apache2.service
             ├─34675 /usr/sbin/apache2 -k start
             ├─34823 /usr/sbin/apache2 -k start
             ├─34824 /usr/sbin/apache2 -k start
             ├─34825 /usr/sbin/apache2 -k start
             ├─34827 /usr/sbin/apache2 -k start
             ├─35104 /usr/sbin/apache2 -k start
             ├─35111 /usr/sbin/apache2 -k start
             ├─35112 /usr/sbin/apache2 -k start
             ├─35201 /usr/sbin/apache2 -k start
             ├─35217 /usr/sbin/apache2 -k start
             └─35218 /usr/sbin/apache2 -k start
 7月 27 12:07:10 ubuntu systemd[1]: Starting The Apache HTTP Server...
 7月 27 12:07:10 ubuntu systemd[1]: Started The Apache HTTP Server.

バージョンの確認は以下で

$ apache2ctl -v
Server version: Apache/2.4.54 (Ubuntu)
Server built:   2022-06-08T15:59:33

PPAベースの最新バージョンにアップデートした直後SSL接続が出来なくないという不具合が発生。
これは結構簡単に解決できた。
/etc/apache2/sites-available下にあるdefault-ssl.confが新しいバージョンインストール時に新しいファイルに置き換えられているのが原因。バージョンアップ前のファイルが同じディレクトリに拡張子を変えた形で保存されているのでdefault-ssl.confにリネームしapache2を再起動してやるだけでOK。
リネームしなくてもdefault-ssl.confにSSL証明書の正しいパスを記述してやってもOK。

sudo apt show -a apache2でズラズラっと表示される情報の中に設定ファイル、スクリプトなど含めたフルインストールになるってちゃんと書いてありましたわ。面倒がらずにちゃんと読まないといけませんね。

$ sudo apt show -a apache2
〜中略〜
Installing this package results in a full installation, including the
configuration files, init scripts and support scripts.
〜以下略〜

最後にちょっとしたハプニングがありましたが今のところ問題なく動いてくれています。

この記事がお気に召しましたらシェア・いいねを!!

コメントする

メールアドレスが公開されることはありません。 が付いている欄は必須項目です