redis 下載地址: https://redis.io/
將下載的安裝包上傳到/opt下召庞, 使用 :
- tar -zxvf redis-3.2.8.tar.gz 解壓安裝包
- cd redis-3.2.8 , 進入安裝包
- make ,編譯
出現(xiàn)錯誤:
make[3]: gcc:命令未找到
make[3]: *** [net.o] 錯誤 127
make[3]: 離開目錄“/opt/redis-3.2.8/deps/hiredis”
make[2]: *** [hiredis] 錯誤 2
make[2]: 離開目錄“/opt/redis-3.2.8/deps”
make[1]: [persist-settings] 錯誤 2 (忽略)
CC adlist.o
/bin/sh: cc: 未找到命令
make[1]: *** [adlist.o] 錯誤 127
make[1]: 離開目錄“/opt/redis-3.2.8/src”
make: *** [all] 錯誤 2
解決方法:安裝gcc
yum -y install gcc automake autoconf libtool make 安裝
安裝完成后, 運行make ,出現(xiàn)如下錯誤:
make[1]: 進入目錄“/opt/redis-3.2.8/src”
CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:31: **致命錯誤**:jemalloc/jemalloc.h:沒有那個文件或目錄
#include <jemalloc/jemalloc.h>
^
編譯中斷初坠。
make[1]: *** [adlist.o] 錯誤 1
make[1]: 離開目錄“/opt/redis-3.2.8/src”
make: *** [all] 錯誤 2
解決方式: make改為make MALLOC=libc,推測是因為編譯庫的問題蔗衡。
運行命令 make MALLOC= libc 完成后渤闷, 運行 make test ,看一下是否還有問題。
出現(xiàn)如下錯誤:
cd src && make test
make[1]: 進入目錄“/opt/redis-3.2.8/src”
You need tcl 8.5 or newer in order to run the Redis test
make[1]: *** [test] 錯誤 1
make[1]: 離開目錄“/opt/redis-3.2.8/src”
make: *** [test] 錯誤 2
應(yīng)該是tcl版本比較低導(dǎo)致撮弧,那就升級嘍。
按命令執(zhí)行如下命令:
wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
sudo tar xzvf tcl8.6.1-src.tar.gz -C /usr/local/
cd /usr/local/tcl8.6.1/unix/
sudo ./configure
sudo make
sudo make install
執(zhí)行:wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
命令后
出現(xiàn)如下錯誤: -bash: wget: 未找到命令
因為 centos7 是最小化安裝姚糊,沒有wget 命令 贿衍, 先安裝:
yum install -y wget
安裝完成之后再運行上面的命令。
安裝tcl完成之后救恨,重新加壓redis 安裝包贸辈。并運行make 命令。
進入src 目錄 肠槽,運行 redis-server擎淤, 出現(xiàn)如下界面表示運行成功。
[root@bogon src]# ./redis-server
2200:C 29 Mar 22:13:49.357 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
2200:M 29 Mar 22:13:49.358 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2.8 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 2200
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
2200:M 29 Mar 22:13:49.362 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
2200:M 29 Mar 22:13:49.362 # Server started, Redis version 3.2.8
2200:M 29 Mar 22:13:49.362 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
2200:M 29 Mar 22:13:49.363 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
2200:M 29 Mar 22:13:49.406 * DB loaded from disk: 0.044 seconds
2200:M 29 Mar 22:13:49.407 * The server is now ready to accept connections on port 6379
另起一個界面秸仙,運行嘴拢,redis-cli來啟動客戶端 ,如下:
啟動客戶端.png
可以運行如下命令寂纪,查看redis端口:
檢測redis進程
ps -ef|grep redis
檢測端口
netstat -lntp | grep 6379
至此redis 安裝完成席吴。 可以正常使用了, centos7 安裝redis的坑還是蠻多的。 記錄一下抢腐,留著以后備用姑曙。
少年聽雨歌樓上襟交,紅燭昏羅帳迈倍。
壯年聽雨客舟中,江闊云低捣域,斷雁叫西風(fēng)啼染。
感謝支持!
---起個名忒難