下载解压 ``` cd /usr/local ``` ``` wget https://download.redis.io/releases/redis-6.2.14.tar.gz ``` ``` tar -zvxf redis-6.2.14.tar.gz ``` ``` cd /usr/local/redis-6.2.14 ``` 编译安装 ``` make ``` ``` make install ``` ``` mkdir /etc/redis ``` ``` cp /usr/local/redis-6.2.14/redis.conf /etc/redis ``` 修改配置项 ``` vim /etc/redis/redis.conf ``` 后台运行 ``` daemonize 改成 yes ``` 启动 ``` cd /usr/local/redis-6.2.14/bin ``` ``` redis-server /etc/redis/redis.conf ``` 进入控制台 ``` cd /usr/local/redis-6.2.14/bin ``` ``` redis-cli ``` 设置访问密码(可选)把`123456`替换成你想设置的密码 ``` config set requirepass "123456" ``` 登录 ``` auth "123456" ``` 验证密码 ``` config get requirepass ```