APR mainly is a supporting library for the Apache web server, offering also some more enhancements and functionalities. Furthermore, APR is necessary for Apache Tomcat (the most popular Java Application Server) if we want to install and use the APR-based Native library for Tomcat, in order to enable Tomcat, to support OpenSSL functionality.
In this post, you can see the process of installing it in a Debian/Linux distribution system.
It is not absolutely necessary, however, if you have some time you can dig deeper to access the official documentation. Also, since the installation is linked to Apache Tomcat, it will be fine if you have already installed it on your system. See my post here on how you can do that.
The process is pretty straightforward and consists of running just 3 commands. We will se them later in the 3 steps following.
APR stands for Apache Portable Runtime. You can download the source files of the latest version as a compressed tar here. APR 1.7.0 was the best available version when this post was written.
In case you have already installed Tomcat in your system, you probably know that when you deployed it, a Tomcat folder structure was created in your system. So, a good place to un-compress the downloaded apr-1.7.0.tar.qz file is there (the top or root folder of the Tomcat). So, when you have extracted it there, a new folder named apr-1.7.0 has been created, as you can see below (via KDE-Dolphin).
Navigating into that folder you can find the configure script, which should be run first.
You can obtain the available option that can be used to run it via the command:
➜ ./configure --help
? See the whole output at my gist here.
The configure script
./configure is not a command. In most cases, it is an executable file (a bash script or not and might be unreadable as well). Its main aim, when you run it, is to get some information about your system and what is installed, which might be useful for the package in which it is being contained. It actually detects if the system has the prerequisites to install that software package in your system. When you run it and you get some error(s), it means that your system doesn’t have some other necessary packages installed. As happens here, the ./configure script usually, is shipped together with the software source code (sources) you downloaded for further compilation/installation. So, it is being used to prepare the building/compilation process (when you install that software directly on your own).
.Step 1 – Run the configure script
? The output is quite long performing also a long number of checks. You can see the whole output at the gist here.
The good news are that we didn’t get any errors. The final line of the output states: “config.status: executing default commands”. Such a message usually means that we can proceed to build the package -the APR library(-ies).
Step 2 – Build the package
Nothing special. Just run the standard GNU make command.
? Again, if you didn’t get any errors, like here, you can proceed to the final step of the installation of the APR package. – You can see the whole output at the gist here.
Step 3 – Install the package
Similarly, we simply use the make install command, which installs the binaries (the libraries) built into their final locations. This time you probably have to use sudo, to access the destination system folder(s).
➜ sudo make install
This time you can see the output below:
The importance of the above output is to know where the APR libraries have been installed. As you can see, they have been installed into the “/usr/local/apr/lib” folder.
Enjoy, and thank you for reading!
[Related: Installing the Apache Portable Runtime (APR) based Native library for Tomcat]