How to Install Apr And Apr-Util in Linux [Step-by-Step]

In this Step by Step tutorial we will cover different methods to install apr and apr-util package on multiple Linux distributions such as Red Hat, CentOS, Debian, Ubuntu etc. We will cover the following 2 methods of installation:

  1. Installation of apr and apr-util via official repository
  2. Download the required binary and compile them for installation


What is APR and Apr-Util?

Apache Portable Runtime (APR) is a software library that provides a supportive, predictable and consistent interface for Apache web servers. Apr-util is a companion library to APR. Their license is Apache License Version 2.0


APR provides a set of application programming interfaces (APIs) to the Operating System (OS). Software developers can use APR to make an application portable between different platforms.


Method-1: Install apr and apr-util using official repository

The installation steps will be explained as Installing from the Package Repository and Installing the Package by Compiling(From Github).

The installation of the apr libraries will be explained in 2 different operating systems.


Installation on Debian Based OS

On Debian-based(Ubuntu, Pardus etc.) systems, the name of the apr package is libapr1 and apr-util is libaprutil1. You can see the packages and its version with the following commands.

To search for the apr package

foc@foc:~$ sudo  apt search "Apache Portable Runtime Library"
Sorting... Done
Full Text Search... Done
libapr1/jammy 1.7.0-8build1 amd64
  Apache Portable Runtime Library

For apr-util package:

foc@foc:~$ sudo  apt search "Apache Portable Runtime Utility "
Sorting... Done
Full Text Search... Done
libaprutil1/jammy 1.6.1-5ubuntu4 amd64
  Apache Portable Runtime Utility Library

Then you can install the packages to the system with the following command:

foc@foc:~$ sudo apt install libapr1 libaprutil1 -y

If you want to remove the installed package, you can run the following command:

foc@foc:~/apr$ sudo apt remove libapr1 libaprutil1


Installation on Redhat Based OS

In Redhat based systems, the packages are in the repository with the same name. First, let's check the packages and their versions.

For apr package:

[foc@rocky9 ~]$ sudo dnf search apr
[sudo] password for foc: 
Last metadata expiration check: 0:27:39 ago on Sun 14 Aug 2022 08:53:51 PM +03.
============================================= Name Exactly Matched: apr ==============================================
apr.x86_64 : Apache Portable Runtime library
apr.i686 : Apache Portable Runtime library

For apr-util package:

[foc@rocky9 ~]$ sudo dnf search apr-util
Last metadata expiration check: 0:30:28 ago on Sun 14 Aug 2022 08:53:51 PM +03.
=========================================== Name Exactly Matched: apr-util ===========================================
apr-util.x86_64 : Apache Portable Runtime Utility library
apr-util.i686 : Apache Portable Runtime Utility library

After the following command, apr and apr-util packages are installed to the system with their dependencies:

[foc@rocky9 ~]$ sudo dnf install apr apr-util
Last metadata expiration check: 0:31:22 ago on Sun 14 Aug 2022 08:53:51 PM +03.
Dependencies resolved.
 Package                          Architecture           Version                      Repository                 Size
 apr                              x86_64                 1.7.0-11.el9                 appstream                 123 k
 apr-util                         x86_64                 1.6.1-20.el9                 appstream                  94 k
Installing dependencies:
 apr-util-bdb                     x86_64                 1.6.1-20.el9                 appstream                  13 k
Installing weak dependencies:
 apr-util-openssl                 x86_64                 1.6.1-20.el9                 appstream                  15 k

Transaction Summary
Install  4 Packages

Total download size: 245 k
Installed size: 541 k
Is this ok [y/N]: y
Downloading Packages:
(1/4): apr-util-openssl-1.6.1-20.el9.x86_64.rpm                                        31 kB/s |  15 kB     00:00    
(2/4): apr-util-bdb-1.6.1-20.el9.x86_64.rpm                                            26 kB/s |  13 kB     00:00    
(3/4): apr-1.7.0-11.el9.x86_64.rpm                                                    834 kB/s | 123 kB     00:00    
(4/4): apr-util-1.6.1-20.el9.x86_64.rpm                                               149 kB/s |  94 kB     00:00    
Total                                                                                 183 kB/s | 245 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                              1/1 
  Installing       : apr-1.7.0-11.el9.x86_64                                                                      1/4 
  Installing       : apr-util-bdb-1.6.1-20.el9.x86_64                                                             2/4 
  Installing       : apr-util-1.6.1-20.el9.x86_64                                                                 3/4 
  Installing       : apr-util-openssl-1.6.1-20.el9.x86_64                                                         4/4 
  Running scriptlet: apr-util-openssl-1.6.1-20.el9.x86_64                                                         4/4 
  Verifying        : apr-util-openssl-1.6.1-20.el9.x86_64                                                         1/4 
  Verifying        : apr-util-bdb-1.6.1-20.el9.x86_64                                                             2/4 
  Verifying        : apr-util-1.6.1-20.el9.x86_64                                                                 3/4 
  Verifying        : apr-1.7.0-11.el9.x86_64                                                                      4/4 

  apr-1.7.0-11.el9.x86_64                    apr-util-1.6.1-20.el9.x86_64       apr-util-bdb-1.6.1-20.el9.x86_64      


Installation completed successfully. If you want to remove the package from the system, you can run the following command:

[foc@rocky9 apr]$ sudo dnf remove apr apr-util


Method-2: Install apr and apr-util from github

Step-1: Download pre-requisites

We will be using Rocky Linux for this step. You must have the git and make packages on your system, run the following command in terminal to install it:

[foc@rocky9 apr]$ sudo dnf install git make -y


Step-2: Clone the apr source code from github

Then download the source codes to the local directory:

[foc@rocky9 apr]$ git clone


Step-3: Identify and Install dependency packages

Then go to the downloaded directory:

[foc@rocky9 apr]$ cd apr/

Run the following command to find out the build dependencies:

[foc@rocky9 apr]$ sudo ./buildconf
buildconf: checking installation...
buildconf: python version 3.9.10 (ok)
buildconf: autoconf not found.
           You need autoconf version 2.59 or newer installed
           to build APR from SVN.
buildconf: libtool not found.
           You need libtool version 1.4 or newer installed
           to build APR from SVN.

The following packages are installed for the build dependencies (Python is already installed):

[foc@rocky9 apr]$ sudo dnf install autoconf libtool


Step-4: Install apr and apr-util

Then run the following commands in the terminal in order:

[foc@rocky9 apr]$ sudo autoconf

[foc@rocky9 apr]$ sudo ./configure --prefix=/usr

It didn't give a warning in the buildconf command, but the error "configure: error: No XML parser found! Please specify --with-expat or --with-libxml2" requests new dependencies.

[foc@rocky9 apr]$ sudo dnf install expat expat-devel

Then the command is run again.

[foc@rocky9 apr]$ sudo ./configure --prefix=/usr

You may get the "config.status: error: cannot find input file: include/arch/unix/" error after the above command.  Fix the error with the following command:

[foc@rocky9 apr]$ sudo ./buildconf
buildconf: checking installation...
buildconf: python version 3.9.10 (ok)
buildconf: autoconf version 2.69 (ok)
buildconf: libtool version 2.4.6 (ok)
buildconf: copying libtool helper files using /usr/bin/libtoolize
buildconf: creating include/arch/unix/ ...
buildconf: creating configure ...
buildconf: generating 'make' outputs ...
buildconf: rebuilding rpm spec file

Generated include files already exist, the tree is not clean.
The resulting file is incorrect

Then run the following commands in order:

[foc@rocky9 apr]$ sudo ./configure --prefix=/usr

[foc@rocky9 apr]$ sudo make 

[foc@rocky9 apr]$ sudo make install

How to Install Apr And Apr-Util in Linux [Step-by-Step]



Installation was done with the standard steps on the github page. If you want to customize the installation, you can get help with the command below:

./configure --help


References - Apache Portable Runtime Project
apache/apr - Github Page


Didn't find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Leave a Comment