Linux HOWTOs

About | Home | Search


HOWTO: curl
Description: Commandline tool for transferring files with URL syntax
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# cURL 7.63.0
# ===========
# Slackware 13.37: curl 7.21.4
# Slackware 14.0: curl 7.27.0
# Slackware 14.1: curl 7.31.0
# Slackware 14.2: curl 7.49.1

# Previous versions of this howto have used the /usr/local prefix, the
# default when you build it from source.  If you want to uninstall one of
# those, or just clean up files from an old version, skip down to the bottom
# for removal instructions.

# Prerequisites:
# pkg-config
# OpenSSL or BoringSSL or LibreSSL (optional)
# zlib (optional)
# OpenLDAP (optional; for ldap:// support)
# Perl
# groff
# bison
# Kerberos (optional; for GSS-API)
# libssh2 (optional; for ssh support)
# nghttp2 (optional; for http2 support)
# librtmp (optional)
# libmetalink (optional)
# libpsl (optional)
# Brotli (optional)
# c-ares (optional; --enable-ares)

# Don't run the test suite (make test) below if you have LIDS running
# or anything else that wouldn't like it binding to ports

# Get it
cd
test -f installed/curl-7.63.0.tar.xz && mv installed/curl-7.63.0.tar.xz .
test ! -f curl-7.63.0.tar.xz &&
 wget https://curl.haxx.se/download/curl-7.63.0.tar.xz

# Verify tarball w/ sha1sum:
# (this came from my gpg-verified tarball)
echo "9600234c794bfb8a0d3f138e9294d60a20e7a5f10e35ece8cf518e2112d968\
c4  curl-7.63.0.tar.xz" | sha256sum -c

# Verify tarball w/ gpg:
( gpg --list-keys B71E12C2 > /dev/null 2>&1 || gpg --recv-keys B71E12C2 ) &&
 wget -nc http://curl.haxx.se/download/curl-7.63.0.tar.xz.asc &&
  gpg --verify curl-7.63.0.tar.xz.asc && rm curl-7.63.0.tar.xz.asc

# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "curl-*" -exec rm -r {} \;
tar xJvf ~/curl-7.63.0.tar.xz
cd curl-7.63.0
test $UID = 0 && chown -R root:root .

# If your OpenSSL is not installed under /usr/local/ssl, pass
# --with-ssl to configure by itself with no path.  If configure
# can't find it, use LDFLAGS=-L/usr/local/ssl/lib64 or wherever libssl
# and libcrypto are.

# If you do use Slackware and your /usr/share/man is a symlink
# to /usr/man, then don't worry about the mandir part (if you're
# feeling exceptionally lazy).

# You may need LIBS="-lssl -lcrypto" to get LDAP support added successfully

# Configure the build, 64-bit with OpenSSL prefix /usr/local/ssl
test $(uname -m) = "x86_64" &&
 test -d /usr/local/ssl/include &&
  LDFLAGS=-L/usr/local/ssl/lib64 ./configure --prefix=/usr \
   --mandir=/usr/man --libdir=/usr/lib64 --with-ssl=/usr/local/ssl \
   --with-libssh2 --enable-ldap --enable-ldaps --enable-ares

# Configure the build, 64-bit with OpenSSL prefix /usr/local
test $(uname -m) = "x86_64" &&
 test -d /usr/local/include/openssl &&
  LIBS="-lssl -lcrypto" ./configure --prefix=/usr --libdir=/usr/lib64 \
   --mandir=/usr/man --with-ssl --with-libssh2 --enable-ldap --enable-ldaps \
   --enable-ares

# Configure the build, anything else
test $(uname -m) != "x86_64" &&
 ./configure --prefix=/usr --mandir=/usr/man --with-ssl=/usr/local/ssl \
  --with-libssh2 --enable-ldap --enable-ldaps --enable-ares

# Build it
make

# Test the build
make test

# Become root to install it
su

# Remove the Slackware package, if there is one
# Read the next few parts too before you do it
test -x /sbin/removepkg && /sbin/removepkg curl

# Be aware that in (at least) Slackware >= 12.2, libcurl.so.* files
# are in the aaa_elflibs package.  Not sure why, maybe because
# of gnupg and gnupg2's gpgkeys_curl/gpg2keys_curl, or maybe just
# for whatever needs them.  If you are really low on space, like on an
# embedded system, you may be able to remove the old ones (anything without
# today's date in /usr/lib or /usr/lib64).  Otherwise it will not hurt any
# to leave it there, and if anything is specifically linked with an older
# version of libcurl.so.*, then you'll be avoiding trouble by leaving it
# there.
#
# If you are upgrading from an older version previously installed from
# source, there may be old shared library files in there for that reason
# too.

# Install it
make install
ldconfig

# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .

# Become yourself again
exit

# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/curl-*.tar.*
mv curl-7.63.0.tar.xz installed/


# If you ever want to uninstall cURL, this should do it:
cd
su
test -d src/curl-* && ( cd src/curl-* ; make uninstall )
for pfx in /usr /usr/local;
do
  ( cd ${pfx}/bin ; rm -f curl curl-config )
  test -d ${pfx}/include/curl && rm -r ${pfx}/include/curl
  ( cd ${pfx}/share/man/man1 ; rm -f curl.1 curl-config.1 )
  test -d ${pfx}/share/curl && rm -r ${pfx}/share/curl
  rm -f ${pfx}/lib/libcurl.* ${pfx}/lib/pkgconfig/libcurl.pc \
   ${pfx}/share/man/man3/curl_*.3
done
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "curl-*" -exec rm -r {} \;
rm -f ~/installed/curl-*.tar.*

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>