Linux 安装redis
1.下载地址:http://redis.io/download,下载最新稳定版本。

2:导入到linux usr/local/src 下

3:安装gcc环境,执行如下命令:
$ yum -y install gcc automake autoconf libtool make
4.进行配置
(1)在redis根目录找到一个叫redis.conf的文件,这个文件是redis的配置文件

(2)使用vi命令编辑该文件
将protected-mode yes 改为no

将daemonize-no 改为yes

5.说明
daemonize yes : redis采用的是单进程多线程的模式。当redis.conf中选项daemonize设置成yes时,代表开启守护进程模式。在该模式下,redis会在后台运行,,此时redis将一直运行,除非手动kill该进程。
daemonize no : 当daemonize选项设置成no时,当前界面将进入redis的命令行界面,exit强制退出或者关闭连接工具都会导致redis进程退出。
redis3.2版本后新增protected-mode配置,默认是yes,即开启。设置外部网络连接redis服务,设置方式如下:
1、关闭protected-mode模式,此时外部网络可以直接访问
2、开启protected-mode保护模式,需配置bind ip或者设置访问密码
6.执行如下命令即可后台启动redis
./src/redis-server ./redis.conf

7.查看redis是否后台启动成功
ps -ef|grep redis

8.最后启动redis服务发现用SecureCRT连接不上,设置网络

注:
1.如果还连不上需要关闭防火墙:
CentOS 7.0默认使用的是firewall作为防火墙
查看防火墙状态
firewall-cmd --state
停止firewall
systemctl stop firewalld.service
禁止firewall开机启动
systemctl disable firewalld.service
2.如果解压找不到redis-server
使用 make 出现如下情况 说明未安装,使用命令安装gcc:yum install gcc , 原因:Redis是C实现的,所以需要gcc来进行编译
[root@localhost redis-4.0.8]# make
cd src && make all
则将make改为make MALLOC=libc,可能是因为编译库的问题吧。
[root@localhost redis-2.8.17]# make
cd src && make all

浙公网安备 33010602011771号