linux下安裝redis出現錯誤及其解決方案__linux

來源:互聯網
上載者:User
測試於: Redis2.6.17 | CentOS 5.7

安裝: 通過wget方式直接在linux上下載Redis

wget http://download.redis.io/releases/redis-2.6.17.tar.gz
解壓下載的redis-2.6.17.tar.gz 檔案
tar -zxvf redis-2.6.17.tar.gz
進入解壓後的檔案夾
cd redis-2.6.17
編譯安裝
make

運行: 通過執行src檔案夾下的redis-server,可以啟動redis服務:

$ src/redis-server
Redis啟動畫面如下:
通過執行src檔案夾下的redis-cli, 可以訪問redis服務。
$ src/redis-cliredis> set foo barOkredis> get foo"bar"

安裝過程可能出現的問題: CentOS5.7預設沒有安裝gcc,這會導致我們無法make成功。使用yum安裝:

yum -y install gcc
make時報如下錯誤:
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directoryzmalloc.h:55:2: error: #error "Newer version of jemalloc required"make[1]: *** [adlist.o] Error 1make[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之後,會出現一句提示
Hint: To run 'make test' is a good idea ;) 

但是不測試,通常是可以使用的。若我們運行make test ,會有如下提示

[devnote@devnote src]$ make testYou need tcl 8.5 or newer in order to run the Redis testmake: ***[test] Error_1

解決辦法是用yum安裝tcl8.5(或去tcl的官方網站http://www.tcl.tk/下載8.5版本,並參考官網介紹進行安裝)

yum install tcl

參考資料: http://blog.csdn.net/liuxingyu_21/article/details/16116561
http://redis.io/download http://www.oschina.net/question/12_18065

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.