- 更新CentOS系统:
yum -y update
- 安装wget vim:
yum -y install wget vim
- 下载 Redis 5.0.3:
wget http://download.redis.io/releases/redis-5.0.3.tar.gz
- 解压:
tar -zxvf redis-5.0.3.tar.gz
- 进入 redis-5.0.3 文件夹:
cd redis-5.0.3
- 编译前安装编译软件:
yum -y install gcc
- 编译前安装编译软件: 如果没有安装过gcc,可能会出现如下问题:
/bin/sh: cc: command not found
- 编译前安装编译软件: 如果没有安装过gcc,可能会出现如下问题:
- 编译:
make
- 编译时如果出现:
使用以下命令编译:zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory #include <jemalloc/jemalloc.h>
make MALLOC=libc
- 编译时如果出现:
- 编译完成,测试安装:
make test
- 编译时,如果出现:
You need tcl 8.5 or newer in order to run the Redis test
则需要安装 tcl,命令:
yum -y install tcl
然后重新测试安装:
make test
- 编译时,如果出现:
- 测试安装没有问题后,进行编译安装:
make install
-
编译安装完成,进入 utils文件夹:
cd utils/
-
执行 install_server.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]
中文翻译:
欢迎使用redis服务安装程序 此脚本将帮助您轻松设置正在运行的redis服务器 请为此实例选择redis端口:[6379]
如果默认,点击回车,否则输入自定义redis端口。
-
设置完端口后,设置配置文件:
Please select the redis config file name [/etc/redis/6379.conf]
中文翻译:
请选择redis配置文件名[/etc/redis/6379.conf]
如果默认,点击回车,否则输入自定义redis配置文件目录及文件名。
-
设置完配置文件后,设置日志配置:
Please select the redis log file name [/var/log/redis_6379.log]
中文翻译:
请选择redis日志文件名[/var/log/redis_6379.log]
如果默认,点击回车,否则输入自定义redis日志文件目录及文件名。
-
设置完日志配置后,设置数据配置:
Please select the data directory for this instance [/var/lib/redis/6379]
中文翻译:
请为此实例选择数据目录[/var/lib/redis/6379]
如果默认,点击回车,否则输入自定义redis数据目录。
-
设置完数据配置后,设置执行文件目录:
Please select the redis executable path [/usr/local/bin/redis-server]
中文翻译:
请选择redis可执行路径[/usr/local/bin/redis-server]
如果默认,点击回车,否则输入自定义redis可执行文件目录。
-
提示:
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
中文翻译:
这个可以吗? 然后按ENTER继续,或按Ctrl-C中止。
设置完成,点击回车,终止设置,按 Ctrl+C,重新设置需要重新运行。
-
-
常用命令:
-
列出服务:
chkconfig --list
-
列出Redis服务:
chkconfig --list redis_6379
-
删除Redis服务:
chkconfig --del redis_6379
-
添加Redis服务:
chkconfig --add redis_6379
-
停止Redis服务:
/etc/init.d/redis_6379 stop
-
启动 Redis服务:
/etc/init.d/redis_6379 start
-
重启Redis服务:
/etc/init.d/redis_6379 restart
-
查看Redis状态:
/etc/init.d/redis_6379 status
-
CentOS 1810 安装 Redis 5.0.3
猜你喜欢
转载自blog.csdn.net/qq_32596527/article/details/88080515
今日推荐
周排行