Redis — CentOS6.4安装Redis以及安装PHP客户端phpredis
一、安装Redis
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
make
出现 “-bash:make:command not find”错误
解决方法:
rpm -qa | grep make
提示只安装了automake包
yum install make
yum install imake
OK!
make /*再次编译*/
4.编译测试
make test
提示“You need tcl 8.5 or newer in order to run the Redis test”错误
解决方法:
安装tcl
wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
cd tcl8.6.1-src
cd unix
./configure --prefix=/usr \
--without-tzdata \
--mandir=/usr/share/man \
$([ $(uname -m) = x86_64 ] && echo --enable-64bit) &&
make &&sed -e "s@^\(TCL_SRC_DIR='\).*@\1/usr/include'@" \
-e "/TCL_B/s@='\(-L\)\?.*unix@='\1/usr/lib@" \
-i tclConfig.shmake install &&
make install-private-headers &&
ln -v -sf tclsh8.6 /usr/bin/tclsh &&
chmod -v 755 /usr/lib/libtcl8.6.so
再次测试编译
cd redis-2.8.6
make test
4.配置redis
vim redis.conf
daemonize yes #使得进程在后台运行
dir /usr/lcoal/redis/db #磁盘存储redis数据库文件位置
5.启动redis
cd src
./redis-server
提示“Warning: no config file specified,using the default config.In order to specify a config file use ./redis-server /path/to/redis.conf”以及“WARNING overcommit_memory is set to 0!Background save may fail under low memory condition.To fix this issue add 'vm.overcommit_memory=1' to /etc/sysctl.conf....“两个警告
安装提示操作:
①修改sysctl文件,/sbin/sysctl -p,使修改生效
②./redis-server /etc/redis.conf 以这种方式启动redis服务 (我将配置文件移到了/etc目录下)
6.体验redis
> cd src
> ./redis-cli #启动redis客户端
> ping
PONG
> set foo bar
OK
> get foo
"bar"
> incr mycounter
(integer) 1
> incr mycounter
(integer) 2
7.安装redis
将redis二进制文件安装在/usr/local/bin目录
make install
8.redis安全
进入redis客户端默认无需密码,可通过配置文件修改密码
① vim /etc/redis.conf
加上:requirepass cJHzy2Z2T8csYspcwwsODHApNko9tg
② 重启redis
kill 26743(redis进程号)
/usr/local/bin/redis-server /etc/redis.conf
③ 使用redis
/usr/local/bin/redis-cli 也可/usr/local/bin/redis-cli -a 密码 进入客户端
> set h2 helloworld
(error) NOAUTH Authentication required.
> auth cJHzy2Z2T8csYspcwwsODHApNko9tg
OK
> get h2
(nil)
> set h3 abc
> get h3
"abc"
也可通过config set命令动态修改密码
> config get requirepass
1) "requirepass"
2) "cJHzy2Z2T8csYspcwwsODHApNko9tg"
> config set requirepass UHLc565HXduJ5730g8tAcsvNxRUQhY
OK
> auth UHLc565HXduJ5730g8tAcsvNxRUQhY
> set h6 kkkkk
OK
> get h6
"kkkkk"
> exit
查看配置文件,还是原密码,表示config未保存至配置文件
requirepass cJHzy2Z2T8csYspcwwsODHApNko9tg
二、安装redis的php客户端
1.安装git
yum install git
git clone https://github.com/nicolasff/phpredis.git
2.用phpize扩展php扩展模块
/usr/bin/phpize
出现”Cannot find config.m4.Make sure that you run '/usr/bin/phpize' in the top level source direcotory of the module“错误
解决方法:
wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
tar -zvxf m4-1.4.9.tar.gz
cd m4-1.4.9/
./configure && make && make install
还是不行,接着
cd phpredis
/usr/bin/phpize (里面有config.m4所以可以使用phpize)
ok!
3.配置
./configure --with-php-config=/usr/bin/php-config
4.编译和安装
make && make install
5.修改php的配置文件
cd/etc/php.d
vim redis.ini
加上extension=redis.so
6.重启apache
service httpd restart
7.测试
phpinfo();查看redis是否正确安装
三、参考资料
redis官网 http://redis.io/
redis命令 http://redis.io/commands
tcl安装 http://www.linuxfromscratch.org/blfs/view/cvs/general/tcl.html
通过epel 安装redis http://blog.sina.com.cn/s/blog_6364150101019701.html
http://www.codesky.net/article/201110/170019.html
EPEL(Extra Packages for Enterprise Linux) http://fedoraproject.org/wiki/EPEL
Redis — CentOS6.4安装Redis以及安装PHP客户端phpredis的更多相关文章
- centos6.7用yum安装redis解决办法及IP限制配置
在centos6.7用yum安装redis解决办法 - bluesky1 - 博客园 http://www.cnblogs.com/lanblogs/p/6104834.html yum instal ...
- centos6.5环境Redis下载及编译安装
centos6.5环境Redis下载及编译安装 1:官方站点: http://redis.io/download 下载最新版或者最新stable版 2:解压源码并进入目录 tar -zxvf redi ...
- centos6.8下redis的安装和配置
centos6.8下redis的安装和配置 下载.安装 在redis官网可以获取到最新版本的redis 进入/usr/local/目录,执行如下命令 wget http://download.redi ...
- centos6.3下yum安装redis
我得是centos 6.3,如果直接用yum安装redis,报错,如下: [root@CentOS6 etc]# yum install redis Loaded plugins: fastestmi ...
- Centos6.10编译安装php-7.1.12并安装redis模块
1.服务器初始化 yum update -yyum install epel-release -yyum install gcc gcc-c++ wget lsof lrzsz telnet -y 2 ...
- CentOS6.9安装redis
目录 Centos6.9下的Redis安装和配置(最简易方式) redis客户端登录方式 Centos6.9下的Redis安装和配置(最简易方式) 在服务器上创建一个目录/service,然后下载re ...
- centos6.7安装Redis
1.创建安装目录 mkdir /usr/local/redis cd /usr/local/src 2.获取安装包:wget http://download.redis.io/releases/red ...
- 在centos6.7用yum安装redis解决办法
1. centos默认的安装源在官方centos.org上,而Redis在第三方的yum源里,所以无法安装,非官方的yum推荐用fedora的epel仓库 [root@localhost instal ...
- Centos6 安装 Redis
先确认gcc和tcl已经安装 sudo yum install gcc-c++ sudo yum install tcl 解压, 编译和安装 .tar.gz /usr/src/ cd /usr/src ...
- 在centos6.3用yum安装redis
一.centos默认的安装源在官方centos.org上,而redis在第三方的yum源里,所以无法安装,非官方的yum推荐用fedora的epel仓库.当然也可通过配置 /etc/yum.repos ...
随机推荐
- [Whole Web] [AngularJS + Grunt] Using ng-html2js to Convert Templates into JavaScript
ng-html2js takes .html templates and converts them into strings stored in AngularJS's template cache ...
- 多项式逼近remes算法
http://wenku.baidu.com/link?url=gpaBIucx0ov0ez3QHrO4FooBtNz2i80s4LKsh-LV3NnPYNjTUu7e1V7bT_jMHwOUZk4X ...
- 【转】GitHub平台最火Android开源项目整理——2013-08-25 17
http://game.dapps.net/news/developer/9199.html GitHub在中国的火爆程度无需多言,越来越多的开源项目迁移到GitHub平台上.更何况,基于不要重复造轮 ...
- 【Unicode】字符编码表信息
UTF-8有点类似于Haffman编码,它将Unicode编码为:0x00-0x7F的字符,用单个字节来表示:0x80-0x7FF的字符用两个字节表示:0x800-0xFFFF的字符用3字节表示: ...
- shell记录
查看linux服务器有哪些人曾经ssh登陆过,以及他们的登录信息 who查看当前正在ssh链接中的 last查看最近被链接过的 who last netstat -nltp -an ...
- php插件机制实现原理
插件,亦即Plug-in,是指一类特定的功能模块(通常由第三方开发者实现) 它的特点: 1. 随时安装.卸载.激活.禁用 2. 无论什么状态都不影响系统核心模块的运行, 3. 是一种非侵入式的模块化设 ...
- 【转】企业级Java应用最重要的4个性能指标
应用性能管理(APM)是一种即时监控以实现对应用程序性能管理和故障管理的系统化解决方案.目前主要指对企业的关键业务应用进行监测.优化,最终达到提高企业应用的可靠性和质量,保证用户得到良好的服务,降低I ...
- 20160420javaweb之文件上传和下载
一.文件上传 1.提供表单允许用户通过表单选择文件进行上传 表单必须是POST提交 文件输入框必须有name属性,只有有name属性的输入项浏览器才会进行提交 需要设置enctype属性值为multi ...
- 20160329javaweb之JSP -cookie入门
一.什么是会话? •会话可简单理解为:用户开一个浏览器,点击多个超链接,访问服务器多个web资源,然后关闭浏览器,整个过程称之为一个会话. 会话过程中要解决的一些问题? •每个用户在使用浏览器与服务器 ...
- c语言学习之基础知识点介绍(十二):结构体的介绍
一.结构体的介绍 /* 语法: struct 结构体名{ 成员列表; }; 切记切记有分号! 说明:成员列表就是指你要保存哪些类型的数据. 注意:上面的语法只是定义一个新的类型,而这个类型叫做结构体类 ...