參考官方文檔:http://redis.io/download
1、開啓一個ssh連接,下載並安裝:(本教程使用的最新文檔版本爲 3.2.4)
$ cd /usr/local/tar.gz
$ wget http://download.redis.io/releases/redis-3.2.4.tar.gz
$ tar xzf redis-3.2.4.tar.gz
$ cd redis-3.2.4
$ make
2、make完後 redis-3.2.4目錄下會出現編譯後的redis服務程序redis-server,還有用於測試的客戶端程序redis-cli,兩個程序位於安裝目錄 src 目錄下:
下面啓動redis服務.
$ cd src
$ ./redis-server
3、啓動成功標誌:
4894:C 25 Oct 21:14:21.453 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf
4894:M 25 Oct 21:14:21.457 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2.4 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 4894
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
4894:M 25 Oct 21:14:21.461 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
4894:M 25 Oct 21:14:21.461 # Server started, Redis version 3.2.4
4894:M 25 Oct 21:14:21.462 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
4894:M 25 Oct 21:14:21.462 * DB loaded from disk: 0.000 seconds
4894:M 25 Oct 21:14:21.463 * The server is now ready to accept connections on port 6379
4、啓動redis服務進程後,就可以使用測試客戶端程序redis-cli和redis服務交互了。 另外開啓一個ssh連接進行如下測試:
$ cd /usr/local/tar.gz/redis-3.2.4
$ src/redis-cli
127.0.0.1:6379> set foo bar
OK
127.0.0.1:6379> get foo
"bar"
5、安裝測試完成。