一、安装依赖包和开发工具:

yum install vim vim-enhanced wget zip unzip telnet ntsysv compat* apr* nasm* gcc gcc* gcc-c++ ntp make imake cmake automake autoconf python-devel zlib zlib-devel glibc glibc-devel glib2 libxml glib2-devel libxml2 libxml2-devel bzip2 bzip2-devel libXpm libXpm-devel libidn libidn-devel libtool libtool-ltdl-devel* libmcrypt libmcrypt-devel libevent-devel libmcrypt* libicu-devel libxslt-devel postgresql-devel curl curl-devel perl perl-Net-SSLeay pcre pcre-devel ncurses ncurses-devel openssl openssl-devel openldap openldap-devel openldap-clients openldap-servers krb5 krb5-devel e2fsprogs e2fsprogs-devel libjpeg libpng libjpeg-devel libjpeg-6b libjpeg-devel-6b libpng-devel libtiff-devel freetype freetype-devel fontconfig-devel gd gd-devel kernel screen sysstat flex bison nss_ldap pam-devel compat-libstdc++-

二、解压、编译、安装redis_3.0:

tar zxvf redis-.tar.gz -C /usr/src/
cd /usr/src/redis-/
make && make install

三、创建redis相关目录:

mkdir -p /home/redis/log
mkdir -p /home/redis/pid
mkdir -p /home/redis/db
mkdir -p /etc/redis/

四、编辑redis.conf配置文件:

cp /usr/src/redis-/redis.conf /etc/redis/redis.conf
ln -s /etc/redis/redis.conf /etc/redis.conf
vim /etc/redis.conf
daemonize yes
pidfile "/home/redis/pid/redis.pid"
port
tcp-backlog
timeout
tcp-keepalive
loglevel notice
logfile "/home/redis/log/redis.log"
databases
save
save
save
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename "dump.rdb"
dir "/home/redis/db"
requirepass "redis-Passw0rd!"
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay
repl-disable-tcp-nodelay no
slave-priority
rename-command CONFIG ""
rename-command FLUSHALL ""
rename-command FLUSHDB ""
rename-command KEYS ""
maxmemory 1G
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit
slowlog-log-slower-than
slowlog-max-len
latency-monitor-threshold
notify-keyspace-events ""
hash-max-ziplist-entries
hash-max-ziplist-value
list-max-ziplist-entries
list-max-ziplist-value 

zset-max-ziplist-entries
zset-max-ziplist-value
hll-sparse-max-bytes
activerehashing yes
client-output-buffer-limit normal
client-output-buffer-limit slave 256mb 64mb
client-output-buffer-limit pubsub 32mb 8mb
hz
aof-rewrite-incremental-fsync yes

五、编写redis启动脚本:

vim /etc/init.d/redis
#!/bin/sh
# chkconfig:
# Description:        Start and Stop redis
# Provides:        redis
# Default-Start:
# Default-Stop:
PATH=/usr/local/bin:/sbin:/usr/bin:/bin
REDISPORT=
EXEC=/usr/local/bin/redis-server
REDIS_CLI=/usr/local/bin/redis-cli
PIDFILE=/home/redis/pid/redis.pid
CONF="/etc/redis/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
" ]
then
echo "Redis is running..."
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping Redis server..."
$REDIS_CLI -p $REDISPORT SHUTDOWN
while [ -x ${PIDFILE} ]
do
echo "Waiting for Redis to shutdown ..."
sleep
done
echo "Redis is stopped"
fi
;;
restart|reload)
${} stop
${} start
;;
*)
echo
exit
esac

六、添加redis系统服务:

chmod a+x /etc/init.d/redis
chkconfig --add redis
chkconfig --level  redis on
chkconfig --list | grep redis

七、启动redis服务:

service redis start
ps -aux | grep redis
netstat -anptu | grep 

八、测试:

redis-cli -h  -a redis-Passw0rd!

九、防火墙启用6379端口:

iptables -A INPUT -p tcp --dport  -j ACCEPT

CentOS_7.2安装Redis_3.0的更多相关文章

  1. Linux(CentOS_7.6)安装Nginx

    1.安装依赖 12 yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel 2.下载Nginx并解压 1234567 c ...

  2. 编译安装 varnish-4.1.2和yum 安装 varnish-4.0.3

    vanish可以让用户自己选择缓存数据是存于内存还是硬盘,存于内存一般基于二八法则即常访问的数据是磁盘存储的总数据五分之一,因此内存也应该是硬盘文件大概五分之一.如果有多台vanish则,总内存满足即 ...

  3. Ubuntu14.04 64位机上安装cuda8.0 cudnn5.0操作步骤 - 网络资源是无限的

    查看Ubuntu14.04 64位上显卡信息,执行: lspci | grep -i vga lspci -v -s 01:00.0 nvidia-smi 第一条此命令可以显示一些显卡的相关信息:如果 ...

  4. win7中VS2010中安装CSS3.0问题解决方法

    win7中VS2010中安装CSS3.0问题解决方法   在安装Standards Update for VS2010 SP1后,VS2010中没有CSS3.0问题,以下是我的解决方法 1.首先去官网 ...

  5. mac os x安装php7.0和phalcon3.0

    1,安装xampp(with php7.0) 下载地址: https://www.apachefriends.org/download.html 2,安装phalcon3.0 cd ~/git clo ...

  6. Debian8.3.0下安装Odoo8.0步骤

    Debian8.3.0下安装Odoo8.0的方法 假设你已经安装好了Debian 系统,使用root帐号执行如下命令 # apt-get update && apt-get upgra ...

  7. Ubuntu 安装OpenCV3.0.0

    Ubuntu安装OpenCV3.0.0 为了看看opencv3.0的HDR效果,尝试安装opencv3.0到ubuntu12.04上面,安装了好几次终于成功了. 参考博客: http://www.sa ...

  8. win8下安装matlab7.0

    在win8下安装matlab7.0会出现一些兼容性的问题,需要设置系统环境变量,修改方式如下. 1.设置环境变量,方法:在你的安装目录的\MATLAB7\bin\win32有一个叫做atlas_Ath ...

  9. (转载)CentOS6下 源代码方式安装openERP7.0

    CentOS6下 源代码方式安装openERP7.0 安装背景 :CPU32 bit,CentOS 6.4版本,openERP7.0,linux shell为bash,PostgreSQL9.2 1. ...

随机推荐

  1. js实现控制日期月份增减

    定义一个当前日期变量 var myDate = new Date(); 处理月份添加函数(date当前日期,num增加的月份[正数:增加月份,负数:减少月份])function addMonth(da ...

  2. java Http编程小结

    1:什么是HTTP? 超文本传输协议(HyperText Transfer Protocol -- HTTP)是一个设计来使客户端和服务器顺利进行通讯的协议. HTTP在客户端和服务器之间以reque ...

  3. javascript数据属性和访问器属性

    var book={ _year:2004, edition:1};Object.defineProperty(book,"year",{ get:function(){ retu ...

  4. 解决Unity3D导出apk失败:Failed to re-package resources

    前几天把系统重装了一下,重新安装Unity3D和Android Studio之后发现过去的文件都不能导出了. 错误信息主要包括: CommandInvokationFailure: Failed to ...

  5. ooize的使用01

    1.常用的调度框架 1.1 linux crontab 1.1.1 编写一个crontab,每一分钟向/opt/data/cronlogs文件中添加当前时间 crontab -e

  6. Overload和Override的区别

    Overload:重载 |- 在一个类中定义的若干方法 |- 所有的方法名相同,但参数类型或个数不同 |- 只有参数有关,与返回类型无关 Override:覆写 |- 在继承的关系中 |- 子类定义了 ...

  7. C#获得类的方法和方法参数

    Type t = typeof(CommonController); StringBuilder str = new StringBuilder(); MethodInfo[] methors = t ...

  8. Linux查看程序端口占用情况

    今天发现服务器上Tomcat 8080端口起不来,老提示端口已经被占用. 使用命令: ps -aux | grep tomcat 发现并没有8080端口的Tomcat进程. 使用命令:netstat ...

  9. FAQ

    1.Baudrare and the speed of Byte. 2. Linux FS and Flash store. 3. SW's Coupling. 4. Protocol and Pro ...

  10. About next_permutation

    哈哈没错这个又是我们C++党的语言优势之一,用这个函数可以求当前排序的下一个排序,也就是说可以方便的求全排列,用这个函数需要用到algorithm这个头文件. 与这个函数相反的是prev_permut ...