Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install Curl with HTTP2 support. (Script run on Ubuntu 16.04, 18.04 or 20.04)
#! /bin/bash
#
# Shell script for install Curl with HTTP2 support. Script run on Ubuntu 16.04, 18.04 or 20.04
#
# Notes:
# - Ubuntu environment is assumed
# - I did run shell script on Ubuntu 18.04
#
# Gratitude:
# - https://gist.github.com/tlacroix
#
# Update version to latest, found here: https://curl.se/download/
VERSION=7.76.1
cd ~
sudo apt-get update -y
sudo apt-get install -y build-essential nghttp2 libnghttp2-dev libssl-dev wget
wget https://curl.haxx.se/download/curl-${VERSION}.tar.gz
tar -xzvf curl-${VERSION}.tar.gz && rm -f curl-${VERSION}.tar.gz && cd curl-${VERSION}
./configure --prefix=/usr/local --with-ssl --with-nghttp2
make -j4
sudo make install
sudo ldconfig
cd ~ && rm -rf curl-${VERSION}
@basiljohntme
Copy link

basiljohntme commented Nov 18, 2019

Thanks, it works

@dutchwebs
Copy link

dutchwebs commented Mar 20, 2020

Works like a charm, thanks for documenting!

@Farzadyz
Copy link

Farzadyz commented Sep 17, 2020

Hi
How i can install it on centos 7?

@jjpeleato
Copy link
Author

jjpeleato commented Sep 17, 2020

Hi
How i can install it on centos 7?

Sorry, I don't use centos 7, I don't know, you can search the Centos community forum: https://forums.centos.org/

Good luck!

@imperyal
Copy link

imperyal commented Nov 3, 2020

It worked on Ubunto 16.04.6 LTS too, perfect.

@foxhoundsk
Copy link

foxhoundsk commented Nov 12, 2020

Nice one, thanks!

BTW, is package nghttp2 necessary? I think installing its related library is enough.

@talwarabhimanyu
Copy link

talwarabhimanyu commented Apr 3, 2021

Perfect, thank you so much! Works on Ubuntu 20.04.1 LTS

I had a curl version installed already, and so I pointed to the new one in /usr/local/bin to run it.

@tlacroix
Copy link

tlacroix commented Apr 23, 2021

Thanks for your script, works like a charm. I modified it a bit to be able to specify a version once for this project: https://github.com/gepo/apns-http2

My modified version below:

#!/bin/bash

# Update version below to latest, found here: https://curl.se/download/
VERSION=7.76.1

cd ~
sudo apt-get update -y
sudo apt-get install -y build-essential nghttp2 libnghttp2-dev libssl-dev wget
wget https://curl.haxx.se/download/curl-${VERSION}.tar.gz
tar -xzvf curl-${VERSION}.tar.gz && rm -f curl-${VERSION}.tar.gz && cd curl-${VERSION}
./configure --prefix=/usr/local --with-ssl --with-nghttp2
make -j4
sudo make install
sudo ldconfig
cd ~ && rm -rf curl-${VERSION}

There's a few security issues/vulnerabilities between 7.63 and the latest version at the time of this comment (7.76.1), and I'm working on a few HIPAA/PIPEDA projects that needs to be top notch in terms of security, hence my mod. 7.75 and up is recommended at this time. More info: https://curl.se/docs/security.html

Cheers

@tlacroix
Copy link

tlacroix commented Apr 23, 2021

Nice one, thanks!

BTW, is package nghttp2 necessary? I think installing its related library is enough.

Not sure, always been using the apt-get install ... nghttp2 libnghttp2-dev ... part, but according to the cURL documentation:

nghttp2
libcurl uses this 3rd party library for the low level protocol handling parts. The reason for this is that HTTP/2 is much more complex at that layer than HTTP/1.1 (which we implement on our own) and that nghttp2 is an already existing and well functional library.
We require at least version 1.12.0.

https://curl.se/docs/http2.html

So required at least to build it I guess.

@jjpeleato
Copy link
Author

jjpeleato commented May 3, 2021

Thanks for your script, works like a charm. I modified it a bit to be able to specify a version once for this project: https://github.com/gepo/apns-http2

My modified version below:

#!/bin/bash

# Update version below to latest, found here: https://curl.se/download/
VERSION=7.76.1

cd ~
sudo apt-get update -y
sudo apt-get install -y build-essential nghttp2 libnghttp2-dev libssl-dev wget
wget https://curl.haxx.se/download/curl-${VERSION}.tar.gz
tar -xzvf curl-${VERSION}.tar.gz && rm -f curl-${VERSION}.tar.gz && cd curl-${VERSION}
./configure --prefix=/usr/local --with-ssl --with-nghttp2
make -j4
sudo make install
sudo ldconfig
cd ~ && rm -rf curl-${VERSION}

There's a few security issues/vulnerabilities between 7.63 and the latest version at the time of this comment (7.76.1), and I'm working on a few HIPAA/PIPEDA projects that needs to be top notch in terms of security, hence my mod. 7.75 and up is recommended at this time. More info: https://curl.se/docs/security.html

Cheers

Thank you! I updated my script according your recommendation @tlacroix

@jjpeleato
Copy link
Author

jjpeleato commented May 3, 2021

Nice one, thanks!

BTW, is package nghttp2 necessary? I think installing its related library is enough.

Yes, it is necessary.

Look at the pre requisites according official documentation =)

https://curl.se/docs/http2.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment