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 [/usr/local/bin/redis-server] /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 : /usr/local/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
标签:opt,方式,root,redis,server,7.0,安装,localhost
From: https://www.cnblogs.com/zbc230/p/17072745.html