在 Ubuntu 系統安裝 Redis 可以使用以下命令:
$ sudo apt-get update $ sudo apt-get install redis-server
啟動 Redis
$ redis-server
查看 redis 是否啟動?
$ redis-cli
以上命令將打開以下終端:
redis 127.0.0.1:6379>
127.0.0.1 是本機 IP ,6379 是 redis 服務端口。現在我們輸入 PING 命令。
redis 127.0.0.1:6379> ping PONG
以上說明我們已經成功安裝了redis。
檢查Redis服務器系統進程
$ ps -aux|grep redis redis 4162 0.1 0.0 10676 1420 ? Ss 23:24 0:00 /usr/bin/ $ redis-server /etc/redis/redis.conf conan 4172 0.0 0.0 11064 924 pts/0 S+ 23:26 0:00 grep —color=auto redis
通過啟動命令檢查Redis服務器狀態
$ netstat -nlt|grep 6379 tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN
通過啟動命令檢查Redis服務器狀態
$ sudo /etc/init.d/redis-server status redis-server is running
卸載redis
$ sudo apt-get purge --auto-remove redis-server