centos7通过wget安装redis
1.下载redis
wget https://download.redis.io/releases/redis-6.2.1.tar.gz
2.解压redis
tar xzf redis-6.2.1.tar.gz
cd redis-6.2.1
make
cd src
make install PREFIX=/usr/local/redis //安装至/usr/local/redis 目录下
4.移动配置文件到安装目录下
cd ../
mkdir /usr/local/redis/etc
mv redis.conf /usr/local/redis/etc
5.配置redis为后台启动
vi /usr/local/redis/etc/redis.conf //将daemonize no 改成daemonize yes
6.配置全局命令
ln -s /usr/local/redis/bin/redis-server /usr/bin/redis-server
7.常用命令
redis-server /usr/local/redis/etc/redis.conf //启动
pkill redis //停止redis
ps -ef |grep redis //查看redis的状态
二、远程连接redis
1.参考https://www.cnblogs.com/XueTing/p/13740991.html
2.redis-server /usr/local/redis/etc/redis.conf //启动redis
三.redis设置开机自启
1.将redis.conf
中daemonize
设置为yes
,确保守护进程开启。
2.打开install_server.sh,注释掉下面的内容:
vim install_server.sh
3.执行安装服务
./redis-6.0.10/utils/install_server.sh
4.现在就可以开机重启,测试系统是否能自启redis了
reboot //重启