00 实验环境
# 发行版信息[root@localhost ~]# cat /etc/redhat-releaseCentOS Linux release 7.6.1810 (Core)# 内核[root@localhost ~]# uname -r3.10.0-957.el7.x86_64# 时间chery@cherysc ~ date2019年 1月 9日 星期三 夜间
01 实验目的
在本机上通过编译安装的方式安装并配置redis
02 实验软件选择
020 redis选择版本
源码编译方式:redis-5.0.3.tar.gz
地址为:http://download.redis.io/releases/redis-5.0.3.tar.gz
03 准备安装
030 准备安装软件
[root@redis01 ~]# mkdir -p /root/tools[root@redis01 ~]# cd /root/tools/[root@redis01 tools]# wget http://download.redis.io/releases/redis-5.0.3.tar.gz
031 准0备依赖包(此方法已经放弃)
yum install tcl jemallocyum install -y
jemalloc 内存分配管理 ~~如果不安装tcl,就在make test中报错:make[1]: 进入目录“/root/tools/redis-5.0.3/src”You need tcl 8.5 or newer in order to run the Redis test~~
031 开始编译安装依赖包包
更新:
04 开始安装
040 解压安装包
[root@redis01 tools]# tar xf redis-5.0.3.tar.gz[root@redis01 tools]# lsPython-3.6.8 Python-3.6.8.tgz redis-5.0.3 redis-5.0.3.tar.gz[root@chery tools]# cd redis-5.0.3[root@chery Python-3.6.8]# lsaclocal.m4 configure Grammar Lib Makefile.pre.in Objects PCbuild Python Toolsconfig.guess configure.ac Include LICENSE Misc Parser Programs README.rstconfig.sub Doc install-sh Mac Modules PC pyconfig.h.in setup.py
041 编译安装redis依赖包
[root@redis01 tools]# cd redis-5.0.3/deps/[root@redis01 deps]# lshiredis jemalloc linenoise lua Makefile README.md update-jemalloc.sh# 就是安装上述这几个[root@redis01 deps]# make hiredis jemalloc linenoise lua[root@redis01 deps]# cd ..
042 开始编译
[root@redis01 redis-5.0.3]# make PREFIX=/opt/redis-5 install
PREFIX=/opt/redis-5这个地方配置和之前的python3的不一样
05 配置redis
050 创建软连接
[root@redis01 redis-5.0.3]# cd /opt/redis-5/bin/[root@redis01 bin]# lsredis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server[root@redis01 bin]# cd /opt[root@redis01 opt]# lspython3 redis-5## 开始创建软连接[root@redis01 opt]# ln -s redis-5 redis[root@redis01 opt]# lspython3 redis redis-5[root@redis01 opt]# lltotal 0drwxr-xr-x. 6 root root 56 Jan 12 16:54 python3lrwxrwxrwx. 1 root root 7 Jan 14 17:37 redis -> redis-5drwxr-xr-x. 3 root root 17 Jan 14 17:36 redis-5
050添加全局变量(推荐)
当然也可以用软连接,不推荐
[root@redis01 opt]# echo 'PATH=/opt/redis/bin:$PATH' >>/etc/profile[root@redis01 opt]# source /etc/profile[root@redis01 opt]# echo $PATH/opt/redis/bin:/opt/python3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@redis01 opt]# cd redis[root@redis01 redis]# vim redis-6379.conf##编辑内容port 6379daemonize yespidfile /data/6379/redis.pidloglevel noticelogfile "/data/6379/redis.log"dir /data/6379protected-mode no # 此配置之前写的是yes,改成no是为了远程访问
051 创建一个log文件目录
[root@redis01 redis]# mkdir -p /data/6379/
06 启动redis
检测命令
[root@redis01 redis]# redis-server -vRedis server v=5.0.3 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=67220f391b5a2ba0[root@redis01 redis]# redis-cli -vredis-cli 5.0.3
开启服务
[root@redis01 redis]# redis-server redis-6379.conf
连接测试
[root@redis01 redis]# redis-cli127.0.0.1:6379>
[参考]
1 https://blog.csdn.net/zhangshu123321/article/details/51440106
Ubuntu 14.04下Redis安装报错:“You need tcl 8.5 or newer in order to run the Redis test”问题解决
2 https://www.cnblogs.com/cndavidwang/p/6429406.html 在CentOS 7中安装Redis 3.2.8
3 http://www.runoob.com/w3cnote/redis-external-network.html 配置 redis 外网可访问
