CentOS安装Redis

wget http://download.redis.io/redis-stable.tar.gz

tar xvzf redis-stable.tar.gz

cd redis-stable

make

前面3步应该没有问题,主要的问题是执行make的时候,出现了异常。

异常一:

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't execute "tclsh8.5": no such file or directory

异常原因:没有安装tcl

解决方案:yum install -y tcl。

可以使用类似 ./redis-server /path/to/redis.conf 命令指定配置文件;

Server started, Redis version 2.8.13
The server is now ready to accept connections on port 6379

服务启动成功,服务已经在6379端口上监听连接请求。

你可以使用内置的客户端连接Redis:http://www.redis.cn/download.html

$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"

具体redis命令参考: http://www.runoob.com/redis/redis-commands.html





原文地址:https://www.cnblogs.com/bincoding/p/6156290.html