欢迎来到李先生的博客

深山的鹿,不知归处;万般皆苦,只可自渡。
扩大
缩小

Centos7下安装redis并能使得外网访问

一、安装脚本

#!/bin/bash

#FileName: install_redis_centos7.sh
#Date: 20190523
#Author: LiLe
#Contact: 836217653@qq.com
#Version: V1.0
#Description: centos7下安装redis


install_env(){
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    sed -i  's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo
    yum repolist 
}


download(){
    wget http://download.redis.io/releases/redis-5.0.5.tar.gz
    tar xzf redis-5.0.5.tar.gz
    cd redis-5.0.5
    make
}

install_env
download

 

二、修改配置文件

bind需注释掉,其余两项参数设置为no
#bind 127.0.0.1
protected-mode no
daemonize no

 

三、启动

nohup redis-5.0.5/src/redis-server redis-5.0.5/redis.conf

 

注:
1)这里启动的时候一定要指定配置文件,他默认并不会加载
2)外网访问要注意网络以及安全组是否将端口开放

posted on 2019-05-23 11:17  Captain_Li  阅读(1825)  评论(0编辑  收藏  举报

导航