redis 的下載安裝 百度上比較多,我們直接用的官網的
$ wget http://download.redis.io/releases/redis-5.0.5.tar.gz
$ tar xzf redis-5.0.5.tar.gz
$ cd redis-5.0.5
$ make
進入到解壓後的 src
目錄,通過如下命令啓動Redis:
$ src/redis-server
您可以使用內置的客戶端與Redis進行交互:
$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"
但是 redis-cli和redis-server 總是命令執行失敗
後來發現好像不是全局變量
ln -s /usr/local/redis-5.0.5/src/redis-server /usr/bin/redis-server
我的redis 安裝的位置是在 usr/local/下面 設置到usr/bin/ 就可以了
redis-server 也是這樣做的
redis-server /usr/local/redis-5.0.5/redis.conf
最後執行 redis-cli 就啓動支持了,後面設置爲自啓動就可以了
[root@izuf6f0icee8u4hzqypcnlz /]# redis-server /usr/local/redis-5.0.5/redis.conf
-bash: redis-server: command not found
[root@izuf6f0icee8u4hzqypcnlz /]# ln -s /usr/local/redis-5.0.5/src/redis-server /usr/bin/redis-server
[root@izuf6f0icee8u4hzqypcnlz /]# redis-server
3447:C 26 Nov 2019 23:47:16.072 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
3447:C 26 Nov 2019 23:47:16.072 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=3447, just started
3447:C 26 Nov 2019 23:47:16.072 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 5.0.5 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 3447
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'