Centos7安装redis
1.下载redis源码
wget http://download.redis.io/releases/redis-4.0.10.tar.gz
2.解压缩
tar -zxf redis-4.0.10.tar.gz
3.切换redis源码目录
cd redis-4.0.10
4.编译源文件
make
5.编译好后,src/目录下有编译好的redis指令
6.make install 安装到指定目录,默认在/usr/local/bin
make install
7 创建一个redis的配置文件redsi-6379.conf
mkdir -p /opt/redis_conf
cd /opt/redis_conf
vim redis-6379.conf
添加以下配置:
port 6379
daemonize yes
pidfile /data/6379/redis.pid
loglevel notice
logfile "/data/6379/redis.log"
dir /data/6379
protected-mode yes
requirepass haohaio
# redis配置文件详解
port 6379 # 运行在6379的redis数据库实例
daemonize yes # 后台运行redis
pidfile /data/6379/redis.pid # 存放redis pid的文件
loglevel notice # 日志等级
logfile "/data/6379/redis.log" # 指定redis日志文件的生成目录
dir /data/6379 # 指定redis数据文件夹的目录
protected-mode yes # 安全模式
requirepass haohaio # 设置redis的密码
8 创建相应的目录:
mkdir -p /data/6379
9 启动redis
redis-server /opt/redis_conf/redis-6379.conf