centos7下redis的安装

来源:互联网 发布:传奇霸业经验数据 编辑:程序博客网 时间:2024/05/16 01:35

1,在官网下载redis2.8安装包

[root@localhost redis]# wget -v -O redis-2.8.21.tar.gz    https://github.com/antirez/redis/archive/2.8.21.tar.gz--2015-07-15 15:02:40--  https://github.com/antirez/redis/archive/2.8.21.tar.gz正在解析主机 github.com (github.com)... 192.30.252.131正在连接 github.com (github.com)|192.30.252.131|:443... 已连接。已发出 HTTP 请求,正在等待回应... 302 Found位置:https://codeload.github.com/antirez/redis/tar.gz/2.8.21 [跟随至新的 URL]--2015-07-15 15:02:43--  https://codeload.github.com/antirez/redis/tar.gz/2.8.21正在解析主机 codeload.github.com (codeload.github.com)... 192.30.252.146正在连接 codeload.github.com (codeload.github.com)|192.30.252.146|:443... 已连接。已发出 HTTP 请求,正在等待回应... 200 OK长度:1272195 (1.2M) [application/x-gzip]正在保存至: “redis-2.8.21.tar.gz”100%[=========================================================================================================================================>] 1,272,195   35.1KB/s 用时 19s    2015-07-15 15:03:03 (64.3 KB/s) - 已保存 “redis-2.8.21.tar.gz” [1272195/1272195])

2,解压安装包

[root@localhost redis]# tar -xxvf redis-2.8.21.tar.gz redis-2.8.21/redis-2.8.21/.gitignoreredis-2.8.21/00-RELEASENOTESredis-2.8.21/BUGSredis-2.8.21/CONTRIBUTINGredis-2.8.21/COPYINGredis-2.8.21/INSTALLredis-2.8.21/MANIFESTOredis-2.8.21/Makefileredis-2.8.21/READMEredis-2.8.21/deps/redis-2.8.21/deps/Makefileredis-2.8.21/deps/hiredis/redis-2.8.21/deps/hiredis/.gitignoreredis-2.8.21/deps/hiredis/.travis.ymlredis-2.8.21/deps/hiredis/CHANGELOG.mdredis-2.8.21/deps/hiredis/COPYINGredis-2.8.21/deps/hiredis/Makefileredis-2.8.21/deps/hiredis/README.mdredis-2.8.21/deps/hiredis/adapters/redis-2.8.21/deps/hiredis/adapters/ae.hredis-2.8.21/deps/hiredis/adapters/libev.hredis-2.8.21/deps/hiredis/adapters/libevent.hredis-2.8.21/deps/hiredis/adapters/libuv.hredis-2.8.21/deps/hiredis/async.c


3,编译源文件

[root@localhost redis]# cd redis-2.8.21[root@localhost redis-2.8.21]# makecd src && make allmake[1]: 进入目录“/home/joeyon/redis/redis-2.8.21/src”rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-dump redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html(cd ../deps && make distclean)

4,安装redis

[root@localhost redis-2.8.21]# make PREFIX=/usr/local/redis-2.8.21  installcd src && make installmake[1]: 进入目录“/home/joeyon/redis/redis-2.8.21/src”Hint: It's a good idea to run 'make test' ;)    INSTALL install    INSTALL install    INSTALL install    INSTALL install    INSTALL installmake[1]: 离开目录“/home/joeyon/redis/redis-2.8.21/src”


5,安装tcl8.5(如不进行redis test测试可以不安装)

[root@localhost src]# yum install tcl已加载插件:fastestmirrorbase                                                                                                                                                        | 3.6 kB  00:00:00     extras                                                                                                                                                      | 3.4 kB  00:00:00     updates                                                                                                                                                     | 3.4 kB  00:00:00     updates/7/x86_64/primary_db                                                                                                                                 | 2.5 MB  00:00:03     Determining fastest mirrors * base: centos.ustc.edu.cn * extras: centos.ustc.edu.cn * updates: centos.ustc.edu.cn正在解决依赖关系--> 正在检查事务---> 软件包 tcl.x86_64.1.8.5.13-4.el7 将被 安装--> 解决依赖关系完成依赖关系解决=================================================================================================================================================================================== Package                                架构                                      版本                                               源                                       大小===================================================================================================================================================================================正在安装: tcl                                    x86_64                                    1:8.5.13-4.el7                                     base                                    1.9 M事务概要===================================================================================================================================================================================安装  1 软件包总下载量:1.9 M安装大小:4.4 MIs this ok [y/d/N]: yDownloading packages:tcl-8.5.13-4.el7.x86_64.rpm                                                                                                                                 | 1.9 MB  00:00:02     Running transaction checkRunning transaction testTransaction test succeededRunning transaction  正在安装    : 1:tcl-8.5.13-4.el7.x86_64                                                                                                                                      1/1   验证中      : 1:tcl-8.5.13-4.el7.x86_64                                                                                                                                      1/1 已安装:  tcl.x86_64 1:8.5.13-4.el7                                                                                                                                                        完毕!

6,验证redis是否安装成功

[root@localhost src]# cd ..[root@localhost redis-2.8.21]# cd src/[root@localhost src]# make testCleanup: may take some time... OKStarting test server at port 11111[ready]: 17103Testing unit/printver[ready]: 17104Testing unit/auth[ready]: 17105Testing unit/protocol.......  46 seconds - integration/replication-3  25 seconds - unit/hyperloglog  48 seconds - unit/aofrw  50 seconds - integration/replication-4  70 seconds - integration/replication  65 seconds - unit/obuf-limits\o/ All tests passed without errors!Cleanup: may take some time... OK

7,拷贝redis.conf文件到安装目录

cd /home/joeyon/redis/redis-2.8.21cp redis.conf   /usr/local/redis-2.8.21/


8,创建redis日志目录,和数据文件目录

[root@localhost redis-2.8.21]# mkdir -p /usr/local/redis-2.8.21/log[root@localhost redis-2.8.21]# mkdir -p /usr/local/redis-2.8.21/db


9,修改redis.conf下面的配置项

pidfile /usr/local/redis-2.8.21/redis.pidlogfile /usr/local/redis-2.8.21/logdir /usr/local/redis-2.8.21/dbdaemonize yes

10,启动redis

[root@localhost bin]# cd /usr/local/redis-2.8.21/bin/[root@localhost bin]# ./redis-server ../redis.conf 

11,启动客户端

[root@localhost bin]# ./redis-cli127.0.0.1:6379> 

12,测试

127.0.0.1:6379> set welcome 'hello redis'OK127.0.0.1:6379> get welcome"hello redis"127.0.0.1:6379> 

13,关闭服务

redis-cli shutdown




add by joeyon1985

0 0
原创粉丝点击