Ubuntu 1204 安装 redis

使用 apt-get 安装:

sudo apt-get install redis-server

 安装成功的版本是 2.2.12

使用apt-get完全卸载:

sudo apt-get remove --purge redis-server

以下是编译安装:

redis 的源码在 http://redis.googlecode.com/files/redis-2.6.14.tar.gz 上下载不了,在 http://redis.io/download 上可以。

1.下载 redis-2.8.13.tar.gz

# cd /tmp
# wget http://download.redis.io/releases/redis-2.8.13.tar.gz
解压缩
# tar zxvf redis-2.8.13.tar.gz
编译
# cd redis-2.8.13
# make
正常 make[1]:正在离开目录 `/tmp/redis-2.8.13/src'
出现错误

cd src && make test
make[1]: 正在进入目录 `/tmp/redis-2.8.13/src'
You need tcl 8.5 or newer in order to run the Redis test
make[1]: *** [test] 错误 1
make[1]:正在离开目录 `/tmp/redis-2.8.13/src'
make: *** [test] 错误 2

  The End

Execution time of different units:
  4 seconds - unit/printver
  8 seconds - unit/multi
  8 seconds - unit/auth
  4 seconds - unit/quit
  14 seconds - unit/expire
  18 seconds - unit/scan
  43 seconds - unit/protocol
  87 seconds - unit/type/list
  106 seconds - unit/dump
  19 seconds - integration/rdb
  45 seconds - integration/aof
  5 seconds - integration/logging
  17 seconds - integration/convert-zipmap-hash-on-load
  8 seconds - unit/pubsub
  7 seconds - unit/slowlog
  107 seconds - integration/replication-psync
  5 seconds - unit/introspection
  6 seconds - unit/limits
  159 seconds - integration/replication
  166 seconds - unit/aofrw
  77 seconds - unit/scripting
  309 seconds - unit/other
  320 seconds - unit/type/list-2
  324 seconds - unit/type/hash
  251 seconds - unit/bitops
  485 seconds - unit/type/set
  485 seconds - integration/replication-2
  359 seconds - unit/maxmemory
  354 seconds - unit/memefficiency
  541 seconds - unit/type/zset
  559 seconds - unit/basic
  560 seconds - unit/sort
  584 seconds - unit/type/list-3
  431 seconds - unit/hyperloglog
  680 seconds - integration/replication-3
  682 seconds - integration/replication-4
  544 seconds - unit/obuf-limits

!!! WARNING The following tests failed:

*** [err]: Detect write load to master in tests/integration/replication-psync.tcl
Can't detect write load from background clients.
*** [err]: Detect write load to master in tests/integration/replication-psync.tcl
Can't detect write load from background clients.
*** [err]: Detect write load to master in tests/integration/replication-psync.tcl
Can't detect write load from background clients.
*** [err]: Detect write load to master in tests/integration/replication-psync.tcl
Can't detect write load from background clients.
Cleanup: may take some time... OK
make[1]: *** [test] 错误 1
make[1]:正在离开目录 `/var/www/redis-3.0.0/src'
make: *** [test] 错误 2
gao@gao-VirtualBox:/var/www/redis-3.0.0$

2.安装 tclsh

# wget http://hivelocity.dl.sourceforge.net/project/tcl/Tcl/8.5.14/tcl8.5.14-src.tar.gz
# 上面的链接已经失效,请使用下面的链接
# wget http://sourceforge.net/projects/tcl/files/Tcl/8.5.14/tcl8.5.14-src.tar.gz/
# tar xzvf tcl8.5.14-src.tar.gz
# cd tcl8.5.14/unix     # 如果是 windows系统, 请进入tcl8.5.14/win
# ./configure
# sudo make && make install

 Installing libtcl8.5.so to /usr/local/lib/
Installing tclsh as /usr/local/bin/tclsh8.5
Installing tclConfig.sh to /usr/local/lib/
Installing libtclstub8.5.a to /usr/local/lib/
Making directory /usr/local/lib/tcl8.5/msgs
Installing message catalog files to /usr/local/lib/tcl8.5/msgs/
Making directory /usr/local/lib/tcl8.5/opt0.4
Making directory /usr/local/lib/tcl8.5/http1.0
Making directory /usr/local/lib/tcl8.5/encoding
Making directory /usr/local/lib/tcl8.5/../tcl8
Making directory /usr/local/lib/tcl8.5/../tcl8/8.4
Making directory /usr/local/lib/tcl8.5/../tcl8/8.4/platform
Making directory /usr/local/lib/tcl8.5/../tcl8/8.5
Installing header files to /usr/local/include/
Installing library files to /usr/local/lib/tcl8.5/
Installing package http1.0 files to /usr/local/lib/tcl8.5/http1.0/
Installing package http 2.7.11 as a Tcl Module
Installing package opt0.4 files to /usr/local/lib/tcl8.5/opt0.4/
Installing package msgcat 1.5.1 as a Tcl Module
Installing package tcltest 2.3.5 as a Tcl Module
Installing package platform 1.0.11 as a Tcl Module
Installing package platform::shell 1.1.4 as a Tcl Module
Installing encoding files to /usr/local/lib/tcl8.5/encoding/
Making directory /usr/local/man/man1
Making directory /usr/local/man/man3
Making directory /usr/local/man/mann
Installing and cross-linking top-level (.1) docs to /usr/local/man/man1/
Installing and cross-linking C API (.3) docs to /usr/local/man/man3/
Installing and cross-linking command (.n) docs to /usr/local/man/mann/
#  /var/www/soft/tcl8.5.14/unix#

3. 重新编译 redis

# cd /tmp
# wget http://download.redis.io/releases/redis-2.8.13.tar.gz
解压缩
# tar zxvf redis-2.8.13.tar.gz
编译
# cd redis-2.8.13
# make
# make test
******
\o/ All tests passed without errors!

Cleanup: may take some time... OK
make[1]:正在离开目录 `/tmp/redis-2.8.13/src'

# sudo make install

cd src && make install
make[1]: 正在进入目录 `/tmp/redis-2.8.13/src'

Hint: To run 'make test' is a good idea ;)

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
make[1]:正在离开目录 `/tmp/redis-2.8.13/src'

4.查看版本

# redis-cli --version
redis-cli 2.8.13

 5.配置redis

gao@gao-VirtualBox:/tmp/redis-2.8.13/utils$ cd utils
gao@gao-VirtualBox:/tmp/redis-2.8.13/utils$ sudo ./install_server.sh
[sudo] password for gao: 
Welcome to the redis service installer
This script will help you easily set up a running redis server

Please select the redis port for this instance: [6379] 
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf] 
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log] 
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379] 
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/bin/redis-server] 
Selected config:
Port           : 6379
Config file    : /etc/redis/6379.conf
Log file       : /var/log/redis_6379.log
Data dir       : /var/lib/redis/6379
Executable     : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
按下回车后有如下显示:
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
 Adding system startup for /etc/init.d/redis_6379 ...
   /etc/rc0.d/K20redis_6379 -> ../init.d/redis_6379
   /etc/rc1.d/K20redis_6379 -> ../init.d/redis_6379
   /etc/rc6.d/K20redis_6379 -> ../init.d/redis_6379
   /etc/rc2.d/S20redis_6379 -> ../init.d/redis_6379
   /etc/rc3.d/S20redis_6379 -> ../init.d/redis_6379
   /etc/rc4.d/S20redis_6379 -> ../init.d/redis_6379
   /etc/rc5.d/S20redis_6379 -> ../init.d/redis_6379
Success!
Starting Redis server...
Installation successful!

 

安装完成后会在/usr/local/bin目录下会生成5个可执行文件分部是

redis-server:Redis服务器的启动程序

redis-cli:Redis客户端连接程序

redis-benchmark:Redis性能测试工具,测试Redis在你的系统及你的配置下的读写性能

redis-check-aof:更新日志检查程序

redis-check-dump:本地数据库检查程序

有关这5个可执行程序的具体使用方式会在后续的博客中讲到。

再上面的安装过程中最后一步是./install_server.sh 这个是Redis源码中提供的工具脚本。执行此脚本后,会自动生成/etc/init.d/redis_xxx服务启动程序和/etc/redis/xxx.conf

Redis配置文件,redis服务也开机自启了(有关linux中服务设置为开机自启和取消开机自启请参考本博客中的文章:ubuntu下设置开机启动服务)。【说明:xxx表示安装redis指定的端口号,默认端口号是6379

6.redis启动 和停止

#启动
# service redis_xxx start
#停止
# service redis_xxx stop

7.redis 客户端连接

# redis-cli -h 127.0.0.1 -p 6379

8.安装 php-redis 扩展

gao@gao-VirtualBox:/tmp$ sudo wget http://open.imop.us/pr.tar.gz
[sudo] password for gao: 
--2014-08-21 10:05:41--  http://open.imop.us/pr.tar.gz
正在解析主机 open.imop.us (open.imop.us)... 74.82.172.219
正在连接 open.imop.us (open.imop.us)|74.82.172.219|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 84874 (83K) [application/octet-stream]
正在保存至: “pr.tar.gz”

100%[============================>] 84,874      66.8K/s   用时 1.2s  

2014-08-21 10:05:43 (66.8 KB/s) - 已保存 “pr.tar.gz” [84874/84874])

gao@gao-VirtualBox:/tmp$ ll
总用量 1612
drwxrwxrwt 11 root    root       4096  8月 21 10:05 ./
drwxr-xr-x 23 root    root       4096  8月 20 09:27 ../
-rw-r--r--  1 root    root       1677  8月 21 09:45 6379.conf
drwxrwxrwt  2 lightdm lightdm    4096  8月 21 08:42 at-spi2/
-rw-rw-r--  1 gao     gao           0  8月 21 08:45 ibus.log
drwxrwxrwt  2 root    root       4096  8月 21 08:45 .ICE-unix/
drwx------  2 gao     gao        4096  8月 21 08:45 keyring-esQCm4/
-rw-rw-r--  1 gao     gao      281665  8月 21 09:59 phpredis
-rw-r--r--  1 root    root      84874  8月  1  2011 pr.tar.gz
drwx------  2 lightdm lightdm    4096  8月 21 08:45 pulse-2L9K88eMlGn7/
drwx------  2 gao     gao        4096  8月 21 08:45 pulse-7ORLJPn0ZzEc/
drwx------  2 root    root       4096  8月 21 08:42 pulse-PKdhtXMmr18n/
drwxrwxr-x  6 gao     gao        4096  7月 14 23:48 redis-2.8.13/
-rw-rw-r--  1 gao     gao     1227538  7月 14 23:51 redis-2.8.13.tar.gz
drwx------  2 gao     gao        4096  8月 21 08:45 ssh-JkfijprM1778/
-rw-rw-r--  1 lightdm lightdm       0  8月 21 08:42 unity_support_test.1
-r--r--r--  1 root    root         11  8月 21 08:42 .X0-lock
drwxrwxrwt  2 root    root       4096  8月 21 08:42 .X11-unix/
gao@gao-VirtualBox:/tmp$ rm -f phpredis 

gao@gao-VirtualBox:/tmp$ tar -zxvf pr.tar.gz 
owlient-phpredis-5a07edc/
owlient-phpredis-5a07edc/CREDITS
owlient-phpredis-5a07edc/README.markdown
owlient-phpredis-5a07edc/common.h
owlient-phpredis-5a07edc/config.m4
owlient-phpredis-5a07edc/debian.control
owlient-phpredis-5a07edc/debian/
owlient-phpredis-5a07edc/debian/changelog
owlient-phpredis-5a07edc/debian/compat
owlient-phpredis-5a07edc/debian/control
owlient-phpredis-5a07edc/debian/copyright
owlient-phpredis-5a07edc/debian/postinst
owlient-phpredis-5a07edc/debian/postrm
owlient-phpredis-5a07edc/debian/rules
owlient-phpredis-5a07edc/igbinary/
owlient-phpredis-5a07edc/igbinary/.gitignore
owlient-phpredis-5a07edc/igbinary/COPYING
owlient-phpredis-5a07edc/igbinary/CREDITS
owlient-phpredis-5a07edc/igbinary/ChangeLog
owlient-phpredis-5a07edc/igbinary/EXPERIMENTAL
owlient-phpredis-5a07edc/igbinary/NEWS
owlient-phpredis-5a07edc/igbinary/README
owlient-phpredis-5a07edc/igbinary/config.m4
owlient-phpredis-5a07edc/igbinary/hash.h
owlient-phpredis-5a07edc/igbinary/hash_function.c
owlient-phpredis-5a07edc/igbinary/hash_function.h
owlient-phpredis-5a07edc/igbinary/hash_si.c
owlient-phpredis-5a07edc/igbinary/igbinary.c
owlient-phpredis-5a07edc/igbinary/igbinary.h
owlient-phpredis-5a07edc/igbinary/igbinary.php
owlient-phpredis-5a07edc/igbinary/igbinary.php.ini
owlient-phpredis-5a07edc/igbinary/igbinary.spec
owlient-phpredis-5a07edc/igbinary/package.xml
owlient-phpredis-5a07edc/igbinary/php_igbinary.h
owlient-phpredis-5a07edc/igbinary/tags.sh
owlient-phpredis-5a07edc/library.c
owlient-phpredis-5a07edc/library.h
owlient-phpredis-5a07edc/mkdeb-apache2.sh
owlient-phpredis-5a07edc/php_redis.h
owlient-phpredis-5a07edc/redis.c
owlient-phpredis-5a07edc/redis_session.c
owlient-phpredis-5a07edc/redis_session.h
owlient-phpredis-5a07edc/serialize.list
owlient-phpredis-5a07edc/tests/
owlient-phpredis-5a07edc/tests/TestRedis.php
owlient-phpredis-5a07edc/tests/commandsStatus.txt
owlient-phpredis-5a07edc/tests/executeTests.sh
gao@gao-VirtualBox:/tmp$ ll
总用量 1340
drwxrwxrwt 12 root    root       4096  8月 21 10:06 ./
drwxr-xr-x 23 root    root       4096  8月 20 09:27 ../
-rw-r--r--  1 root    root       1677  8月 21 09:45 6379.conf
drwxrwxrwt  2 lightdm lightdm    4096  8月 21 08:42 at-spi2/
-rw-rw-r--  1 gao     gao           0  8月 21 08:45 ibus.log
drwxrwxrwt  2 root    root       4096  8月 21 08:45 .ICE-unix/
drwx------  2 gao     gao        4096  8月 21 08:45 keyring-esQCm4/
drwxrwxr-x  5 gao     gao        4096  3月  7  2011 owlient-phpredis-5a07edc/
-rw-r--r--  1 root    root      84874  8月  1  2011 pr.tar.gz
drwx------  2 lightdm lightdm    4096  8月 21 08:45 pulse-2L9K88eMlGn7/
drwx------  2 gao     gao        4096  8月 21 08:45 pulse-7ORLJPn0ZzEc/
drwx------  2 root    root       4096  8月 21 08:42 pulse-PKdhtXMmr18n/
drwxrwxr-x  6 gao     gao        4096  7月 14 23:48 redis-2.8.13/
-rw-rw-r--  1 gao     gao     1227538  7月 14 23:51 redis-2.8.13.tar.gz
drwx------  2 gao     gao        4096  8月 21 08:45 ssh-JkfijprM1778/
-rw-rw-r--  1 lightdm lightdm       0  8月 21 08:42 unity_support_test.1
-r--r--r--  1 root    root         11  8月 21 08:42 .X0-lock
drwxrwxrwt  2 root    root       4096  8月 21 08:42 .X11-unix/
gao@gao-VirtualBox:/tmp$ ls
6379.conf  ibus.log        owlient-phpredis-5a07edc  pulse-2L9K88eMlGn7  pulse-PKdhtXMmr18n  redis-2.8.13.tar.gz  unity_support_test.1
at-spi2    keyring-esQCm4  pr.tar.gz                 pulse-7ORLJPn0ZzEc  redis-2.8.13        ssh-JkfijprM1778
gao@gao-VirtualBox:/tmp$ cd owlient-phpredis-5a07edc/

gao@gao-VirtualBox:/tmp/owlient-phpredis-5a07edc$ ll
总用量 320
drwxrwxr-x  5 gao  gao    4096  3月  7  2011 ./
drwxrwxrwt 12 root root   4096  8月 21 10:06 ../
-rw-rw-r--  1 gao  gao    4574  3月  7  2011 common.h
-rwxrwxr-x  1 gao  gao    1683  3月  7  2011 config.m4*
-rw-rw-r--  1 gao  gao     160  3月  7  2011 CREDITS
drwxrwxr-x  2 gao  gao    4096  3月  7  2011 debian/
-rw-rw-r--  1 gao  gao     307  3月  7  2011 debian.control
drwxrwxr-x  2 gao  gao    4096  3月  7  2011 igbinary/
-rw-rw-r--  1 gao  gao   32348  3月  7  2011 library.c
-rw-rw-r--  1 gao  gao    3165  3月  7  2011 library.h
-rwxrwxr-x  1 gao  gao     636  3月  7  2011 mkdeb-apache2.sh*
-rwxrwxr-x  1 gao  gao    6817  3月  7  2011 php_redis.h*
-rw-rw-r--  1 gao  gao   58127  3月  7  2011 README.markdown
-rwxrwxr-x  1 gao  gao  152278  3月  7  2011 redis.c*
-rw-rw-r--  1 gao  gao    9744  3月  7  2011 redis_session.c
-rw-rw-r--  1 gao  gao     226  3月  7  2011 redis_session.h
-rw-rw-r--  1 gao  gao     424  3月  7  2011 serialize.list
drwxrwxr-x  2 gao  gao    4096  3月  7  2011 tests/
gao@gao-VirtualBox:/tmp/owlient-phpredis-5a07edc$ phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
gao@gao-VirtualBox:/tmp/owlient-phpredis-5a07edc$ ll
总用量 1632
drwxrwxr-x  7 gao  gao    4096  8月 21 10:07 ./
drwxrwxrwt 12 root root   4096  8月 21 10:07 ../
-rw-r--r--  1 gao  gao   76186  8月 21 10:07 acinclude.m4
-rw-rw-r--  1 gao  gao  386725  8月 21 10:07 aclocal.m4
drwxr-xr-x  2 gao  gao    4096  8月 21 10:07 autom4te.cache/
drwxrwxr-x  2 gao  gao    4096  8月 21 10:07 build/
-rw-rw-r--  1 gao  gao    4574  3月  7  2011 common.h
-rwxr-xr-x  1 gao  gao   44826  8月 21 10:07 config.guess*
-rw-rw-r--  1 gao  gao    1702  8月 21 10:07 config.h.in
-rwxrwxr-x  1 gao  gao    1683  3月  7  2011 config.m4*
-rwxr-xr-x  1 gao  gao   35454  8月 21 10:07 config.sub*
-rwxrwxr-x  1 gao  gao  399672  8月 21 10:07 configure*
-rw-rw-r--  1 gao  gao    4643  8月 21 10:07 configure.in
-rw-rw-r--  1 gao  gao     160  3月  7  2011 CREDITS
drwxrwxr-x  2 gao  gao    4096  3月  7  2011 debian/
-rw-rw-r--  1 gao  gao     307  3月  7  2011 debian.control
drwxrwxr-x  2 gao  gao    4096  3月  7  2011 igbinary/
-rw-rw-r--  1 gao  gao       0  8月 21 10:07 install-sh
-rw-rw-r--  1 gao  gao   32348  3月  7  2011 library.c
-rw-rw-r--  1 gao  gao    3165  3月  7  2011 library.h
-rw-r--r--  1 gao  gao  283680  8月 21 10:07 ltmain.sh
-rw-r--r--  1 gao  gao    5498  8月 21 10:07 Makefile.global
-rw-rw-r--  1 gao  gao       0  8月 21 10:07 missing
-rwxrwxr-x  1 gao  gao     636  3月  7  2011 mkdeb-apache2.sh*
-rw-rw-r--  1 gao  gao       0  8月 21 10:07 mkinstalldirs
-rwxrwxr-x  1 gao  gao    6817  3月  7  2011 php_redis.h*
-rw-rw-r--  1 gao  gao   58127  3月  7  2011 README.markdown
-rwxrwxr-x  1 gao  gao  152278  3月  7  2011 redis.c*
-rw-rw-r--  1 gao  gao    9744  3月  7  2011 redis_session.c
-rw-rw-r--  1 gao  gao     226  3月  7  2011 redis_session.h
-rw-r--r--  1 gao  gao   75297  8月 21 10:07 run-tests.php
-rw-rw-r--  1 gao  gao     424  3月  7  2011 serialize.list
drwxrwxr-x  2 gao  gao    4096  3月  7  2011 tests/
gao@gao-VirtualBox:/tmp/owlient-phpredis-5a07edc$ ./configure
gao@gao-VirtualBox:/tmp/owlient-phpredis-5a07edc$ ./config
bash: ./config: 没有那个文件或目录
gao@gao-VirtualBox:/tmp/owlient-phpredis-5a07edc$ ./configure
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
checking for PHP extension directory... /usr/lib/php5/20090626+lfs
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable redis support... yes, shared
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert i686-pc-linux-gnu file names to i686-pc-linux-gnu format... func_convert_file_noop
checking how to convert i686-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) nawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands

gao@gao-VirtualBox:/tmp/owlient-phpredis-5a07edc$ ll
drwxrwxrwt 12 root root   4096  8月 21 10:13 ../
-rw-r--r--  1 gao  gao   76186  8月 21 10:07 acinclude.m4
-rw-rw-r--  1 gao  gao  386725  8月 21 10:07 aclocal.m4
drwxr-xr-x  2 gao  gao    4096  8月 21 10:07 autom4te.cache/
drwxrwxr-x  2 gao  gao    4096  8月 21 10:07 build/
-rw-rw-r--  1 gao  gao    4574  3月  7  2011 common.h
-rwxr-xr-x  1 gao  gao   44826  8月 21 10:07 config.guess*
-rw-rw-r--  1 gao  gao    1837  8月 21 10:13 config.h
-rw-rw-r--  1 gao  gao    1702  8月 21 10:07 config.h.in
-rw-rw-r--  1 gao  gao   20373  8月 21 10:13 config.log
-rwxrwxr-x  1 gao  gao    1683  3月  7  2011 config.m4*
-rwxrwxr-x  1 gao  gao      58  8月 21 10:13 config.nice*
-rwxrwxr-x  1 gao  gao   49403  8月 21 10:13 config.status*
-rwxr-xr-x  1 gao  gao   35454  8月 21 10:07 config.sub*
-rwxrwxr-x  1 gao  gao  399672  8月 21 10:07 configure*
-rw-rw-r--  1 gao  gao    4643  8月 21 10:07 configure.in
-rw-rw-r--  1 gao  gao     160  3月  7  2011 CREDITS
drwxrwxr-x  2 gao  gao    4096  3月  7  2011 debian/
-rw-rw-r--  1 gao  gao     307  3月  7  2011 debian.control
-rw-rw-r--  1 gao  gao       0  8月 21 10:13 .deps
drwxrwxr-x  2 gao  gao    4096  3月  7  2011 igbinary/
drwxrwxr-x  2 gao  gao    4096  8月 21 10:13 include/
-rw-rw-r--  1 gao  gao       0  8月 21 10:07 install-sh
-rw-rw-r--  1 gao  gao   32348  3月  7  2011 library.c
-rw-rw-r--  1 gao  gao    3165  3月  7  2011 library.h
-rwxrwxr-x  1 gao  gao  293280  8月 21 10:13 libtool*
-rw-r--r--  1 gao  gao  283680  8月 21 10:07 ltmain.sh
-rw-rw-r--  1 gao  gao    8792  8月 21 10:13 Makefile
-rw-rw-r--  1 gao  gao       0  8月 21 10:13 Makefile.fragments
-rw-r--r--  1 gao  gao    5498  8月 21 10:07 Makefile.global
-rw-rw-r--  1 gao  gao    1911  8月 21 10:13 Makefile.objects
-rw-rw-r--  1 gao  gao       0  8月 21 10:07 missing
-rwxrwxr-x  1 gao  gao     636  3月  7  2011 mkdeb-apache2.sh*
-rw-rw-r--  1 gao  gao       0  8月 21 10:07 mkinstalldirs
drwxrwxr-x  2 gao  gao    4096  8月 21 10:13 modules/
-rwxrwxr-x  1 gao  gao    6817  3月  7  2011 php_redis.h*
-rw-rw-r--  1 gao  gao   58127  3月  7  2011 README.markdown
-rwxrwxr-x  1 gao  gao  152278  3月  7  2011 redis.c*
-rw-rw-r--  1 gao  gao    9744  3月  7  2011 redis_session.c
-rw-rw-r--  1 gao  gao     226  3月  7  2011 redis_session.h
-rw-r--r--  1 gao  gao   75297  8月 21 10:07 run-tests.php
-rw-rw-r--  1 gao  gao     424  3月  7  2011 serialize.list
drwxrwxr-x  2 gao  gao    4096  3月  7  2011 tests/
gao@gao-VirtualBox:/tmp/owlient-phpredis-5a07edc$ make
gao@gao-VirtualBox:/tmp/owlient-phpredis-5a07edc$ make test

Build complete.
Don't forget to run 'make test'.

PHP Deprecated:  Comments starting with '#' are deprecated in /tmp/owlient-phpredis-5a07edc/tmp-php.ini on line 1880 in Unknown on line 0
PHP Deprecated:  Comments starting with '#' are deprecated in /tmp/owlient-phpredis-5a07edc/tmp-php.ini on line 1880 in Unknown on line 0
PHP Deprecated:  Comments starting with '#' are deprecated in /tmp/owlient-phpredis-5a07edc/tmp-php.ini on line 1880 in Unknown on line 0

=====================================================================
PHP         : /usr/bin/php 
PHP_SAPI    : cli
PHP_VERSION : 5.3.10-1ubuntu3.13
ZEND_VERSION: 2.3.0
PHP_OS      : Linux - Linux gao-VirtualBox 3.2.0-67-generic-pae #101-Ubuntu SMP Tue Jul 15 18:04:54 UTC 2014 i686
INI actual  : /tmp/owlient-phpredis-5a07edc/tmp-php.ini
More .INIs  :  
CWD         : /tmp/owlient-phpredis-5a07edc
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2014-08-21 02:16:25
=====================================================================
No tests were run.
gao@gao-VirtualBox:/tmp/owlient-phpredis-5a07edc$ sudo make install

Installing shared extensions:     /usr/lib/php5/20090626+lfs/
gao@gao-VirtualBox:/tmp/owlient-phpredis-5a07edc$ 
 

 9.修改php.ini文件

在 /etc/php5/conf.d/下 新建 redis.ini
# sudo vim redis.ini
; configuration for php Redis moudle
extension=redis.so

重启 fpm
# sudo /etc/init.d/php5-fpm restart

重启 nginx
# service nginx restart

 查看 phpinfo

是否有 redis support

   Redis在make test有使用到tclsh对Redis进行测试,所有需要想将tclsh安装好,如果没有安装的话,在make test过程中会出现如下错误:

1
2
3
4
5
6
7
# make test
cd src && make test
make [1]: Entering directory ` /usr/local/webserver/redis/src '
You need tcl 8.5 or newer in order to run the Redis test
make [1]: *** [ test ] Error 1
make [1]: Leaving directory ` /usr/local/webserver/redis/src '
make : *** [ test ] Error 2

猜你喜欢

转载自gxl-ct001.iteye.com/blog/2106562