1. 程式人生 > >Linux系統下安裝Redis資料庫

Linux系統下安裝Redis資料庫

安裝Redis步驟:

1、下載Redis安裝包     https://redis.io/download         版本:redis-5.0.3-tar-gz

2、將下載的redis-5.0.3-tar-gz 進行解壓縮成 redis-5.0.3         命令:tar -zxvf redis-5.0.3-tar-gz

3、拷貝redis-5.0.3 這個到 /usr/local 這個目錄下

4、進入 /usr/local/redis-5.0.3 目錄下,編譯安裝

      編譯 :make

      安裝:make install

5、修改redis.conf配置檔案

6、啟動Redis
     啟動時候要選擇我們之前修改的配置檔案才能使配置檔案生效。

      進入src目錄
      cd /usr/local/redis-3.2.5/src
     啟動服務
    ./redis-server ../redis.conf
7、登陸redis
./redis-cli -a 你的密碼

參考連結:https://blog.csdn.net/qq_18661793/article/details/53719161

redis編譯過程中,出現的問題解決方案:

就是需要編譯安裝BusyBox  ,參考:https://blog.csdn.net/haofan_/article/details/78369352

編譯安裝BusyBox時,需要提前安裝gcc 以及 gcc-arm-linux-gnueabihf 

安裝 gcc:參考:https://www.cnblogs.com/L-Arikes/p/3734382.html

安裝 gcc-arm-linux-gnueabihf  :sudo apt install  gcc-arm-linux-gnueabihf 

 

make時報如下錯誤:

 zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
 zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
 make[1]: *** [adlist.o] Error 1
 make[1]: Leaving directory `/data0/src/redis-2.6.2/src'
 make: *** [all] Error 2

  原因是jemalloc過載了Linux下的ANSI C的malloc和free函式。解決辦法:make時新增引數。

 make MALLOC=libc

執行make test ,會有如下提示

[[email protected] src]$ make test
You need tcl 8.5 or newer in order to run the Redis test
make: ***[test] Error_1

解決辦法是用apt安裝tcl

sudo apt install tcl

參考:https://blog.csdn.net/lgh1117/article/details/48270085