安装Redis

yum install tcl
wget http://download.redis.io/releases/redis-3.0.0.tar.gz
tar xzf redis-3.0.0.tar.gz

vim /etc/sysctl.conf

#add for redis
vm.overcommit_memory = 1
net.core.somaxconn = 1024

#vim /etc/rc.local
echo never > /sys/kernel/mm/transparent_hugepage/enabled

如何设置开机启动 redis 服务

阅读自带的readme 文件设置

Installing Redis
-----------------

In order to install Redis binaries into /usr/local/bin just use:

    % make install

You can use "make PREFIX=/some/other/directory install" if you wish to use a
different destination.

Make install will just install binaries in your system, but will not configure
init scripts and configuration files in the appropriate place. This is not
needed if you want just to play a bit with Redis, but if you are installing
it the proper way for a production system, we have a script doing this
for Ubuntu and Debian systems:

    % cd utils
    % ./install_server.sh

The script will ask you a few questions and will setup everything you need
to run Redis properly as a background daemon that will start again on
system reboots.

You'll be able to stop and start Redis using the script named
/etc/init.d/redis_<portnumber>, for instance /etc/init.d/redis_6379.

Code contributions
---

按照命令提示设置即可

原文地址:https://www.cnblogs.com/wuling129/p/4647382.html