MAKE hiredis
cd hiredis && make static
make[3]: Entering directory `/home/zzb/soft/redis-5.0.3/deps/hiredis'
gcc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings
-g -ggdb net.cmake[3]: gcc:命令未找到
make[3]: *** [net.o] 错误 127
make[3]: Leaving directory `/home/zzb/soft/redis-5.0.3/deps/hiredis'
make[2]: *** [hiredis] 错误 2
make[2]: Leaving directory `/home/zzb/soft/redis-5.0.3/deps'
make[1]: [persist-settings] 错误 2 (忽略)
CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] 错误 127
make[1]: Leaving directory `/home/zzb/soft/redis-5.0.3/src'
make: *** [all] 错误 2
[root@server4 redis-5.0.3]#
解决方案一: 因为gcc依赖很多,以下按顺序都执行一下:
yum install cpp
yum install binutils
yum install glibc
yum install glibc-kernheaders
yum install glibc-common
yum install glibc-devel
yum install gcc
yum install make
然后,删除redis解压文件,重新解压。在执行make。
Hint: It's a good idea to run 'make test' ;)
make[1]: Leaving directory `/home/zzb/soft/redis-4.0.11/src'
[root@server2 redis-4.0.11]#
[root@server2 src]# ll
......
-rw-rw-r-- 1 root root 2417 8月 4 2018 redisassert.h
-rwxr-xr-x 1 root root 5599902 4月 28 05:31 redis-benchmark
-rw-rw-r-- 1 root root 29605 8月 4 2018 redis-benchmark.c
-rw-r--r-- 1 root root 70320 4月 28 05:31 redis-benchmark.o
-rwxr-xr-x 1 root root 8333528 4月 28 05:31 redis-check-aof
-rw-rw-r-- 1 root root 7143 8月 4 2018 redis-check-aof.c
-rw-r--r-- 1 root root 21864 4月 28 05:31 redis-check-aof.o
-rwxr-xr-x 1 root root 8333528 4月 28 05:31 redis-check-rdb
-rw-rw-r-- 1 root root 13898 8月 4 2018 redis-check-rdb.c
-rw-r--r-- 1 root root 58720 4月 28 05:31 redis-check-rdb.o
-rwxr-xr-x 1 root root 5740266 4月 28 05:31 redis-cli
-rw-rw-r-- 1 root root 100621 8月 4 2018 redis-cli.c
-rw-r--r-- 1 root root 240200 4月 28 05:31 redis-cli.o
-rw-rw-r-- 1 root root 21758 8月 4 2018 redismodule.h
-rwxr-xr-x 1 root root 8333528 4月 28 05:31 redis-sentinel
-rwxr-xr-x 1 root root 8333528 4月 28 05:31 redis-server
-rwxrwxr-x 1 root root 65991 8月 4 2018 redis-trib.rb
-rw-rw-r-- 1 root root 2163 4月 28 05:31 release.c
......
redis-server
redis-cli
出现服务端和客户端文件表明安装成功。
测试:
[root@server2 src]# ./redis-server
12844:C 28 Apr 05:41:29.280 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
12844:C 28 Apr 05:41:29.281 # Redis version=4.0.11, bits=64, commit=00000000, mod
ified=0, pid=12844, just started12844:C 28 Apr 05:41:29.281 # Warning: no config file specified, using the defaul
t config. In order to specify a config file use ./redis-server /path/to/redis.conf12844:M 28 Apr 05:41:29.282 * Increased maximum number of open files to 10032 (it
was originally set to 1024). _._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 4.0.11 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 12844
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
12844:M 28 Apr 05:41:29.284 # WARNING: The TCP backlog setting of 511 cannot be e
nforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.12844:M 28 Apr 05:41:29.285 # Server initialized
12844:M 28 Apr 05:41:29.285 # WARNING overcommit_memory is set to 0! Background s
ave 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.12844:M 28 Apr 05:41:29.285 # WARNING you have Transparent Huge Pages (THP) suppo
rt 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.12844:M 28 Apr 05:41:29.286 * Ready to accept connections
^C12844:signal-handler (1556403858) Received SIGINT scheduling shutdown...
12844:M 28 Apr 06:24:19.027 # User requested shutdown...
12844:M 28 Apr 06:24:19.027 * Saving the final RDB snapshot before exiting.
12844:M 28 Apr 06:24:19.046 * DB saved on disk
12844:M 28 Apr 06:24:19.046 # Redis is now ready to exit, bye bye...
[root@server2 src]#
[root@server2 src]# ./redis-cli
127.0.0.1:6379>
解决方案二:
https://blog.csdn.net/weixin_40493969/article/details/81150469
出现如下错误 :
cd src && make all
make[1]: Entering directory '/xx/xx/redis-x.x.x/src'
CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory '/xx/xx/redis-x.x.x/src'
make: *** [all] Error 2
1、先查看是否安装c++的编译器; 执行 yum -y install gcc-c++
安装完c++编译器后 再次 make 若报此错
出现如下错误:
cd src && make all
make[1]: Entering directory '/xx/xx/redis-x.x.x/src'
LINK redis-server
cc: ../deps/hiredis/libhiredis.a: No such file or directory
cc: ../deps/lua/src/liblua.a: No such file or directory
make[1]: *** [redis-server] Error 1
make[1]: Leaving directory '/xx/xx/redis-x.x.x/src'
make: *** [all] Error 2
2、执行 make clean 后再次 执行 make ,再检查redis-x.x.x/src 目录下有没有 redis-server、redis-cli 和 /usr/local/bin下有没有
若无,则把redis-x.x.x 文件夹删掉,再解压一次redis的压缩包,cd进入 redis-x.x.x 中, make 一下 即可
即解决安装redis时 , 在执行 make 时报错的问题