Вернуться назад

Настройка curl http2

Centos 7

Устанавливаем необходимое ПО для работы с исходниками:

yum -y groupinstall "Development Tools"
yum -y install libev libev-devel zlib zlib-devel openssl openssl-devel git

Устанавливаем свежую версию OpenSSL (если этого не сделать, curl не будет скорее всего работать по http2)

Выполняем команды:

mkdir /var/tmp 
cd /var/tmp
wget https://www.openssl.org/source/openssl-1.0.2-latest.tar.gz
tar -zxf openssl-1.0.2-latest.tar.gz
cd openssl-1.0.2l
mkdir /opt/openssl
./config --prefix=/opt/openssl
make
make test
(Если на этом этапе возникает ошибка, выполняем это yum install perl-Test-Simple и запускаем make test снова)
make install

После успешной компиляции в каталоге /opt/openssl будут созданы такие каталоги:

bin
include
lib
share
ssl

Содержимое с необходимо скопировать в одноименные каталоги в /usr c заменой 

https://mor-pah.net/2017/06/21/installing-curl-with-http2-support-on-centos-7-self-contained/

===========================

Черновик, отредактирую потом

This was a little bit of a mission for a customer recently that required http2 support with curl but they weren’t fussed about it being separate from the already installed version of curl. This also helped because it turned out it needed a newer version of OpenSSL and the last thing I wanted to do was to replace the installed version of OpenSSL and break dependencies.

Firstly, install the dev tools you’re doing to need.

yum -y groupinstall "Development Tools"
yum -y install libev libev-devel zlib zlib-devel openssl openssl-devel git

Next, we’re going to store a few things in /var/tmp and install the new version of openssl into /opt/openssl

mkdir /var/tmp
cd /var/tmp
wget https://www.openssl.org/source/openssl-1.0.2-latest.tar.gz
tar -zxf openssl-1.0.2-latest.tar.gz
cd openssl-1.0.2l
mkdir /opt/openssl
./config --prefix=/opt/openssl
make
make test
make install

Now on to nghttp2

git clone https://github.com/tatsuhiro-t/nghttp2.git
cd nghttp2
autoreconf -i
automake
autoconf
./configure
make
make install
echo '/usr/local/lib' > /etc/ld.so.conf.d/custom-libs.conf
ldconfig
ldconfig -p| grep libnghttp2

Then finally, we build curl with http2 and the newer openssl

cd /var/tmp
git clone https://github.com/bagder/curl.git
cd curl
./buildconf
./configure --with-ssl=/opt/openssl --with-nghttp2=/usr/local --disable-file --without-pic --disable-shared
make

Finally, you should be able to run curl with

/var/tmp/curl/src/curl --version

This does not ‘install’ curl, it just builds it. My advice would be to have it install into /opt somewhere but you can change that on the ./configure line above.

 

Ubuntu

В версии 20 из коробки все идет

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


igel
Дата: 23 мая 2020 г. в 18:30:18

Автор: igel