码迷,mamicode.com
首页 > 其他好文 > 详细

redis安装(一)

时间:2017-10-31 22:18:54      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:ring   write   mina   and   ide   directory   手动   list   mirror   

注:redis版本redis-4.0.2.tar.gz,操作系统centos7

1:解压redis   

[root@docker3 local]# tar -zxvf redis-4.0.2.tar.gz 

     

2: 进入目录进行编译

[root@docker2 redis-4.0.2]# cd redis-4.0.2
[root@docker2 redis-4.0.2]# make 

   

 

报错:gcc找不到

MAKE hiredis
cd hiredis && make static
make[3]: Entering directory `/usr/local/redis-4.0.2/deps/hiredisgcc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  net.c
make[3]: gcc: Command not found
make[3]: *** [net.o] Error 127
make[3]: Leaving directory `/usr/local/redis-4.0.2/deps/hiredismake[2]: *** [hiredis] Error 2
make[2]: Leaving directory `/usr/local/redis-4.0.2/depsmake[1]: [persist-settings] Error 2 (ignored)

 

 

 手动安装GCC

[root@docker2 redis-4.0.2]# yum install gcc
Loaded plugins: fastestmirror
base                                                     | 3.6 kB     00:00     
extras                                                   | 3.4 kB     00:00     
updates                                                  | 3.4 kB     00:00     
(1/2): extras/7/x86_64/primary_db                          | 129 kB   00:0

   

 

 再make编译 报错下面错

[root@docker2 redis-4.0.2]# make
cd src && make all
make[1]: Entering directory `/usr/local/redis-4.0.2/src    CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory
 #include <jemalloc/jemalloc.h>
                               ^
compilation terminated.
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/usr/local/redis-4.0.2/srcmake: *** [all] Error 2
[root@docker2 redis-4.0.2]# zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory^C

   

参考博文,http://www.phperz.com/article/14/1219/42002.html

解决办法:make MALLOC=libc

 

再make 编译

[root@docker2 redis-4.0.2]# make
。。。。。。。。。。。
。。。。。。。。。。。。。
    LINK redis-benchmark
    INSTALL redis-check-rdb
    INSTALL redis-check-aof

Hint: Its a good idea to run make test ;)

编译成功,进行make test测试

 

3:make test测试

You need tcl 8.5 or newer in order to run the Redis test

 

报上面的错,安装新的tcl

[root@docker2 src]# yum install tcl 

 

然后执行make test测试,通过测试

[root@docker2 src]# make test
。。。。。。。。。。。。。
。。。。。。。。。。。。。
  198 seconds - integration/replication-psync
  218 seconds - integration/replication-3
  105 seconds - unit/hyperloglog
  226 seconds - integration/replication
  117 seconds - unit/geo
  144 seconds - unit/obuf-limits

\o/ All tests passed without errors!

 

 4:修改配置文使其能够后台启动:

[root@docker2 redis-4.0.2]# vim redis.conf 

    设置后台启动:daemonize yes

技术分享

 

5:启动redis

[root@docker2 src]# ./redis-server ../redis.conf 

 

 

6:验证起否成功

[root@docker2 src]# 
[root@docker2 src]# ps -ef|grep redis            
root       8435      1  0 09:47 ?        00:00:00 ./redis-server 127.0.0.1:6379
root       8440   2454  0 09:47 pts/0    00:00:00 grep --color=auto redis

 

   

7:关闭redis

[root@docker2 src]# ./redis-cli shutdown
[root@docker2 src]# ps -ef|grep redis   
root       8447   2454  0 09:51 pts/0    00:00:00 grep --color=auto redis

 

redis安装(一)

标签:ring   write   mina   and   ide   directory   手动   list   mirror   

原文地址:http://www.cnblogs.com/zhangjunqing/p/7763813.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!