$sudo apt-get update
$sudo apt-get install redis-server

1.启动redis服务

$sudo /etc/init.d/redis-server restart
$sudo service redis-server restart

2.连接redis   

$ redis-cli -h 127.0.0.1 -p 6379