1.Redis下载
https://download.redis.io/releases/
2.Redis安装包上传到Linux
下载的安装包通过xshell安装包上传文件,具体看之前写的博客,有详细记载的内容
https://blog.csdn.net/weixin_45428910/article/details/126926082?spm=1001.2014.3001.5502
本文是放在usr/local的文件夹下
3.解压压缩包
tar -xzvf redis-6.2.5.tar.gz
4.安装Redis的依赖环境gcc
yum install gcc-c++
5.进入/usr/local/redis-5.0.0,进项编译
make
6.进入redis的src目录,进行安装
make install
7.启动redis
./redis-server
8.redis.conf文件修改
后台进程方式启动
[root@localhost redis-5.0.0]# vim redis.conf
修改daemonize no 为daemonize yes
9.修改文件后重新在后台启动redis
注意:启动文件在redis-5.0.0的src文件下
[root@localhost redis-5.0.0]# src/redis-server ./redis.conf
1585:C 20 Sep 2022 17:04:49.398 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1585:C 20 Sep 2022 17:04:49.398 # Redis version=5.0.0, bits=64, commit=00000000, modified=0, pid=1585, just started
1585:C 20 Sep 2022 17:04:49.398 # Configuration loaded
[root@localhost redis-5.0.0]# cd src
[root@localhost src]# ./redis-cli
127.0.0.1:6379>
补充:
1)redis是默认端口,以及Redis本身没有设置密码,如果需要修改的话,在src/conf文件进行设置
本文仅修改密码,端口号方法相同
[root@localhost redis-5.0.0]# vim redis.conf
2)杀掉进程
ps -aux|grep redis
kill -9 1586
3)重新启动
[root@localhost redis-5.0.0]# src/redis-server ./redis.conf
1780:C 20 Sep 2022 17:30:25.853 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1780:C 20 Sep 2022 17:30:25.853 # Redis version=5.0.0, bits=64, commit=00000000, modified=0, pid=1780, just started
1780:C 20 Sep 2022 17:30:25.853 # Configuration loaded
4)密码修改后确认
[root@localhost redis-5.0.0]# src/redis-cli
127.0.0.1:6379> keys *
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth 123456
OK
127.0.0.1:6379> exit
//确认端口号的 localhost -p 6379
[root@localhost redis-5.0.0]# src/redis-cli -h localhost -p 6379
localhost:6379> keys *
(error) NOAUTH Authentication required.
localhost:6379> auth 123456
OK
本文含有隐藏内容,请 开通VIP 后查看