18

It seems like curl packed with ubuntu 16.04 does not have http2 support. How do I enable http2 in curl

1 Answer 1

46

As of now (Jan 2018). You will have to install curl from source to get http2 support. You can do that using the following commands

sudo apt-get -y install build-essential nghttp2 libnghttp2-dev libssl-dev
wget https://curl.haxx.se/download/curl-7.63.0.tar.gz
tar xzf curl-7.63.0.tar.gz
cd curl-7.63.0
./configure --with-nghttp2 --prefix=/usr/local --with-ssl
make && sudo make install
sudo ldconfig
12
  • @user535733 Can you please explain why ?
    – Tachyons
    Feb 19, 2017 at 15:08
  • 2
    @user535733 . Thanks, this will install curl inside /usr/local So it won't collide with the default installation. You can even use them side by side.
    – Tachyons
    Feb 20, 2017 at 16:01
  • 2
    If it's still not working, then you may need to restart shell or clear your hash if you've used /usr/bin/curl lately. askubuntu.com/q/923527/453746 Jun 8, 2017 at 22:05
  • 3
    Most likely you'll want to compile with ssl support as well. Then install sudo apt-get install libssl-dev first and add run configure command this way: ./configure --with-nghttp2 --prefix=/usr/local --with-ssl=/usr/local/ssl
    – Stalinko
    Aug 28, 2017 at 9:19
  • 2
    @Tachyons in my case it wasn't. I think it depends on env settings. When you don't pass this parameter deliberately then configure reads it from env variables OPENSSL_CFLAGS and OPENSSL_LIBS
    – Stalinko
    Aug 28, 2017 at 17:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .