测试环境centos6.x、centos7.x
参考:https://blog.csdn.net/AlexWoo0501/article/details/50471696
下载安装文件:https://github.com/AlexWoo/aw_script/blob/master/Redis/install_redis.sh
redis最新版下载地址:http://download.redis.io/releases
现在最新版本为http://download.redis.io/releases/redis-5.0.5.tar.gz
我这里把安装文件下载到本地了
安装支持组件

yum install wget gcc ntpdate net-tools -y
ntpdate -u ntp.ubuntu.com

下载安装脚本并给执行权限

wget http://source.loshub.com/linux/redis/install_redis.sh
chmod +x  install_redis.sh

更改6379端口,防止来扫描,可以自定义你的端口 这里改为16739

./install_redis.sh redis_pack_director [16379]

创建redis普通用户并进入redis用户并安装redis

useradd redis
mv install_redis.sh /home/redis/
su - redis
wget http://download.redis.io/releases/redis-5.0.5.tar.gz
tar zxvf redis-5.0.5.tar.gz
./install_redis.sh redis-5.0.5

等待安装完成后返回root用户

su - root

centos6或5系统

chown -R root:root /home/path/redis.service
mv /home/path/redis.service /etc/init.d

启动、停止、重启 redis服务

service redis.service start
service redis.service stop
service redis.service restart

添加开启启动

chkconfig --add redis.service
chkconfig redis.service on

如果是centos7

chown -R root:root /home/redis/redis.service
mv /home/redis/redis.service /etc/systemd/system

开启、停止、重启服务

systemctl start redis.service
systemctl stop redis.service
systemctl restart redis.service

加入开机启动

systemctl enable redis.service

查看redis是否运行

ps -ef|grep redis

成功

分类: redis 标签: 暂无标签

评论

暂无评论数据

暂无评论数据

目录