1.安装并编译redis:
- $sudo su
- $mkdir /usr/local/redis
- $cd /usr/local/redis
- $wget http://redis.googlecode.com/files/redis-2.0.0-rc2.tar.gz
- $tar zxvf redis-2.0.0-rc2.tar.gz
- $cd redis-2.0.0-rc2
- $make
2.拷贝文件到指定文件夹:
- $cp redis.conf /etc/
- $cp redis-benchmark redis-cli redis-server /usr/bin/
3.启动服务并验证:
- $redis-server /etc/redis.conf
查看是否成功启动
- $ ps -ef | grep redis
测试set和get方法:
- $ redis-cli set key1 value1
- OK
- $ redis-cli get key1
- value1
关闭服务
- $ redis-cli shutdown
- #关闭指定端口的redis-server
- $redis-cli -p 6380 shutdown
至此,已经能让redis成功运行