1、下载稳定的安装包
wget http://download.redis.io/redis-stable.tar.gz
2、解压缩并安装
tar -zxvf redis-stable.tar.gz
cd redis-stable
make
sudo make install
sudo cp redis.conf /etc/
3、修改配置文件
vim /etc/redis.conf
daemonize:yes // 是否以后台daemon方式运行
4、运行redis-server
redis-server /etc/redis.conf
会出现warning,根据提示修改即可。
如切换到root账号:
echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
sysctl vm.overcommit_memory=1
5、检查是否运行成功
ps -ef | grep redis
You can interact with Redis using the built-in client:
$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"