AR ホームベーカリー

オイラのアウトプット用ホームベーカリー!

AmazonLinux2023 で Passenger をインストール時に cURL がコケる

このようにError: Cannot find thecurl-configcommand. なるのを解決する。

Checking for required software...

 * Checking for C compiler...
      Found: yes
      Location: /usr/bin/cc
 * Checking for C++ compiler...
      Found: yes
      Location: /usr/bin/c++
 * Checking for Curl development headers with SSL support...
      Found: no
      Error: Cannot find the `curl-config` command.
 * Checking for Zlib development headers...
      Found: yes
      Location: /usr/include/zlib.h
 * Checking for Apache 2...
      Found: yes
      Location of httpd: /usr/sbin/httpd
      Apache version: 2.4.62
 * Checking for Rake (associated with /home/ec2-user/.anyenv/envs/rbenv/versions/2.7.5/bin/ruby)...
      Found: yes
      Location: /home/ec2-user/.anyenv/envs/rbenv/versions/2.7.5/bin/ruby /home/ec2-user/.anyenv/envs/rbenv/versions/2.7.5/bin/rake
 * Checking for OpenSSL support for Ruby...
      Found: yes
 * Checking for RubyGems...
      Found: yes
 * Checking for Ruby development headers...
      Found: yes
      Location: /home/ec2-user/.anyenv/envs/rbenv/versions/2.7.5/include/ruby-2.7.0/ruby.h
 * Checking for rack...
      Found: yes
 * Checking for OpenSSL development headers...
      Found: yes
      Location: /usr/include/openssl/ssl.h
 * Checking for Apache 2 development headers...
      Found: yes
      Location of apxs2: /usr/bin/apxs
 * Checking for Apache Portable Runtime (APR) development headers...
      Found: yes
      Location: /usr/bin/apr-1-config
      Version: 1.7.2
 * Checking for Apache Portable Runtime Utility (APU) development headers...
      Found: yes
      Location: /usr/bin/apu-1-config
      Version: 1.6.3

まずなんで発生するのか

libcurl-minimal とかいうパッケージになっているため。

[ec2-user@localhost ~]$ dnf list curl* libcurl*
Last metadata expiration check: 20:42:45 ago on Mon Dec  2 02:44:46 2024.
Installed Packages
curl-minimal.x86_64                                                       8.5.0-1.amzn2023.0.4                                                    @System
libcurl-minimal.x86_64                                                    8.5.0-1.amzn2023.0.4                                                    @System
Available Packages
curl.x86_64                                                               8.5.0-1.amzn2023.0.4                                                    amazonlinux
libcurl.x86_64                                                            8.5.0-1.amzn2023.0.4                                                    amazonlinux
libcurl-devel.x86_64                                                      8.5.0-1.amzn2023.0.4                                                    amazonlinux

minimal is なに

AWS が言うには以下の様子。

これにより、ほとんどのユーザーのディスク、メモリ、依存関係のフットプリントが削減され、AL2023 AMI とコンテナのデフォルトパッケージとなっています。

https://docs.aws.amazon.com/ja_jp/linux/al2023/ug/curl-minimal.html

ちなみに雑に dnf で上書きしようとすると conflict して止まる。

[ec2-user@localhost ~]$ sudo dnf install curl*
Last metadata expiration check: 20:35:00 ago on Mon Dec  2 02:46:46 2024.
Package curl-minimal-8.5.0-1.amzn2023.0.4.x86_64 is already installed.
Error:
 Problem: problem with installed package curl-minimal-8.5.0-1.amzn2023.0.4.x86_64

...

[ec2-user@localhost ~]$ sudo dnf install libcurl*
Last metadata expiration check: 20:36:59 ago on Mon Dec  2 02:46:46 2024.
Package libcurl-minimal-8.5.0-1.amzn2023.0.4.x86_64 is already installed.
Error:
 Problem: conflicting requests

すごい気になるんだけど「ほとんどのユーザー」ってどこまでの範囲なんだろう。

解決方法

引用の上記 URL 記載手順で、従来のフル機能版に切り替えられるらしい。 試してみる。

ちなみに dnf swap コマンドは、引数1つ目のリポジトリから2つ目のリポジトリに切り替えるコマンドらしい。 初めて知った……!

libcurl
[ec2-user@localhost ~]$ sudo dnf swap libcurl-minimal libcurl-full
Last metadata expiration check: 20:43:40 ago on Mon Dec  2 02:46:46 2024.
Dependencies resolved.
=============================================================================================================================================================
 Package                                Architecture                  Version                                       Repository                          Size
=============================================================================================================================================================
Installing:
 libcurl                                x86_64                        8.5.0-1.amzn2023.0.4                          amazonlinux                        346 k
Installing dependencies:
 libssh                                 x86_64                        0.10.6-1.amzn2023.0.1                         amazonlinux                        217 k
 libssh-config                          noarch                        0.10.6-1.amzn2023.0.1                         amazonlinux                         11 k
Removing:
 libcurl-minimal                        x86_64                        8.5.0-1.amzn2023.0.4                          @System                            611 k

Transaction Summary
=============================================================================================================================================================
Install  3 Packages
Remove   1 Package

Total download size: 574 k
Is this ok [y/N]: y
Downloading Packages:
(1/3): libssh-config-0.10.6-1.amzn2023.0.1.noarch.rpm                                                                        123 kB/s |  11 kB     00:00
(2/3): libssh-0.10.6-1.amzn2023.0.1.x86_64.rpm                                                                               1.5 MB/s | 217 kB     00:00
(3/3): libcurl-8.5.0-1.amzn2023.0.4.x86_64.rpm                                                                               2.1 MB/s | 346 kB     00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                        2.0 MB/s | 574 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                     1/1
  Installing       : libssh-config-0.10.6-1.amzn2023.0.1.noarch                                                                                          1/4
  Installing       : libssh-0.10.6-1.amzn2023.0.1.x86_64                                                                                                 2/4
  Installing       : libcurl-8.5.0-1.amzn2023.0.4.x86_64                                                                                                 3/4
  Erasing          : libcurl-minimal-8.5.0-1.amzn2023.0.4.x86_64                                                                                         4/4
  Running scriptlet: libcurl-minimal-8.5.0-1.amzn2023.0.4.x86_64                                                                                         4/4
  Verifying        : libcurl-8.5.0-1.amzn2023.0.4.x86_64                                                                                                 1/4
  Verifying        : libssh-0.10.6-1.amzn2023.0.1.x86_64                                                                                                 2/4
  Verifying        : libssh-config-0.10.6-1.amzn2023.0.1.noarch                                                                                          3/4
  Verifying        : libcurl-minimal-8.5.0-1.amzn2023.0.4.x86_64                                                                                         4/4

Installed:
  libcurl-8.5.0-1.amzn2023.0.4.x86_64              libssh-0.10.6-1.amzn2023.0.1.x86_64              libssh-config-0.10.6-1.amzn2023.0.1.noarch
Removed:
  libcurl-minimal-8.5.0-1.amzn2023.0.4.x86_64

Complete!
curl
[ec2-user@localhost ~]$ sudo dnf swap curl-minimal curl-full
Last metadata expiration check: 20:45:00 ago on Mon Dec  2 02:46:46 2024.
Dependencies resolved.
=============================================================================================================================================================
 Package                              Architecture                   Version                                       Repository                           Size
=============================================================================================================================================================
Installing:
 curl                                 x86_64                         8.5.0-1.amzn2023.0.4                          amazonlinux                         373 k
Removing:
 curl-minimal                         x86_64                         8.5.0-1.amzn2023.0.4                          @System                             284 k

Transaction Summary
=============================================================================================================================================================
Install  1 Package
Remove   1 Package

Total download size: 373 k
Is this ok [y/N]: y
Downloading Packages:
curl-8.5.0-1.amzn2023.0.4.x86_64.rpm                                                                                         3.2 MB/s | 373 kB     00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                        2.0 MB/s | 373 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                     1/1
  Installing       : curl-8.5.0-1.amzn2023.0.4.x86_64                                                                                                    1/2
  Erasing          : curl-minimal-8.5.0-1.amzn2023.0.4.x86_64                                                                                            2/2
  Running scriptlet: curl-minimal-8.5.0-1.amzn2023.0.4.x86_64                                                                                            2/2
  Verifying        : curl-8.5.0-1.amzn2023.0.4.x86_64                                                                                                    1/2
  Verifying        : curl-minimal-8.5.0-1.amzn2023.0.4.x86_64                                                                                            2/2

Installed:
  curl-8.5.0-1.amzn2023.0.4.x86_64
Removed:
  curl-minimal-8.5.0-1.amzn2023.0.4.x86_64

Complete!

まだダメ

ダメだった。

 * Checking for Curl development headers with SSL support...
      Found: no
      Error: Cannot find the `curl-config` command.

なんでかなー、と悩んでいたけど、どうもこれ libcurl-devel が必要なんじゃないか、という疑惑が出てきた。 のでインストールしてみる。

[ec2-user@localhost ~]$ sudo dnf install libcurl-devel.x86_64
Last metadata expiration check: 20:54:29 ago on Mon Dec  2 02:46:46 2024.
Dependencies resolved.
=============================================================================================================================================================
 Package                               Architecture                   Version                                      Repository                           Size
=============================================================================================================================================================
Installing:
 libcurl-devel                         x86_64                         8.5.0-1.amzn2023.0.4                         amazonlinux                         927 k

Transaction Summary
=============================================================================================================================================================
Install  1 Package

Total download size: 927 k
Installed size: 1.4 M
Is this ok [y/N]: y
Downloading Packages:
libcurl-devel-8.5.0-1.amzn2023.0.4.x86_64.rpm                                                                                8.4 MB/s | 927 kB     00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                        5.3 MB/s | 927 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                     1/1
  Installing       : libcurl-devel-8.5.0-1.amzn2023.0.4.x86_64                                                                                           1/1
  Running scriptlet: libcurl-devel-8.5.0-1.amzn2023.0.4.x86_64                                                                                           1/1
  Verifying        : libcurl-devel-8.5.0-1.amzn2023.0.4.x86_64                                                                                           1/1

Installed:
  libcurl-devel-8.5.0-1.amzn2023.0.4.x86_64

Complete!

無事できたっぽい。 passenger-install-apache2-module もこの通りだった。

 * Checking for Curl development headers with SSL support...
      Found: yes
      curl-config location: /usr/bin/curl-config
      Header location: /usr/include/curl/curl.h
      Version: libcurl 8.5.0
      Usable: yes
      Supports SSL: yes

...

Checking whether there are multiple Apache installations...
Only a single installation detected. This is good.

とのことだ。 あとは CPU ぶん回してインストールする。 いやーよかったよかった。