1.下载安装redis redis官网:redis.io
wget http://download.redis.io/releases/redis-2.6.16.tar.gz
tar xzvf redis-2.6.16.tar.gz
cd redis-2.6.16
make
make install
2. 配置init脚本:
wget https://github.com/ijonas/dotfiles/raw/master/etc/init.d/redis-server
wget https://github.com/ijonas/dotfiles/raw/master/etc/redis.conf
sudo mv redis-server /etc/init.d/redis-server sudo
chmod +x /etc/init.d/redis-server
sudo mv redis.conf /etc/redis.conf
3. 初始化日志路径 第一次启动Redis前,建议为Redis单独建立一个用户,并新建data和日志文件夹
sudo useradd redis
sudo mkdir -p /var/lib/redis
sudo mkdir -p /var/log/redis
sudo chown redis.redis /var/lib/redis
sudo chown redis.redis /var/log/redis
4、设置开机自动启动,关机自动关闭
update-rc.d redis-server defaults
5、操作Redis:
/etc/init.d/redis-server start //启动
/etc/init.d/redis-server restart //启动
/etc/init.d/redis-server stop //关闭