redis安装方式
1、源码包编码安装
-
操作系统版本centos7.6
-
redis版本是7.0.8
1.1 安装工具
[root@localhost ~]# yum install gcc gcc-c++ tcl -y
1.2 创建安装目录
[root@localhost ~]# mkdir /opt/redis-7.0.8
[root@localhost ~]# mkdir /opt/redis-7.0.8/{log,bin,etc}
1.3 解压安装
[root@localhost ~]# tar -zxvf redis-7.0.8.tar.gz
[root@localhost ~]# cd redis-7.0.8
[root@localhost redis-7.0.8]# make
...
zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h:没有那个文件或目录
# 处理zmalloc.h异常
[root@localhost redis-7.0.8]# make MALLOC=libc
# 可省略,测试是否有异常
[root@localhost redis-7.0.8]# make test
All tests passed without errors!
# 拷贝redis相关工具命令
[root@localhost redis-7.0.8]# cd src/
[root@localhost src]# cp redis-check-aof redis-check-rdb redis-benchmark redis-cli redis-server /opt/redis-7.0.8/bin/
# 开始安装
[root@localhost src]# cd ../utils/
# 直接运行安装脚本,出现如下提示信息
[root@localhost utils]# ./install_server.sh
Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!
# 编辑安装脚本,注释以下内容
[root@localhost utils]# vim install_server.sh
##bail if this system is managed by systemd
#_pid_1_exe="$(readlink -f /proc/1/exe)"
#if [ "${_pid_1_exe##*/}" = systemd ]
#then
# echo "This systems seems to use systemd."
# echo "Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!"
# exit 1
#fi
# 再次执行安装脚本
[root@localhost utils]# ./install_server.sh
Welcome to the redis service installer
This script will help you easily set up a running redis server
Please select the redis port for this instance: [6379] 7480
Please select the redis config file name [/etc/redis/7480.conf] /opt/redis-7.0.8/etc/redis.conf
Please select the redis log file name [/var/log/redis_7480.log] /opt/redis-7.0.8/log/redis.log
Please select the data directory for this instance [/var/lib/redis/7480] /opt/redis-7.0.8/lib/redis
Please select the redis executable path [] /opt/redis-7.0.8/bin/redis-server
Selected config:
Port : 7480
Config file : /opt/redis-7.0.8/etc/redis.conf
Log file : /opt/redis-7.0.8/log/redis.log
Data dir : /opt/redis-7.0.8/lib/redis
Executable : /opt/redis-7.0.8/bin/redis-server
Cli Executable : /opt/redis-7.0.8/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/7480.conf => /etc/init.d/redis_7480
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
# 查看redis进程
[root@localhost utils]# ps -ef | grep redis
root 33477 1 0 15:05 ? 00:00:00 /opt/redis-7.0.8/bin/redis-server 127.0.0.1:7480
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!