```
wget https://codeload.github.com/antirez/redis/tar.gz/2.8.21
mv2.8.21redis-2.8.21.tar.gz
tar zxvf redis-2.8.21.tar.gz
cd redis-2.8.21
yum install -y gcc epel-release; yum install -y jemalloc-devel
make 如果出错,运行如下命令:
(cd deps; make hiredis lua jemalloc linenoise; cd ..; make)
cd src
make install PREFIX=/usr/local/redis
mkdir /usr/local/redis/etc
wget http://www.apelearn.com/study_v2/.redis_conf -O /usr/local/redis/etc/redis.conf 2>/dev/null(下载配置文件)
wget http://www.apelearn.com/study_v2/.redis_init -O /etc/init.d/redis 2>/dev/null(启动脚本)
useradd -s /sbin/nologin redis
mkdir /usr/local/redis/var
chmod 777 /usr/local/redis/var
chmod 755 /etc/init.d/redis
chkconfig --add redis
chkconfig redis on
service redis start
同步时间 ntpdate -u time.nist.gov
```
```
daemonize yes
pidfile /usr/local/redis/var/redis.pid
port 6379
timeout 300
loglevel debug
logfile /usr/local/redis/var/redis.log
databases 16
save 900 1
save 300 10
save 60 10000
rdbcompression yes
dbfilename dump.rdb
dir /usr/local/redis/var/
appendonly no
appendfsync always
requirepass dqws2018
bind 0.0.0.0
* */1 * * * timedatectl set-timezone 'Asia/Shanghai'
```