安装:
1.下载并解压redis安装包
$ wget http://download.redis.io/releases/redis-3.2.9.tar.gz
$ tar xzf redis-3.2.9.tar.gz
$ cd redis-3.2.9
$ make
2.安装gcc和tcl
$ yum install gcc tcl -y
3.创建文件夹作为安装路径
4. 安装redis
$ make PREFIX=/home/redisbinary install
5. 重新回到redis源码路径下 的src下
6. 将redis-sentinel拷贝到redis安装后的bin目录下去
[root@localhost src]# cp redis-sentinel /home/redisbinary/bin/
7. 把redis-sentinel导入到环境变量中
[root@localhost src]# nano ~/.bash_profile
export REDIS_HOME=/home/redisbinary
export PATH=$PATH:$REDIS_HOME/bin
[root@localhost src]# source ~/.bash_profile
8. 把redis做成后台服务(daemon)
[root@localhost src]# cd /home/redis/redis-3.2.9/utils
[root@localhost utils]# ./install_server.sh
This script will help you easily set up a running redis server
Please select the redis port for this instance: [6379]
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/bin/redis-server] /home/redisbinary/bin/redis-server
Selected config:
Port : 6379
Config file : /etc/redis/6379.conf
Log file : /var/log/redis_6379.log
Data dir : /var/lib/redis/6379
Executable : /home/redisbinary/bin/redis-server
Cli Executable : /usr/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
9.重命名redis服务
[root@localhost utils]# cd /etc/init.d/
[root@localhost init.d]# mv redis_6379 redisd