1.本教程使用的最新文档版本为5.0.3,下载并安装:
[root@localhost src]# wget http://download.redis.io/releases/redis-5.0.3.tar.gz
[root@localhost src]# tar xzf redis-5.0.3.tar.gz -C /usr/local/ #解压到/usr/loca下
[root@localhost src]# cd /usr/local/redis-5.0.3/
[root@localhost redis-5.0.3]# make
2.make完后 redis-5.0.3目录下会出现编译后的redis服务程序redis-server,还有用于测试的客户端程序redis-cli,两个程序位于安装目录 src 目录下
![](https://i-blog.csdnimg.cn/blog_migrate/40c77bff4e8900eca8301934fd3e0410.png)
3.redis基本配置
[root@localhost redis-5.0.3]# vim /usr/local/redis-5.0.3/redis.conf
1.修改文件中的 daemonize no 为 daemonize yes #解释使用守护进程启动
2.在文件中添加 requirepass emans #增加账户密码,密码为emans
![](https://i-blog.csdnimg.cn/blog_migrate/00e780141a3e4a3b3acde50ca135d79d.png)
![](https://i-blog.csdnimg.cn/blog_migrate/feae02403e447568fdeedb0ba860e665.png)
![](https://i-blog.csdnimg.cn/blog_migrate/227ff480114c6ba3e496328a5c6e8bc0.png)
至此redis安装及基本配置完成
[root@localhost redis-5.0.3]# /usr/local/redis-5.0.3/src/redis-server ./redis.conf
28536:C 11 Mar 2019 08:05:41.954 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
28536:C 11 Mar 2019 08:05:41.954 # Redis version=5.0.3, bits=64, commit=00000000, modified=0, pid=28536, just started
28536:C 11 Mar 2019 08:05:41.954 # Configuration loaded
[root@localhost redis-5.0.3]# /usr/local/redis-5.0.3/src/redis-cli
127.0.0.1:6379> auth emans
OK
127.0.0.1:6379> dbsize
(integer) 0
127.0.0.1:6379>
Redis自启动与脚本配置:https://mp.csdn.net/console/editor/html/88412294