CentOS安装redis
2021/10/19 19:11:47
本文主要是介绍CentOS安装redis,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
- 下载redis包,重命名
[root@localhost package]# wget https://download.redis.io/releases/redis-6.2.1.tar.gz?_ga=2.190205099.1022875253.1615369411-796346632.1615369411 [root@localhost package]# ls redis-6.2.1.tar.gz?_ga=2.190205099.1022875253.1615369411-796346632.1615369411 [root@localhost package]# mv redis-6.2.1.tar.gz\?_ga\=2.190205099.1022875253.1615369411-796346632.1615369411 redis-6.2.1.tar.gz
- 安装依赖
[root@localhost redis-6.2.1]# yum install cpp binutils glibc glibc-kernheaders glibc-common glibc-devel gcc make -y
- 创建安装目录并解压
[root@localhost package]# mkdir -p /snt/soft/redis [root@localhost package]# tar -xzvf redis-6.2.1.tar.gz -C /snt/soft/redis
- 编译
[root@localhost package]# cd /snt/soft/redis/redis-6.2.1 [root@localhost redis-6.2.1]# make [root@localhost redis-6.2.1]# make PREFIX=/snt/soft/redis/redis-install install #安装到/snt/soft/redis/redis-install目录下
- 拷贝redis.conf
[root@localhost redis-6.2.1]# cp /snt/soft/redis/redis-6.2.1/redis.conf /snt/soft/redis/redis-install/bin/
- 修改配置
[root@localhost redis-6.2.1]# cd /snt/soft/redis/redis-install/bin/ [root@localhost bin]# vim redis.conf daemonize yes(后台启动) bind 0.0.0.0(其他服务器能访问) protected-mode no(供外网访问)
- 启动
[root@localhost bin]# ./redis-server ./redis.conf
- 查看进程
ps aux|grep redis
- 测试
$ ./redis-cli redis> set foo bar OK redis> get foo "bar"
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-madSMX2r-1634633909342)(http://192.168.10.61:9001/server/…/Public/Uploads/2021-03-10/60489864b7c1e.png)]
这篇关于CentOS安装redis的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-08阿里云Redis项目实战入门教程
- 2024-11-08阿里云Redis资料:新手入门与初级使用指南
- 2024-11-08阿里云Redis教程:新手入门及实用指南
- 2024-11-07阿里云Redis学习入门:新手必读指南
- 2024-11-07阿里云Redis学习入门:从零开始的操作指南
- 2024-11-07阿里云Redis学习:初学者指南
- 2024-11-06阿里云Redis入门教程:轻松搭建与使用指南
- 2024-11-02Redis项目实战:新手入门教程
- 2024-10-22Redis入门教程:轻松掌握数据存储与操作
- 2024-10-22Redis缓存入门教程:快速掌握Redis缓存基础知识