Install Curl with HTTP2 support on Ubuntu

Published: 2019-09-26 07:36:40 +0000
Categories: BASH,




Although the version of curl in the Ubuntu repos is sufficiently recent to support HTTP/2, Ubuntu have compiled the packages without nghttp2 support, so if you try and use --http2 you'll probably receive the output curl: (1) Unsupported protocol

This snippet details how to install deps, and then compile curl with http/2 support - it can then be installed alongside, or over the top of the existing curl (alongside is better IMO).


sudo apt-get nghttp2 libnghttp2-dev libssl-dev
tar xzf curl-7.66.0.tar.gz
cd curl-7.66.0/
./configure --with-nghttp2 --with-ssl

# If you want to install alongside, and only for you
echo "alias curl-h2=\"$PWD/src/curl --http2 --http2-prior-knowledge\"" >> ~/.bashrc

# Or, alongside but for everyone
echo "alias curl-h2=\"$PWD/src/curl --http2 --http2-prior-knowledge\"" | sudo tee -a /etc/profile

# Or to install over the top 
# (will install as curl and you will need to specify --http2 --http2-prior-knowledge )
sudo make install

Usage Example

# Assuming an alias was created
curl-h2 "" -v -o/dev/null

# If not, then
curl --http2 --http2-prior-knowledge "" -v -o/dev/null


curl, http2, http/2, compile, install, ubuntu, http, cli,

Latest Posts

Copyright © 2021 Ben Tasker | Sitemap | Privacy Policy
Available at and http://phecoopwm6x7azx26ctuqcp6673bbqkrqfeoiz2wwk36sady5tqbdpqd.onion