七、redis的安装(linux)
1、系统环境
[[email protected] ~]# cat /etc/redhat-release
CentOS Linux release 7.8.2003 (Core)
2、Linux安装yum源
这里安装网络源,首先得确认你自己的server能够上网。
进入阿里镜像仓库网站 https://developer.aliyun.com/mirror/
参照centos镜像步骤操作。
3、下载redis
软件可以在http://redis.cn/寻找 , 目前较新得稳定版是6.0.6
[[email protected] src]# cd /usr/local/src
[[email protected] src]# wget http://download.redis.io/releases/redis-6.0.6.tar.gz
4、 安装
A.安装gcc , redis 6.0以上得版本需要gcc版本在5.3以上,centos7.8默认安装4.8.5,需要升级gcc到5.3及以上
[[email protected] yum.repos.d]#yum install gcc -y
[[email protected] yum.repos.d]# yum install -y gcc-c++.x86_64[[email protected] yum.repos.d]#yum install centos-release-scl scl-utils-build
[[email protected] yum.repos.d]#yum install devtoolset-7-gcc* -y
[[email protected] yum.repos.d]# scl enable devtoolset-7 bash
[[email protected] yum.repos.d]# gcc -v
B.解压 redis 到 usr/local 目录
[[email protected] src]# tar -zxvf redis-6.0.6.tar.gz -C /usr/local/
C.编译安装
[[email protected] local]# cd /usr/local/redis-6.0.6
[[email protected] redis-6.0.6]# make
执行 make 成功的标志
[[email protected] redis-6.0.6]# make install
5、启动 Redis
A.redis得默认安装路径 /usr/local/bin
B.将redis配置文件复制到自建得文件夹下
[[email protected] redis-6.0.6]# cd /usr/local/redis-6.0.6/
[[email protected] local]# mkdir rconfig
[[email protected] local]# cp redis-6.0.6/redis.conf rconfig/
C.redis默认不是后台启动的,修改配置文件daemonize为yes
D.启动Redis服务
[[email protected] local]# cd /usr/local/bin
[[email protected] bin]# redis-server ../rconfig/redis.conf
E.使用redis-cli 进行连接测试
[[email protected] local]# cd /usr/local/bin
[[email protected] bin]# redis-cli -p 6379
F.查看redis的进程是否开启
[[email protected] bin]# ps -ef | grep redis
G.关闭redis服务
安装操作至此完毕。