第九章 编译安装 Redis 服务器

该文章根据 CC-BY-4.0 协议发表,转载请遵循该协议。
本文地址:https://fenying.net/book/minicentos-handbook/09.compile-redis/

本章编译安装 Redis 3.2.5 。

编译 Redis 相较前几个简单得多:

1tar -zxvf redis-3.2.5.tar.gz
2cd redis-3.2.5
3make

即完成了编译,然后使用 Redis 自带的脚本进行安装:(中括号后面的是要输入的内容)

 1cd utils
 2./install_server.sh
 3Welcome to the redis service installer
 4This script will help you easily set up a running redis server
 5
 6Please select the redis port for this instance: [6379] 6379
 7Please select the redis config file name [/etc/redis/6379.conf] /www/config/redis.conf
 8Please select the redis log file name [/var/log/redis_6379.log] /www/logs/redis.log
 9Please select the data directory for this instance [/var/lib/redis/6379] /www/database/redis
10Please select the redis executable path [] /usr/local/redis/bin
11Is this ok? Then press ENTER to go on or Ctrl-C to abort.
12Copied /tmp/6379.conf => /etc/init.d/redis_6379
13Installing service...
14Successfully added to chkconfig!
15Successfully added to runlevels 345!
16Starting Redis server...
17Installation successful!

这个脚本生成了一个服务文件 /etc/init.d/redis_6379,我们将只改名:

1service redis_6379 stop
2mv /etc/init.d/redis_6379 /etc/init.d/redis

好了,安装完毕。剩下的就是配置 Redis 了,配置文件在 /www/config/redis.conf

comments powered by Disqus