編譯安裝redis

來源:互聯網
上載者:User

標籤:

本文用於描述redis的編譯安裝

1、上傳源碼包到linux 伺服器上;我已經上傳到了root目錄下:/root/redis-3.2.3.tar.gz

ll /root/ | grep redis.*gz-rw-r--r--  1 root root    1541401 9月  17 18:37 redis-3.2.3.tar.gz

 

2、解壓

tar -xzvf redis-3.2.3.tar.gzll /root/ | grep redisdrwxrwxr-x  6 root root       4096 8月   2 17:00 redis-3.2.3-rw-r--r--  1 root root    1541401 9月  17 18:37 redis-3.2.3.tar.gz

 

3、make 這裡可以直接make 是因為redis已經自己寫好了make file 了;也就是說不用再執行configure 了、make 後編譯好的檔案會儲存到src目錄下

cd /root/redis-3.2.3makell總用量 196-rw-rw-r--  1 root root 75147 8月   2 17:00 00-RELEASENOTES-rw-rw-r--  1 root root    53 8月   2 17:00 BUGS-rw-rw-r--  1 root root  1805 8月   2 17:00 CONTRIBUTING-rw-rw-r--  1 root root  1487 8月   2 17:00 COPYINGdrwxrwxr-x  7 root root  4096 9月  17 18:38 deps-rw-rw-r--  1 root root    11 8月   2 17:00 INSTALL-rw-rw-r--  1 root root   151 8月   2 17:00 Makefile-rw-rw-r--  1 root root  4223 8月   2 17:00 MANIFESTO-rw-rw-r--  1 root root  6834 8月   2 17:00 README.md-rw-rw-r--  1 root root 46695 8月   2 17:00 redis.conf-rwxrwxr-x  1 root root   271 8月   2 17:00 runtest-rwxrwxr-x  1 root root   280 8月   2 17:00 runtest-cluster-rwxrwxr-x  1 root root   281 8月   2 17:00 runtest-sentinel-rw-rw-r--  1 root root  7109 8月   2 17:00 sentinel.confdrwxrwxr-x  2 root root  4096 9月  17 18:39 srcdrwxrwxr-x 10 root root  4096 8月   2 17:00 testsdrwxrwxr-x  7 root root  4096 8月   2 17:00 utils

 

4、make install 這一步會把src 目錄下的二進位檔案複製到/usr/local/bin/ 目錄下;由於把檔案儲存到/usr/local/bin/目錄下的方式不方便管理,於是我們把檔案統一儲存到

   /usr/local/redis/bin/目錄下

mkdir -p /usr/local/redis/bin/cd srccp redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server redis-trib.rb /usr/local/redis/bin/

 

5、給redis提供一個啟動指令碼

#!/bin/bash#chkconfig: 2345 50 50#description: redis-server init scriptsserver_exec=/usr/local/redis/bin/redis-serverpid_file=/usr/local/redis/redis_server.pidport=6379case $1 in"start")    if test -e $pid_file    then        echo "redisd has been started"    else        echo "start redisd ..."        $server_exec --port $port --pidfile $pid_file &    fi;;"stop")    if test -e $pid_file    then        echo "will to stop redisd..."        pid=`cat $pid_file`        kill $pid    else        echo "redisd has been stop"    fi;;"*")    echo "not suport argument $1";;esac

 

6、啟動redisd

service redisd start

 

7、修改環境變數

export PATH=/usr/local/redis/bin:$PATH

 

編譯安裝redis

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.