a) 下载安装
wget http://redis.googlecode.com/files/redis-2.4.14.tar.gz
tar xvzf redis-2.4.14.tar.gz
cd redis-2.4.14
make
sudo make install
这时Redis 的可执行文件被放到了/usr/local/bin
b) 下载配置文件和init启动脚本
wgethttps://github.com/ijonas/dotfiles/raw/master/etc/init.d/redis-server wgethttps://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 |
c) 初始化用户和日志路径 |
sudo useradd -s /usr/sbin/nologin 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
|
d) 修改密码 sudo vi /etc/redis.conf # requirepass foobared去掉注释,foobared改为自己的密码 |
|
e) 设置开机自动启动,关机自动关闭
sudo update-rc.d redis-server defaults |
|
f) 启动Redis:
sudo /etc/init.d/redis-server start |