CentOS 6.5安装 Redis

2015-01-21 12:14:04 · 作者: · 浏览: 2

版本:redis-2.8.19.tar.gz


检查下面依赖是否安装,如果没有要先安装,不然会有异常。


yum installgcc-c++


yum install -y tcl。


1、获取安装文件


redis-2.8.19.tar.gz


http://redis.io/download


2、解压文件


tar -xzvf redis-2.8.19.tar.gz


mv redis-2.8.19? /usr/local/redis


3、进入目录


cd redis


4、编译


make


5、安装


make install


6、设置配置文件路径


mkdir -p /etc/redis


cp redis.conf/etc/redis


7、修改配置文件


vi /etc/redis/redis.conf


仅修改: daemonize yes


8、启动


/usr/local/bin/redis-server/etc/redis/redis.conf


9、查看启动


ps -ef | grep redis?


10、使用客户端


redis-cli


>set namedavid


OK


11.关闭客户端


redis-cli? shutdown


12.异常及解决方法


异常一:


make[2]: cc:Command not found


异常原因:没有安装gcc


解决方案:yum install gcc-c++


异常二:


zmalloc.h:51:31:error: jemalloc/jemalloc.h: No such file or directory


异常原因:一些编译依赖或原来编译遗留出现的问题


解决方案:make distclean。清理一下,然后再make。


在make成功以后,需要make test。在make test出现异常。


异常一:


couldn'texecute "tclsh8.5": no such file or directory


异常原因:没有安装tcl


如果不先安装tcl在编译redis的时候,执行make test 会报以下错误,这步也可以省略,不执行make test 直接执行make install 对redis的启动和关闭没有什么影响。
[root@localhostredis]# make test
cd src &&make test
make[1]: Enteringdirectory `/usr/local/webserver/redis/src'
You need tcl 8.5 ornewer in order to run the Redis test
make[1]: *** [test]Error 1
make[1]: Leavingdirectory `/usr/local/webserver/redis/src'
make: *** [test]Error 2