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目录下

CentOS安装redis

  • 拷贝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)]

上一篇:阿里云主机搭建hexo博客


下一篇:[java][kettle]在Linux上面kettle-spoon启动问题