[root@localhost /]# cd /usr/local/redis
[root@localhost redis]# make (如报错jemalloc/jemalloc.h,重新执行:make MALLOC=libc)
[root@localhost redis]# make PREFIX=/usr/local/redis install
修改redis.conf并配置密码
[root@localhost redis]# vim redis.conf
修改如下几行(行数可能略有偏差)(requirepass 后面为密码):
69行: bind 127.0.0.1 改成 #bind 127.0.0.188行: protected-mode yes 改为 protected-mode no
136行:daemonize no 改为 daemonize yes
507行:# requirepass foobared 改为 requirepass 123456
[root@localhost redis]# vi /etc/rc.local
添加如下一行命令
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
[root@localhost redis]# cat /etc/rc.local
#!/bin/bash
# THISFILEISADDEDFORCOMPATIBILITYPURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf