系统基于ubuntu server 14.04.4 amd64,即Ubuntu系统的服务器版本,基本适用于桌面版

安装

第一步 到PCRE官网下载PCRE的压缩包,并解压

PCRE官网首页找到下载页面链接:
图片加载中...

这里我们选择PCRE1的最新版(8.39),右键复制链接地址:
图片加载中...

在Linux中使用wget命令下载,执行如下命令开始下载:

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz

解压:

tar zxvf pcre-8.39.tar.gz

第二步 进行安装

进入PCRE的解压目录,开始安装,安装过程比较简单,依次执行下面几条命令即可:

配置:

./configure

注意
(1) 如果之前没有安装C compiler(C 编译器),这一步将报如下错误信息:

configure: error: in `/home/xueliang/download/pcre-8.39’:
configure: error: no acceptable C compiler found in $PATH
See `config.log’ for more details
xueliang@dev:~/download/pcre-8.39$

可以参考这篇文章安装C compiler,然后继续下面的操作

(2) 如果之前没有安装C++ compiler(C++ 编译器),这一步将报如下错误信息:

configure: error: You need a C++ compiler for C++ support.
xueliang@dev:~/download/pcre-8.39$

可以参考这篇文章安装C++ compiler,然后继续下面的操作

编译:

make

如果之前没有安装make命令,这一步将报如下错误信息:

xueliang@dev:~/download$ make
The program ‘make’ is currently not installed. You can install it by typing:
sudo apt-get install make
xueliang@dev:~/download$

可以参考这篇文章安装make命令,然后继续下面的操作

对编译结果进行测试:

make test

如果编译无误,会得到如下信息:

Testsuite summary for PCRE 8.39
============================================================================
# TOTAL: 5
# PASS: 5
# SKIP: 0
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0

如果通过测试,就可以开始安装了,执行如下命令完成PCRE的安装:

sudo make install

卸载

在PCRE的解压目录下,一条命令搞定:

sudo make uninstall

完成卸载:

xueliang@dev:~/download/pcre-8.39$ sudo make uninstall
[sudo] password for xueliang:
( cd ‘/usr/local/bin’ && rm -f pcretest pcregrep )
( cd ‘/usr/local/bin’ && rm -f pcre-config )
( cd ‘/usr/local/share/doc/pcre’ && rm -f pcre.txt pcre-config.txt pcregrep.txt pcretest.txt AUTHORS COPYING ChangeLog LICENCE NEWS README )
( cd ‘/usr/local/share/doc/pcre/html’ && rm -f NON-AUTOTOOLS-BUILD.txt README.txt index.html pcre-config.html pcre.html pcre16.html pcre32.html pcre_assign_jit_stack.html pcre_compile.html pcre_compile2.html pcre_config.html pcre_copy_named_substring.html pcre_copy_substring.html pcre_dfa_exec.html pcre_exec.html pcre_free_study.html pcre_free_substring.html pcre_free_substring_list.html pcre_fullinfo.html pcre_get_named_substring.html pcre_get_stringnumber.html pcre_get_stringtable_entries.html pcre_get_substring.html pcre_get_substring_list.html pcre_jit_exec.html pcre_jit_stack_alloc.html pcre_jit_stack_free.html pcre_maketables.html pcre_pattern_to_host_byte_order.html pcre_refcount.html pcre_study.html pcre_utf16_to_host_byte_order.html pcre_utf32_to_host_byte_order.html pcre_version.html pcreapi.html pcrebuild.html pcrecallout.html pcrecompat.html pcredemo.html pcregrep.html pcrejit.html pcrelimits.html pcrematching.html pcrepartial.html pcrepattern.html pcreperform.html pcreposix.html pcreprecompile.html pcresample.html pcrestack.html pcresyntax.html pcretest.html pcreunicode.html )
( cd ‘/usr/local/share/doc/pcre/html’ && rm -f pcrecpp.html )
( cd ‘/usr/local/include’ && rm -f pcreposix.h pcrecpp.h pcre_scanner.h )
/bin/bash ./libtool –mode=uninstall rm -f ‘/usr/local/lib/libpcre.la’
libtool: uninstall: rm -f /usr/local/lib/libpcre.la /usr/local/lib/libpcre.so.1.2.7 /usr/local/lib/libpcre.so.1 /usr/local/lib/libpcre.so /usr/local/lib/libpcre.a
/bin/bash ./libtool –mode=uninstall rm -f ‘/usr/local/lib/libpcreposix.la’
libtool: uninstall: rm -f /usr/local/lib/libpcreposix.la /usr/local/lib/libpcreposix.so.0.0.4 /usr/local/lib/libpcreposix.so.0 /usr/local/lib/libpcreposix.so /usr/local/lib/libpcreposix.a
/bin/bash ./libtool –mode=uninstall rm -f ‘/usr/local/lib/libpcrecpp.la’
libtool: uninstall: rm -f /usr/local/lib/libpcrecpp.la /usr/local/lib/libpcrecpp.so.0.0.1 /usr/local/lib/libpcrecpp.so.0 /usr/local/lib/libpcrecpp.so /usr/local/lib/libpcrecpp.a
( cd ‘/usr/local/share/man/man1’ && rm -f pcre-config.1 pcregrep.1 pcretest.1 )
( cd ‘/usr/local/share/man/man3’ && rm -f pcre.3 pcre16.3 pcre32.3 pcre_assign_jit_stack.3 pcre_compile.3 pcre_compile2.3 pcre_config.3 pcre_copy_named_substring.3 pcre_copy_substring.3 pcre_dfa_exec.3 pcre_exec.3 pcre_free_study.3 pcre_free_substring.3 pcre_free_substring_list.3 pcre_fullinfo.3 pcre_get_named_substring.3 pcre_get_stringnumber.3 pcre_get_stringtable_entries.3 pcre_get_substring.3 pcre_get_substring_list.3 pcre_jit_exec.3 pcre_jit_stack_alloc.3 pcre_jit_stack_free.3 pcre_maketables.3 pcre_pattern_to_host_byte_order.3 pcre_refcount.3 pcre_study.3 pcre_utf16_to_host_byte_order.3 pcre_utf32_to_host_byte_order.3 pcre_version.3 pcreapi.3 pcrebuild.3 pcrecallout.3 pcrecompat.3 pcredemo.3 pcrejit.3 pcrelimits.3 pcrematching.3 pcrepartial.3 pcrepattern.3 pcreperform.3 pcreposix.3 pcreprecompile.3 pcresample.3 pcrestack.3 pcresyntax.3 pcreunicode.3 pcrecpp.3 )
( cd ‘/usr/local/include’ && rm -f pcre.h pcrecpparg.h pcre_stringpiece.h )
( cd ‘/usr/local/lib/pkgconfig’ && rm -f libpcre.pc libpcreposix.pc libpcrecpp.pc )
xueliang@dev:~/download/pcre-8.39$

About Me
WEB开发工程师
GitHub Repos