一、版本说明


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. object equal

    package equals; public class EqualsTest { public static void main(String[] args) { Employee alice1 = ...

  2. poj 1821 Fence(单调队列优化DP)

    poj 1821 Fence \(solution:\) 这道题因为每一个粉刷的人都有一块"必刷的木板",所以可以预见我们的最终方案里的粉刷匠一定是按其必刷的木板的顺序排列的.这就 ...

  3. mysql数据库引擎InnoDB和MyISAM的区别

    InnoDB支持行级锁和表级锁(默认行级锁),支持事务,外部键等:大量的insert和update更快等.只有通过索引条件检索数据,InnoDB 才使用行级锁,否则,InnoDB 将使用表锁. MyI ...

  4. 传统maven项目创建

    转自:https://blog.csdn.net/wangfengtong/article/details/77098238 需求表均同springmvc案例 此处只是使用maven 注意,以下所有需 ...

  5. usaco2008 nov 区间异或求和

    Problem 11: Switching Lights [LongFan, 2008] Farmer John tries to keep the cows sharp by letting the ...

  6. jquery清空div里所有input输入框的值

    $("#divId input").val("");

  7. 使用TextView实现跑马灯的效果

    1.定义textView标签的4个属性: android:singleLine="true"//使其只能单行 android:ellipsize="marquee&quo ...

  8. HAOI2012高速公路——子区间计算

    题目:https://www.luogu.org/problemnew/show/P2221 似乎按点来算贡献很方便,但我抱住一篇没有这样的题解磕了两天... 以下转载: 题意:维护一段数列 支持区间 ...

  9. PYTHON路线图

    路线图: 第一部分:Python语言基础 第二部分:数据库开发 第三部分:web前端 第四部分:Python web开发 第五部分:Python web项目 第六部分:Linux 第七部分:NoSQL ...

  10. Elasticsearch 安装配置 外网访问 及 后台启动

    本文转自http://www.jianshu.com/p/658961f707d8 作者:咪博士 感谢咪博士分享 Elasticsearch的安装总体来说还是相当简单的,当然中间也会有些小坑.不过大家 ...