【https://redis.io/download】redis
$ wget http://download.redis.io/releases/redis-5.0.2.tar.gz $ tar xzf redis-5.0.2.tar.gz $ cd redis-5.0.2 $ make
注意:腾讯云安装可能会报错提示没有gcc
阿里云上直接会安装gcc,安装gcc:测试
yum install gcc+ gcc
band:0.0.0.0 若是须要给外网链接该配置该成0.0.0.0【生产环境不建议开放】
port 6379 端口建议该成别的,默认端口容易形成攻击
daemonize yes 容许后台启动ui
src/redis-server redis.conf阿里云
[root@izwz9ezkmfgg9s8ldbi3y5z redis-5.0.2]# src/redis-cli -p 6379 127.0.0.1:6379> config get requirepass 1) "requirepass" 2) "" 127.0.0.1:6379> config set requirepass "123456" OK 127.0.0.1:6379> config get requirepass (error) NOAUTH Authentication required. 127.0.0.1:6379>
config get requirepass 查看当前密码
config set requirepass "123456" 设置密码 设置成功以后再次查看密码会提示没有权限,须要从新链接。code
[root@izwz9ezkmfgg9s8ldbi3y5z redis-5.0.2]# src/redis-cli -h 127.0.0.1 -p 6379 -a 123456 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. 127.0.0.1:6379> config get requirepass 1) "requirepass" 2) "123456" 127.0.0.1:6379>
配置OK
set key value get key 测试经过,外网链接测试OK 搞定server