1)root權限下安裝gcc
查看是否安裝gcc,root下輸入gcc,如果出現:gcc: no input files,說明已經安裝好了
yum install gcc
2)下載壓縮包
wget http://download.redis.io/releases/redis-3.2.8.tar.gz
3)進入已解壓的文件夾進行編譯
make
4)安裝指定目錄
make PREFIX=/usr/local/redis install
5)在redis安裝目錄下新建conf文件夾,複製解壓包文件夾下的redis.conf到這個conf文件下
cp /opt/soft/redis-3.2.8/redis.conf /usr/local/redis/conf/
6)啓動
./redis-server ../conf/redis.conf
可以修改redis.conf中的daemonize no--》daemonize yes轉爲後臺啓動
7)查看啓動端口
lsof -i :6379
ps aux|grep redis
root 5624 0.1 0.1 29996 1864 ? Ssl 02:26 0:00 ./redis-server 127.0.0.1:6379
8)停止redis
./redis-cli shutdown save
9)設置密碼
找到 # requirepass foobared 然後去掉註釋,把foobared該爲自己的密碼
10)設置訪問IP
bind 127.0.0.1 這個是默認只有本機訪問,註釋掉,重啓以後變爲
ps -axu|grep redis
root 6878 0.1 0.1 29996 2004 ? Ssl 07:00 0:00 ./redis-server *:6379