centos 6.5安装 redis

时间:2023-03-09 08:27:44
centos 6.5安装 redis

版本:redis-2.8.19.tar.gz

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

yum install gcc-c++

yum install -y tcl。

、获取安装文件

redis-2.8.19.tar.gz

http://redis.io/download

、解压文件

tar -xzvf
redis-2.8.19.tar.gz

mv
redis-2.8.19  /usr/local/redis

、进入目录

cd redis

、编译

make

、安装

make install

、设置配置文件路径

mkdir -p /etc/redis

cp redis.conf/etc/redis

、修改配置文件

vi /etc/redis/redis.conf





仅修改: daemonize yes

、启动

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

、查看启动

ps -ef | grep redis

、使用客户端

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

版权声明:本文为博主原创文章,未经博主允许不得转载。