Center 6.5 redis 3.0安装
搭建环境
CenterOs 6.5
在安装Redis之前,要确保系统有gcc环境。
# yum install gcc
一.安装Redis
1.官网下载
# wget http://download.redis.io/releases/redis-3.0.0.tar.gz
2.解压:
# tar -zxvf redis-3.0.0.tar.gz
3.进入解压后的目录并编译
# cd redis-3.0.0
# make
4.安装到指定目录
4.1 检查包包是否正常。
# make test cd src && make test make[1]: Entering directory `/root/program/redis-3.0.0/src' You need tcl 8.5 or newer in order to run the Redis test make[1]: *** [test] Error 1 make[1]: Leaving directory `/root/program/redis-3.0.0/src' make: *** [test] Error 2
需要安装 tcl 8.5 或以上版本,官网传送门
http://www.linuxfromscratch.org/blfs/view/cvs/general/tcl.html
(不过不安装这个也可以继续下面步骤)
安装完tcl后 回到主题,继续安装Redis
把Redis安装到指定目录
# make PREFIX=/usr/local/redis/ install
为了方便管理,这里把redis-3.0.0 目录下的redis.conf文件复制到安装目录下
# cp redis.conf /usr/local/redis/bin/
5.启动redis
redis默认启动端口好为 6379
打开Redis后台启动模式 需要把redis.conf 文件的 daemonize 改为yes
# vim redis.conf
################################ GENERAL #####################################
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes
启动
# redis-server redis.conf
使用redis自带客户端测试
[root@localhost bin]# redis-cli
127.0.0.1:6379>
关于学习redis很不错的博文,需要的同学点击传送
http://www.cnblogs.com/stephen-liu74/archive/2012/03/12/2348935.htm
6. 进入安装目录,查看安装列表
[root@localhost bin]# ll
total 2692
-rwxr-xr-x 1 root root 236070 Mar 7 06:50 redis-benchmark
-rwxr-xr-x 1 root root 22169 Mar 7 06:50 redis-check-aof
-rwxr-xr-x 1 root root 45355 Mar 7 06:50 redis-check-dump
-rwxr-xr-x 1 root root 341405 Mar 7 06:50 redis-cli
lrwxrwxrwx 1 root root 12 Mar 7 06:50 redis-sentinel -> redis-server
-rwxr-xr-x 1 root root 2099834 Mar 7 06:50 redis-server
安装目录下文件介绍
文件名 | 说明 |
redis-benchmark | Redis性能测试工具 |
redis-check-aof | AOF文件修复工具 |
redis-check-dump | RDB文件修复工具 |
redis-cli | Redis命令行客户端 |
redis-server | Redis服务器 |
redis-sentinel | Redis集群管理工具 |