本文是讲述, 如何在centos6.x 系统下如何配置 redis为一个自动启动的服务的过程
在操作过程中 始终需要 root权限
一. Redis安装
特别注意 redis的安装目录 如上图
下载redis 安装程序
wget http://download.redis.io/releases/redis-2.8.19.tar.gz
解压缩redis安装源代码
tar xzvf redis-2.8.19.tar.gz
cd redis-2.8.19/
安装redis
make PREFIX=/usr/local/redis install
一定要安装到特定目录中
拷贝redis配置文件到安装目录
cp redis.conf /usr/local/redis/
vi /usr/local/redis/redis.conf
二.安装Redis启动服务的辅助程序
- 下载
wget http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz
- 解压缩
tar zxf apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz
- 编译安装
cd apps/sys-utils/start-stop-daemon-IR1_9_18-2/
gcc start-stop-daemon.c -o start-stop-daemon
cp start-stop-daemon /usr/local/bin/start-stop-daemon
也可以从这里下载, 然后上传, 最后用上面步骤安装
apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar
三.Redis启动服务的安装
1. 下载 安装代码
从上面地址下载源代码
2. 上传到服务器
3. 解压缩源代码
4. 运行安装命令安装
sh install.sh
如下图
5. 配置启动自动运行
chkconfig --level 2 redis-server on && chkconfig --level 3 redis-server on && chkconfig --level 4 redis-server on && chkconfig --level 5 redis-server on
最后检查一下是否设置成功
chkconfig --list
显示如下:
redis-server 0:off 1:off 2:on 3:on 4:on 5:on 6:off
安装完成