.在(/usr/local/src)下,
1.下载: # wget http://download.redis.io/releases/redis-3.2.8.tar.gz
2.解压: tar zxvf redis-3.2.8.tar.gz
3.进入目录: cd redis-3.2.8
4.编译并指定安装目录: make PREFIX=/usr/local/redis-3.2.8 install
5.创建软链接: ln -s /usr/local/redis-3.2.8 /usr/local/redis
6. 配置文件(当前还在redis源码目录[/usr/local/src/redis-3.2.8]内)
# cp redis.conf /etc/redis.conf
7.编辑 # vim /etc/redis.conf
daemonize no ==> daemonize yes (设置redis为后台daemon进程)
8. 创建redis用户
[root@redis-server ~]# useradd -r -s /sbin/nologin -M redis
9. 创建启动脚本/etc/init.d/redis
#!/bin/sh
#
# redis init file for starting up the redis daemon
#
# chkconfig: - 20 80
# description: Starts and stops the redis daemon.
# Source function library.
#!/bin/sh
#
# redis init file for starting up the redis daemon
#
# chkconfig: - 20 80
# description: Starts and stops the redis daemon.
# Source function library.
. /etc/rc.d/init.d/functions
name="redis-server"
exec="/usr/local/redis/bin/$name"
pidfile="/var/run/redis/redis.pid"
REDIS_CONFIG="/etc/redis.conf"
[ -e /etc/sysconfig/redis ] && . /etc/sysconfig/redis
lockfile=/var/lock/subsys/redis
start() {
[ -f $REDIS_CONFIG ] || exit 6
[ -x $exec ] || exit 5
echo -n $"Starting $name: "
daemon --user ${REDIS_USER-redis} "$exec $REDIS_CONFIG"
retval=$?
echo
[ $retval -