linux 安装redis7

2024-01-04  本文已影响0人  莫客991

1、下载redis tar包

wget https://github.com/redis/redis/archive/7.2.3.tar.gz

2、解压压缩文件

tar -zxvf 7.2.3.tar.gz

3、切换到对应的目录,执行make命令

cd redis-7.2.3/
编译
make
出现错误,提示没有gcc
安装gcc编译器
yum install -y gcc

4、清理执之前编译的垃圾

make distclean

5、重新执行make命令

make
指定定安装目录
make install PREFIX=/opt/heng/redis7

6、配置环境变量,修改profile文件

vi /etc/profile
拉到最后一行,添加如下代码:
export REDIS_HOME=/opt/heng/redis
export PATH=$PATH:$REDIS_HOME/bin

7、安装redis成一个服务

cd utils
[root@mysql utils]# sh 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] 6381
Please select the redis config file name [/etc/redis/6381.conf]
Selected default - /etc/redis/6381.conf
Please select the redis log file name [/var/log/redis_6381.log]
Selected default - /var/log/redis_6381.log
Please select the data directory for this instance [/var/lib/redis/6381]
Selected default - /var/lib/redis/6381
Please select the redis executable path [/usr/local/bin/redis-server]
Selected config:
Port : 6381
Config file : /etc/redis/6381.conf
Log file : /var/log/redis_6381.log
Data dir : /var/lib/redis/6381
Executable : /usr/local/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/6381.conf => /etc/init.d/redis_6381
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...

Installation successful!

8、启动服务

service redis_67381 start

上一篇 下一篇

猜你喜欢

热点阅读