How to install pcre and pcre-devel on ubuntu using apt-get?

The PCRE library is a set of functions that implement regular expression pattern matching . This is being used in many high profile open source projects like Apache, Nginx  and PHP. While i was trying to compile and install nginx on my staging machine, following error was thrown

1 2 3 4 5 6 ./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using withouthttp_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using withpcre=<path> option.

Configure script complains “pcre” library is missing on the server, which is required by “nginx” rewrite module. Either we need to disable the rewrite module in nginx or we have to install pcre library on the machine. As you know, rewrite functionality is very much critical for any webserver to manipulate the URLs.

In this article we will see how to install pcre and pcre-devel on Ubuntu and Centos

On Centos machine, I can install “pcre” and “pcre-devel” packages using yum .

1 yum install pcre pcredevel

How to install pcre and pcre-devel on Ubuntu ?

On ubuntu machines, the apt-get package names for “pcre” and  “pcre development packages are “libpcre3”   and “libpcre3-dev” . Run the following commands to install

1 2 3 aptget install libpcre3 aptget install libpcre3dev

On my machine, “libpcre3” was already installed and i had to install only “libpcre3-dev”

1 2 3 4 5 6 7 8 root@7b7d9678efd3:/nginx1.13.3# apt-get install libpcre3 Reading package lists... Done Building dependency tree Reading state information... Done libpcre3 is already the newest version (2:8.383.1). 0 upgraded, 0 newly installed, 0 to remove and 30 not upgraded.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 root@7b7d9678efd3:/nginx1.13.3# apt-get install libpcre3-dev Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libpcre163 libpcre323 libpcrecpp0v5 The following NEW packages will be installed: libpcre163 libpcre3dev libpcre323 libpcrecpp0v5 0 upgraded, 4 newly installed, 0 to remove and 30 not upgraded. Need to get 820 kB of archives. After this operation, 3519 kB of additional disk space will be used. Do you want to continue? [Y/n] y

As always, feel free to drop us a note if you have any queries or feedbacks using our comment form below. Always happy to help you ???? Manuels d’utilisation

Author: , 0000-00-00