1. 首先安裝pcre
[root@localhost src]# ls
nginx-1.5.10.tar.gz pcre-8.32 pcre-8.32.tar.gz
[root@localhost src]# tar xf pcre-8.32.tar.gz
[root@localhost src]# cd pcre-8.32
[root@localhost pcre-8.32]# ./configure
checking for a BSD-compatible install… /usr/bin/install -c
checking for cl.exe… no
configure: error: in `/usr/local/src/pcre-8.32′:
configure: error: no acceptable C compiler found in $PATH
configure: error: You need a C++ compiler for C++ support. # error 提示沒有g(shù)cc編譯器未裝
See `config.log’ for more details
#gcc采用yum安裝,首先安裝網(wǎng)絡(luò)yum
[root@localhost pcre-8.32]# ls -l /etc/yum.repos.d/ #CentOS6默認(rèn)的yum配置文件
total 16
-rw-r–r–. 1 root root 1926 Feb 25 2013 CentOS-Base.repo
-rw-r–r–. 1 root root 638 Feb 25 2013 CentOS-Debuginfo.repo
-rw-r–r–. 1 root root 630 Feb 25 2013 CentOS-Media.repo
-rw-r–r–. 1 root root 3664 Feb 25 2013 CentOS-Vault.repo
[root@localhost pcre-8.32]# ping www.baidu.com # 測(cè)試網(wǎng)絡(luò)是通的
PING www.a.shifen.com (61.135.169.105) 56(84) bytes of data.
64 bytes from 61.135.169.105: icmp_seq=1 ttl=54 time=9.73 ms
64 bytes from 61.135.169.105: icmp_seq=2 ttl=54 time=5.95 ms
^C
— www.a.shifen.com ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1759ms
rtt min/avg/max/mdev = 5.957/7.843/9.730/1.888 ms
[root@localhost pcre-8.32]# rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.7QWIgw: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing… ########################################### [100%]
1:epel-release ########################################### [100%]
[root@localhost pcre-8.32]# rpm -ivh http://elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
Retrieving http://elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
warning: /var/tmp/rpm-tmp.iqttoT: Header V4 DSA/SHA1 Signature, key ID baadae52: NOKEY
Preparing… ########################################### [100%]
1:elrepo-release ########################################### [100%]
[root@localhost pcre-8.32]# ls -l /etc/yum.repos.d/ #不難發(fā)現(xiàn)又多了兩個(gè)yum的文件
total 28
-rw-r–r–. 1 root root 1926 Feb 25 2013 CentOS-Base.repo
-rw-r–r–. 1 root root 638 Feb 25 2013 CentOS-Debuginfo.repo
-rw-r–r–. 1 root root 630 Feb 25 2013 CentOS-Media.repo
-rw-r–r–. 1 root root 3664 Feb 25 2013 CentOS-Vault.repo
-rw-r–r– 1 root root 1190 Jan 8 2013 elrepo.repo
-rw-r–r– 1 root root 957 Nov 4 2012 epel.repo #正式版,所有的軟件都是穩(wěn)定可以信賴的
-rw-r–r– 1 root root 1056 Nov 4 2012 epel-testing.repo #最新的測(cè)試源
[root@localhost pcre-8.32]# yum -y install gcc gcc-c++ #安裝gcc、gcc-c++
[root@localhost pcre-8.32]# ./configure # 重新編譯pcre
pcre-8.32 configuration summary:
Install prefix ……………… : /usr/local
C preprocessor ……………… : gcc -E
C compiler …………………. : gcc
C++ preprocessor ……………. : g++ -E
C++ compiler ……………….. : g++
Linker …………………….. : /usr/bin/ld -m elf_x86_64
C preprocessor flags ………… :
C compiler flags ……………. : -O2 -fvisibility=hidden
C++ compiler flags ………….. : -O2 -fvisibility=hidden -fvisibility-inlines-hidden
Linker flags ……………….. :
Extra libraries …………….. :
Build 8 bit pcre library …….. : yes
Build 16 bit pcre library ……. : no
Build 32 bit pcre library ……. : no
Build C++ library …………… : yes
Enable JIT compiling support …. : no
Enable UTF-8/16/32 support …… : no
Unicode properties ………….. : no
Newline char/sequence ……….. : lf
\R matches only ANYCRLF ……… : no
EBCDIC coding ………………. : no
EBCDIC code for NL ………….. : n/a
Rebuild char tables …………. : no
Use stack recursion …………. : yes
POSIX mem threshold …………. : 10
Internal link size ………….. : 2
Match limit ………………… : 10000000
Match limit recursion ……….. : MATCH_LIMIT
Build shared libs …………… : yes
Build static libs …………… : yes
Use JIT in pcregrep …………. : no
Buffer size for pcregrep …….. : 20480
Link pcregrep with libz ……… : no
Link pcregrep with libbz2 ……. : no
Link pcretest with libedit …… : no
Link pcretest with libreadline .. : no
Valgrind support ……………. : no
Code coverage ………………. : no
[root@localhost pcre-8.32]# make && make install
-bash: make: command not found # 沒有安裝make包
[root@localhost pcre-8.32]# yum install make #安裝make
[root@localhost pcre-8.32]# make && make install
make[3]: Leaving directory `/usr/local/src/pcre-8.32′
make[2]: Leaving directory `/usr/local/src/pcre-8.32′
make[1]: Leaving directory `/usr/local/src/pcre-8.32′
[root@localhost pcre-8.32]#