centos安装redis

下载地址:https://codeload.github.com/redis/redis/tar.gz/refs/tags/7.0.7
1、解压

sudo tar -zxvf redis-7.0.7.tar.gz -C /usr/local/redis/

2、进入到该目录中:

cd /usr/local/redis/redis-7.0.7

3、执行 make 命令进行编译(如果有cc:找不到命令保错,试试yum -y install gcc automake autoconf libtool make和make MALLOC=libc )

[root@localhost redis-7.0.7]# make

4、make 完成后继续执行 make install 进行安装

[root@localhost redis-7.0.7]# make install 

至此可以换到src文件夹下,先启动Redis服务看看

[root@localhost redis-7.0.7]# cd src
[root@localhost src]# ./redis-server

5、也可以让服务在后台启动,修改 redis.conf 文件,将里面的 daemonize no 改成 yes,

 [root@localhost redis-7.0.7]# vi redis.conf 
image.png

6、通过redis-server redis.conf命令启动redis

[root@localhost redis-7.0.7]# redis-server redis.conf

7、通过 redis-cli 命令进入到控制台

[root@localhost redis-7.0.7]# redis-cli 
127.0.0.1:6379> ping

8、通过 shutdown 命令我们可以关闭实例
9、通过exit退出客户端

127.0.0.1:6379> shutdown
not connected> exit
[root@localhost redis-7.0.7]#  
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容