centos7安装redis

下载wget http://download.redis.io/releases/redis-4.0.6.tar.gz

解压tar -zxvf redis-4.0.6.tar.gz

cd redis-4.0.6
make MALLOC=libc
cd src && make install
./redis-server
修改配置文件
将daemonize no修改为daemonize yes
./redis-server /usr/local/redis-4.0.6/redis.conf

设置开机启动
在/etc目录下新建redis目录
cp /usr/local/redis-4.0.6/redis.conf /etc/redis/6379.conf

cp /usr/local/redis-4.0.6/utils/redis_init_script /etc/init.d/redisd

chkconfig redisd on

报错如下
service redisd does not support chkconfig 
编辑redisd文件,在第一行加入如下两行注释,保存退出
# chkconfig:   2345 90 10
# description:  Redis is a persistent key-value database
再次执行
chkconfig redisd on

启动服务:

service redisd start 

 

开机启动方法二:

vim /etc/rc.d/rc.local
加入
/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
posted @ 2019-12-27 10:46  程序员小艺  阅读(241)  评论(0编辑  收藏  举报