ubuntu11.10server 安装redis-2.6.7
1、下载安装:
1
2
3
4
5
6
|
cd /tmp wget http: //redis .googlecode.com /files/redis-2 .6.7. tar .gz tar -zxf redis-2.6.7. tar .gz cd redis-2.6.7 make sudo make install |
这时Redis 的可执行文件被放到了/usr/local/bin
2、下载配置文件和init启动脚本:
1
2
3
4
5
|
sudo wget https: //github .com /ijonas/dotfiles/raw/master/etc/init .d /redis-server sudo mv redis-server /etc/init .d /redis-server sudo chmod +x /etc/init .d /redis-server cd redis-2.6.7 sudo mv redis.conf /etc/redis .conf |
3、初始化用户和日志路径
第一次启动Redis前,建议为Redis单独建立一个用户,并新建data和日志文件夹
1
2
3
4
5
|
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、设置开机自动启动,关机自动关闭
1
|
sudo update-rc.d redis-server defaults |
5、启动Redis:
1
|
sudo /etc/init .d /redis-server start |
6、启动client客户端连接:
1
2
3
4
5
|
$ redis-cli redis> set foo bar OK redis> get foo "bar" |