標籤:
本文用於描述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