一、版本说明


CentOS版本

[plain]view plaincopyprint?

  1. [root@localhost ~]# uname

  2. Linux

  3. [root@localhost ~]# uname -r

  4. 2.6.32-431.el6.i686

  5. [root@localhost ~]# uname -a

  6. Linux localhost 2.6.32-431.el6.i686 #1 SMP Fri Nov 22 00:26:36 UTC 2013 i686 i686 i386 GNU/Linux

  7. [root@localhost ~]# cat /etc/centos-release

  8. CentOS release 6.5 (Final)

Redis的版本

请到redis的官网下载最新的 http://redis.io/download

这里我们下载不是最新的稳定版的2.8.6,3.0.0因为是Beta版本所以不推荐生产环境使用,开发环境尝鲜还是可以的。

phpredis的版本

这里通过 redis官网的 http://redis.io/clients 找到PhpRedis 去github上就能找到啦 https://github.com/nicolasff/phpredis ,这里显示的版本是2.2.4 。

二、安装


1.安装redis

安装教程在redis的官网上就有,这里详细讲一下。

wget

下载网上的资源需要用到wget工具,有的同学的服务器可能是新装的还没有来得及装(比如我。。。)

[plain]view plaincopyprint?

  1. #安装wget

  2. yum install wget

ok,然后开始安装redis,顺便说一句,连接外国网站真是慢的不得了,两三次下载都卡住了 = =

[plain]view plaincopyprint?

  1. $ wget http://download.redis.io/releases/redis-2.8.6.tar.gz

  2. $ tar xzf redis-2.8.6.tar.gz

  3. $ cd redis-2.8.6

  4. $ make

make错误

然后。QAQ,make的时候又出现了错误

[plain]view plaincopyprint?

  1. make[3]: gcc:命令未找到

安装gcc

看来没有安装gcc....

[plain]view plaincopyprint?

  1. #安装gcc

  2. yum install gcc gcc-c++ kernel-devel

再次make错误

然后安装的时候又发现出现了错误

[plain]view plaincopyprint?

  1. zmalloc.h:50:31: 错误:jemalloc/jemalloc.h:没有那个文件或目录

  2. zmalloc.h:55:2: 错误:#error "Newer version of jemalloc required"

然后去百度了,解决方案为

[plain]view plaincopyprint?

  1. make MALLOC=libc

make完成

接下来就是耐心等待,下面是我看到的结果。

[plain]view plaincopyprint?

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

  2. make[1]: Leaving directory `/root/redis-2.8.6/src'

这样就算安装完成了。

启动redis服务

请注意,如果你在make的时候出现上述的问题,那么,在启动redis服务的时候就要注意了

[plain]view plaincopyprint?

  1. #官方网站提示这样启动服务

  2. src/redis-server

  3. #但是出现了上面的问题后,请用下面的方式启动redis服务

  4. nohup src/redis-server redis.conf &

启动redis服务完成。

简单测试

下面是简单测试。

[plain]view plaincopyprint?

  1. [root@localhost redis-2.8.6]# src/redis-cli

  2. 127.0.0.1:6379> ping

  3. PONG

2.安装PhpRedis

phpize

phpredis属于php扩展,所以需要phpize,如果你的服务器没有安装phpize,要先安装

[plain]view plaincopyprint?

  1. #安装phpize

  2. yum install php-devel

下载源码包

直接用wget好了

[plain]view plaincopyprint?

  1. #wget下载github上的文件

  2. wget https://github.com/nicolasff/phpredis/archive/master.zip

unzip

下面要解压zip文件,首先,你,要,有个,unzip....

[plain]view plaincopyprint?

  1. #安装了这么多的软件,想想也该知道怎么装这个东西了吧

  2. yum install unzip

[plain]view plaincopyprint?

  1. #解压

  2. unzip master.zip

编译

下面正式开始编译php扩展

[plain]view plaincopyprint?

  1. #1.准备phpize编译环境

  2. [root@localhost phpredis-master]# phpize

  3. Configuring for:

  4. PHP Api Version:         20090626

  5. Zend Module Api No:      20090626

  6. Zend Extension Api No:   220090626

再次ls就会发现文件夹中多了几个配置文件

[plain]view plaincopyprint?

  1. #2.配置环境

  2. ./configure

这个步骤会将上一步准备好的配置文件进行执行

[plain]view plaincopyprint?

  1. #3.编译

  2. make && make install

balabala...........

[plain]view plaincopyprint?

  1. #编译完成

  2. Build complete.

  3. Don't forget to run 'make test'.

  4. Installing shared extensions:     /usr/lib/php/modules/

进入/usr/lib/php/modules 文件夹,发现redis.so的扩展。

修改php.ini

[plain]view plaincopyprint?

  1. [root@localhost phpredis-master]# vi /etc/php.ini

添加下面的扩展

[plain]view plaincopyprint?

  1. extension=redis.so

重启服务器

[plain]view plaincopyprint?

  1. [root@localhost modules]# service httpd restart

  2. 停止 httpd:                                               [确定]

  3. 正在启动 httpd:                                           [确定]

查看phpinfo

三、总结

借用《七日七数据库》中的一句话,redis就像是无处不在的润滑油。

简单,快速。

我们从小到大,正是因为经历了足够多的事情才会成长。

CentOS6.5下安装Redis2.8.6和phpredis2.2.4扩展的更多相关文章

  1. 【转载】CentOS6.5_X64下安装配置MongoDB数据库

    [转载]CentOS6.5_X64下安装配置MongoDB数据库 2014-05-16 10:07:09|  分类: 默认分类|举报|字号 订阅      下载LOFTER客户端 本文转载自zhm&l ...

  2. CentOS6.5下安装apache2.2和PHP 5.5.28

    CentOS6.5下安装apache2.2 1. 准备程序 :httpd-2.2.27.tar.gz 下载地址:http://httpd.apache.org/download.cgi#apache2 ...

  3. CentOS6.5下安装配置MySQL

    CentOS6.5下安装配置MySQL,配置方法如下: 安装mysql数据库:# yum install -y mysql-server mysql mysql-deve 查看mysql-server ...

  4. CentOS6.5下安装Apache2.4+PHP7

    CentOS6.5下安装Apache2.4+PHP7 http://blog.csdn.net/along602/article/details/42695779 http://www.th7.cn/ ...

  5. 在CentOS6.8下安装Docker

    在CentOS6.8下安装Docker 一.查看系统版本 [root@localhost opt]# uname -a Linux localhost.localdomain -.el6.x86_64 ...

  6. coreseek/sphinx CentOS6.4下安装

    一.在CentOS6.4下安装coreseek之前需要预先安装以下软件 1.打开终端 输入 su 获取管理员权限 2.输入命令 yum install make gcc g++ gcc-c++ lib ...

  7. 建站笔记1:centos6.5下安装mysql

    近期买了个域名,想要玩玩自己建站点:接下来遇到的问题都会一次记录下来.以备自己以后复习查看: 首先建站方案选择: wordPress +centos6.5 +mysql; server买的:搬瓦工最低 ...

  8. centos6.7下安装配置vnc

    vnc是一款使用广泛的服务器管理软件,可以实现图形化管理,下面简单介绍一下如何在centos6.7下安装vnc. 1.安装vncserver yum install tigervnc tigervnc ...

  9. CentOS6.5下安装JDK1.7+MYSQL5.5+TOMCAT7+nginx1.7.5环境安装文档

    ----------------CentOS6.5下安装JDK1.7+MYSQL5.5+TOMCAT7+nginx1.7.5环境安装文档----------------------- [JDK1.7安 ...

随机推荐

  1. navcat for mysql 连接远程数据库 教程

    1.首先进入数据库: mysql -uroot -p 2.然后打开数据库设置远程连接权限: mysql>GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'ID ...

  2. i2c_set_clientdata函数【转】

    本文转载自‘:http://blog.csdn.net/jk198310/article/details/43738367 在i2c驱动中有很多函数和数据结构,很多一时难以理解,所以写下本文共同学习. ...

  3. iOS NSString拼接字符串

    NSString* str_C; // 结果字符串NSString* str_A, str_B; //已存在的字符串,需要将str_A和str_B连接起来 //方法1 str_C = [NSStrin ...

  4. ASP.NET统计图表控件

    近来客户需要将前段时间开发的统计信息用图表展示出来,还要多个图表类型,例如:柱状图.饼图.曲线图.三维图等等.在网上google了一下,发现了三个(也许更多)可以使用的控件.下面我们一起看看这三个控件 ...

  5. OpenCV坐标系与操作像素的四种方法

    像素是图像的基本组成单位,熟悉了如何操作像素,就能更好的理解对图像的各种处理变换的实现方式了. 1.at方法 第一种操作像素的方法是使用"at",如一幅3通道的彩色图像image的 ...

  6. vue 使用font-awesome 只需两步

    npm 安装font-awesome 以及需要的所有依赖 cnpm install less less-loader css-loader style-loader file-loader font- ...

  7. iconMoon---小图标小记

    IcoMoon 是一个免费的图标库.可以下载自己需要的图标 三.使用流程.操作演示 进入主页,点击下图所示区域开始: 每个图标你都是可以自己进行标记的(移上去会看到Edit, 点击之),然后—— 注: ...

  8. 在头文件#pragma comment(lib,"glaux.lib");编译器提示waring C4081: 应输入“newline“

    在头文件#pragma comment(lib,"glaux.lib");编译器提示waring C4081: 应输入“newline“ #行不能加分号的

  9. Eclipse安装配置Maven

    Eclipse安装配置Maven 1 安装配置Maven 1.1 下载Maven 从Apache网站 http://maven.apache.org/ 下载并且解压缩安装Apache Maven.   ...

  10. python学习笔记3-循环1

    1 while break continue #while语句 ''' while 判断条件: 执行语句…… ''' count = 0 while (count < 9): print ('T ...