一、版本说明


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. BZOJ5379: Tree

    BZOJ5379: Tree Description JudgeOnline/upload/201806/1.pdf 题解Here! 题目大意就是:1. 换根.2. 对$LCA(u,v)$的子树修改. ...

  2. IRRIGATION LINES

    IRRIGATION LINES Time Limit: 2000ms, Special Time Limit:5000ms, Memory Limit:65536KB Total submit us ...

  3. Codeforces Round #106 (Div. 2) D. Coloring Brackets —— 区间DP

    题目链接:https://vjudge.net/problem/CodeForces-149D D. Coloring Brackets time limit per test 2 seconds m ...

  4. Silverlight实用窍门系列:1.Silverlight读取外部XML加载配置---(使用WebClient读取XAP包同目录下的XML文件))【附带实例源码】

    使用WebClient读取XAP包同目录下的XML文件 我们想要读取XAP包下面的XML文件,需要将此XML文件放在加载XAP包的网页的目录中去,然后使用URI方式读取此URL方式下的XML文件. 首 ...

  5. 书写优雅的shell脚本(三) - shell中exec解析

    参考:<linux命令.编辑器与shell编程> <unix环境高级编程> exec和source都属于bash内部命令(builtins commands),在bash下输入 ...

  6. codeforces 669E E. Little Artem and Time Machine(节点为map型的线段树)

    题目链接: E. Little Artem and Time Machine time limit per test 2 seconds memory limit per test 256 megab ...

  7. 09:LGTB 学分块

    总时间限制:  10000ms 单个测试点时间限制:  1000ms 内存限制:  65536kB 描述 LGTB 最近在学分块,但是他太菜了,分的块数量太多他就混乱了,所以只能分成 3 块 今天他得 ...

  8. Java中gcRoot和引用类型

    看到一个老问题,Java是如何判定回收哪些对象的? 答:从gcRoot根搜索不可达,且标记清理一次之后仍没有被复活的对象,会被认定为垃圾对象进行清理.注意在Java中没有对象的作用域,只有对象的引用的 ...

  9. 嵌入式Linux学习方法——给那些彷徨者(下)

    上一章解决了嵌入式Linux的“学什么”问题,这一章则具体来说一下“怎么学”. 只要做好以下3点: 1.学习顺序.学习任何东西都应该由浅入深,不能一口吃下一个大胖子,得循序渐进.很多刚开始想学习Lin ...

  10. logging日志类

    #! /usr/bin/env python #coding=utf-8 import logging,os class Logger: def __init__(self, path,clevel ...