到官网下载最新版的 Redis-3.2.6

我把它放到文件夹:/usr/local/src/centos-sdk/source2/redis

安装脚本 redis-3.2.6.sh

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi setenforce 0 # 临时禁用,不需要重启(推荐)。 ##################################################
### 安装 工具
##################################################
yum install gcc-c++
yum install -y tcl
yum install wget ##################################################
### 安装 redis
##################################################
cd /usr/local/src/centos-sdk/source2/redis
tar -xzvf ./redis-3.2.6.tar.gz mkdir -pv /usr/local/redis/redis-3.2.6
\cp -rf ./redis-3.2.6/* /usr/local/redis/redis-3.2.6
cd /usr/local/redis/redis-3.2.6 # 测试 redis
make
cd src
make test # 配置 redis
mkdir /usr/local/redis/redis-3.2.6/etc
\cp -rf /usr/local/src/centos-sdk/config/redis-3.2.6/redis.conf /usr/local/redis/reids-3.2.6/etc/redis.conf # 开机启动(已弃用)
# echo "/usr/local/redis/redis-3.2.6/src/redis-server /usr/local/redis/redis-3.2.6/etc/redis.conf &" >> /etc/rc.local # 启动 redis(已弃用)
# /usr/local/redis/redis-3.2.6/src/redis-server /usr/local/redis/redis-3.2.6/etc/redis.conf & # 设置 redis 开机启动
\cp -rf /usr/local/src/centos-sdk/config/redis-3.2.6/redis.init /etc/rc.d/init.d/redis # 拷贝redis.init到启动目录
chmod +x /etc/rc.d/init.d/redis # 添加执行权限
chkconfig redis on # 设置开机启动 service redis start # 启动 redis

/usr/local/redis/reids-3.2.6/etc/redis.conf 内容如下:

bind 127.0.0.1
protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /var/run/redis.pid
loglevel notice
logfile ""
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /usr/local/redis/data
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
requirepass 52php-wenjianbao
maxclients 1024
maxmemory 1GB
maxmemory-policy allkeys-lru
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 128
hash-max-ziplist-value 1024
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes

更详细的介绍:Redis-3.2.6 配置文件中文翻译

/etc/init.d/redis 文件内容如下

# chkconfig: 2345 10 90
# description: Start and Stop redis PATH=/usr/local/bin:/sbin:/usr/bin:/bin REDISPORT=6379 # 端口
EXEC=/usr/local/redis/redis-3.2.6/src/redis-server # 服务程序
REDIS_CLI=/usr/local/redis/redis-3.2.6/src/redis-cli # 命令行程序 PIDFILE=/var/run/redis.pid
CONF="/usr/local/redis/redis-3.2.6/etc/redis.conf" # 配置文件 case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed."
else
echo "Starting Redis server..."
$EXEC $CONF
fi
if [ "$?"="0" ]
then
echo "Redis is running..."
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE exists, process is not running."
else
PID=$(cat $PIDFILE)
echo "Stopping..."
$REDIS_CLI -p $REDISPORT SHUTDOWN
while [ -x $PIDFILE ]
do
echo "Waiting for Redis to shutdown..."
sleep 1
done
echo "Redis stopped"
fi
;;
restart|force-reload)
${0} stop
${0} start
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload}" >&2
exit 1
esac

延伸阅读:

Mac Pro 编译安装 Redis-3.2.3

CentOS 6.5 安装 Redis-3.2.6的更多相关文章

  1. Redis学习笔记(1)- CentOS 6.4 安装Redis

    Redis学习笔记(1)- CentOS 6.4 安装Redis 2013.10.13     学习环境 vm 10.1 + 默认.新装的干净 CentOS 6.4  64BIT系统     准备 1 ...

  2. CentOS 7.3 安装redis 4.0.2服务

    CentOS 7.3 安装redis 4.0.2服务 1.下载解压 下载地址:/home/xiaoming/ wget http://download.redis.io/releases/redis- ...

  3. centos上如何安装redis?|centos傻瓜式安装redis教程

    本文介绍centos安装redis,请不要安装2.4.3,是有问题的. 首先安装gcc yum -y install gcc yum -y install gcc-c++ yum install ma ...

  4. 如何在 CentOS 7 上安装 Redis 服务器

    大家好,本文的主题是 Redis,我们将要在 CentOS 7 上安装它.编译源代码,安装二进制文件,创建.安装文件.在安装了它的组件之后,我们还会配置 redis ,就像配置操作系统参数一样,目标就 ...

  5. CentOS 7 服务器配置--安装Redis

    #下载Redis wget -r -np -nd http://download.redis.io/releases/redis-3.2.8.tar.gz #解压文件 tar zxvf redis-3 ...

  6. [从零开始搭网站八]CentOS使用yum安装Redis的方法

    1.由于centOS官方yum源里面没有Redis,这里我们需要安装一个第三方的yum源,这里用了fedora的epel仓库 yum install epel-release 安装过程中会有让你确认的 ...

  7. CentOS 7 yum 安装redis(更简单)

    一.安装redis 1.检查是否有redis yum 源 1 yum install redis 2.下载fedora的epel仓库 1 yum install epel-release 3.安装re ...

  8. redis学习之——CentOS 6 下载安装redis

    一.检查当前环境: 安装过程中没有这些,命令,在CentOS 6,最小安装导致..如果执行完命令,Noting  to  do...字样说明环境正常. yum -y install rpm gcc w ...

  9. CentOS 7 下安装redis步骤

    1. 从redis官网下载redis源码,本例安装在/usr/opt下 [root@localhost opt]# pwd /usr/opt [root@localhost opt]# wget ht ...

  10. centos 6.5 安装 redis

    下载软件: wget wget http://download.redis.io/releases/redis-2.8.7.tar.gz 2.解压软件并编译安装: tar -zxvf redis-2. ...

随机推荐

  1. Ubuntu16.04 LTS下apt安装WireShark

    Ubuntu16.04 LTS下apt安装WireShark 安装与配置 首先通过apt安装WireShark: $ sudo apt install wireshark 会同时安装许多的依赖包,其中 ...

  2. OpenStack 企业私有云的若干需求(4):混合云支持 (Hybrid Cloud Support)

    本系列会介绍OpenStack 企业私有云的几个需求: 自动扩展(Auto-scaling)支持 多租户和租户隔离 (multi-tenancy and tenancy isolation) 混合云( ...

  3. C# 带签名dll破解

    首先申明,本文只是从技术的角度来分析下怎样破解带签名的C#写的dll文件.大家如有遇到收费的软件或类库还是应该去购买正版,程序员何苦为难程序员呢. 不带签名的破解 不带签名的dll文件的破解很简单,通 ...

  4. 【repost】js 常见错误类型

    1)SyntaxError SyntaxError是解析代码时发生的语法错误 // 变量名错误  var 1a;  // 缺少括号  console.log 'hello'); (2)Referenc ...

  5. 2015最流行的Android组件、工具、框架大全

    Android 是目前最流行的移动操作系统之一. 随着新版本的不断发布, Android的功能也日益强大, 涌现了很多流行的应用程序, 也催生了一大批的优秀的组件. 本文试图将目前流行的组件收集起来以 ...

  6. POJ 1637 Sightseeing tour

    Sightseeing tour Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9276   Accepted: 3924 ...

  7. JAVA中使用FTPClient实现文件上传下载实例代码

    一.上传文件 原理就不介绍了,大家直接看代码吧 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 ...

  8. 主席树——求静态区间第k大

    例题:poj2104 http://poj.org/problem?id=2104 讲解:http://blog.sina.com.cn/s/blog_6022c4720102w03t.html ht ...

  9. C++类继承关系视图的自动生成

    原创文章,转载请注明出处. 工欲善其事,必先利其器.阅读大型C++工程项目,如果有一些自动化的分析工具支持,学习的效率将大大提升.在前文中介绍了Source Insight在Linux下的安装方法,本 ...

  10. [LeetCode] Reorder List 链表重排序

    Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do th ...