💬

UbuntuにHTTP/3対応のCurlをインストール

2024/10/19に公開

様々なサイトを参考にしてHTTP3対応のCurlのインストールにトライしましたが、エラーが起こり失敗が続きました。
Brewを使用すると成功しましたので、その手順を記載します。

Ubuntu24

UbuntuにBrewをインストール

sudo apt install build-essential procps curl file git
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

表示されたパスを設定 (xxxxxは表示された内容に変更して下さい)

echo >> /home/xxxxx/.bashrc
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/xxxxx/.bashrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

開発ツールをインストール

sudo apt-get install build-essential
brew install gcc
brew install rustup-init

HTTP/3対応のCurlをインストール

brew tap cloudflare/homebrew-cloudflare
brew unlink curl
brew install cloudflare/cloudflare/curl

バージョンを確認

$ curl --version
curl 8.9.1 (x86_64-pc-linux-gnu) libcurl/8.9.1 BoringSSL zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libssh2/1.11.1 nghttp2/1.63.0 quiche/0.22.0 librtmp/2.3 OpenLDAP/2.6.8
Release-Date: 2024-07-31
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM SPNEGO SSL threadsafe UnixSockets zstd

動作確認

curl --http3 -v https://www.google.com
* Host www.google.com:443 was resolved.
* IPv6: 2404:6800:4004:825::2004
* IPv4: 142.250.207.36
*   Trying 142.250.207.36:443...
* Server certificate:
*  subject: CN=*.google.com
*  start date: Sep 30 14:36:26 2024 GMT
*  expire date: Dec 23 14:36:25 2024 GMT
*  subjectAltName: host "www.google.com" matched cert's "*.google.com"
*  issuer: C=US; O=Google Trust Services; CN=WR2
*  SSL certificate verify ok.
* Connected to www.google.com (142.250.207.36) port 443
* using HTTP/3
* [HTTP/3] [0] OPENED stream for https://www.google.com/
* [HTTP/3] [0] [:method: GET]
* [HTTP/3] [0] [:scheme: https]
* [HTTP/3] [0] [:authority: www.google.com]
* [HTTP/3] [0] [:path: /]
* [HTTP/3] [0] [user-agent: curl/8.9.1]
* [HTTP/3] [0] [accept: */*]
> GET / HTTP/3
> Host: www.google.com
> User-Agent: curl/8.9.1
> Accept: */*
>
* Request completely sent off
< HTTP/3 200

Discussion