1. 程式人生 > >ubuntu18.04 安裝Redis

ubuntu18.04 安裝Redis

1:下載redis原始碼

2:解壓 

tar xvzf redis-stable.tar.gz

3:進入redis-stable目錄

cd redis-stable

4:build原始碼

make

5:測試一下build是否成功了

make test

如果看到如下輸出

\o/ All tests passed without errors!

Cleanup: may take some time... OK
make[1]: Leaving directory '/home/ghc/Documents/nano/redis-stable/src'

證明成功了

6:去到src目錄就可以看到

  • redis-server is the Redis Server itself.
  • redis-sentinel is the Redis Sentinel executable (monitoring and failover).
  • redis-cli is the command line interface utility to talk with Redis.
  • redis-benchmark is used to check Redis performances.
  • redis-check-aof and redis-check-dump are useful in the rare event of corrupted data files.

7:啟動Redis server

redis-server

預設埠是6379

8:檢視server是否正在執行

redis-cli ping

返回pong就證明可以ping通 是正在執行

遇到的錯:

1:執行make test之後報錯

 cd src && make test
make[1]: Entering directory '/home/ghc/Documents/nano/redis-stable/src'
CC Makefile.dep
You need tcl 8.5 or newer in order to run the Redis test
Makefile:242: recipe for target 'test' failed
make[1]: *** [test] Error 1
make[1]: Leaving directory '/home/ghc/Documents/nano/redis-stable/src'
Makefile:6: recipe for target 'test' failed
make: *** [test] Error 2

這表明沒有安裝tcl,執行 sudo apt install tcl來安裝