zoukankan      html  css  js  c++  java
  • centos下的redis一键安装shell脚本

    #!/bin/bash
    yum install cpp binutils glibc-kernheaders glibc-common glibc-devel gcc make wget    #安装依赖库
    wget http://download.redis.io/releases/redis-4.0.1.tar.gz
    if [ -f /root/redis-4.0.1.tar.gz ];then
        tar zxvf redis-4.0.1.tar.gz
        mv redis-4.0.1 /usr/local/redis
        cd /usr/local/redis
        make
        cd src/
        make install 
    else
        echo "文件不存在!"
        exit;
    fi
    
    sed -i '136s/daemonize no/daemonize yes/' /usr/local/redis/redis.conf    #(编辑redis服务配置文件,修改其中配置)
    
    sed -i '69s/127.0.0.1/0.0.0.0/' /usr/local/redis/redis.conf 
    
    sed -i '88s/protected-mode yes/protected-mode no/' /usr/local/redis/redis.conf
     mkdir -p /etc/redis
     ln -s /usr/local/redis/redis.conf /etc/redis/6379.conf   #(在默认的配置文件路劲中放置配置文件)
     ln -s /usr/local/redis/utils/redis_init_script /etc/init.d/redisd    #(将初始化文件配置到系统自启动的文件夹内,redisd为服务名,可自行修改)
     service redisd start   #(开启redis服务,服务名为:redisd)
     #redis-cli  
    netstat -ntpl|grep redis
    echo "Redis 部署完成!"
    echo " "
    echo "如果你的系统是Centos 7在安装完毕后留意防火墙,可执行以下命令来放行redis 外部通信。"
    echo "firewall-cmd --zone=public --add-port=6379/tcp --permanent"    
    echo "firewall-cmd --reload"
    echo "firewall-cmd --zone= public --query-port=6379/tcp"

    可根据个人需要酌情修改。

    #!/bin/bash
    yum install cpp binutils glibc-kernheaders glibc-common glibc-devel gcc make wget    #安装依赖库
    wget http://download.redis.io/releases/redis-4.0.1.tar.gz
    if [ -f /root/redis-4.0.1.tar.gz ];then
        tar zxvf redis-4.0.1.tar.gz
        mv redis-4.0.1 /usr/local/redis
        cd /usr/local/redis
        make
        cd src/
        make install 
    else
        echo "文件不存在!"
        exit;
    fi
    
    sed -i '136s/daemonize no/daemonize yes/' /usr/local/redis/redis.conf    #(编辑redis服务配置文件,修改其中配置)
    
    sed -i '69s/127.0.0.1/0.0.0.0/' /usr/local/redis/redis.conf 
    
    sed -i '88s/protected-mode yes/protected-mode no/' /usr/local/redis/redis.conf
     mkdir -p /etc/redis
     ln -s /usr/local/redis/redis.conf /etc/redis/6379.conf   #(在默认的配置文件路劲中放置配置文件)
     ln -s /usr/local/redis/utils/redis_init_script /etc/init.d/redisd    #(将初始化文件配置到系统自启动的文件夹内,redisd为服务名,可自行修改)
     service redisd start   #(开启redis服务,服务名为:redisd)
     #redis-cli  
    netstat -ntpl|grep redis
    echo "Redis 部署完成!"
    echo " "
    echo "如果你的系统是Centos 7在安装完毕后留意防火墙,可执行以下命令来放行redis 外部通信。"
    echo "firewall-cmd --zone=public --add-port=6379/tcp --permanent"    
    echo "firewall-cmd --reload"
    echo "firewall-cmd --zone= public --query-port=6379/tcp"
  • 相关阅读:
    微擎签名出错 invalid signature
    微擎 pdo_fetchall() 函数
    Qt 文本文件的读写操作
    Qt Qlistwidget、Qlistview
    Qt保留小数点后一位、两位……
    Excel怎么快速删除全部空行
    光学镜头参数详解(EFL、TTL、BFL、FFL、FBL/FFL、FOV、F/NO、RI、MTF、TV-Line、Flare/Ghost)
    Image J 介绍
    C# MODBUS协议上位机程序
    C/C++ memmove与memcpy的区别及实现
  • 原文地址:https://www.cnblogs.com/thinheader/p/9503899.html
Copyright © 2011-2022 走看看