centos7 安装 redis
1. 下载redis
下载3.0 : wget http://download.redis.io/releases/redis-3.0.0.tar.gz
解压 : tar zxvf redis-3.0.0.tar.gz
2. centos7安装redis之前需要安装必要依赖包
安装gcc: yum install gcc
3. 编译redis
#需要加参数,否则会报错
make MALLOC=libc
4. 启动redis
进入src目录运行: redis-server
默认端口是6379,可通过--port 指定端口
启动成功之后可以看到类似一下信息:
36152:M 19 Sep 20:21:27.200 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
36152:M 19 Sep 20:21:27.200 * The server is now ready to accept connections on port 6379
5. 测试redis
运行src下:redis-cli
可以看到类似:
$ ./redis-cli
127.0.0.1:6379> set isok true
OK
127.0.0.1:6379> get isok
"true"
127.0.0.1:6379>
6.关闭redis
src 目录下运行 : redis-cli shutdown