首页 / LINUX / Linux 安装Redis
Linux 安装Redis
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Linux 安装Redis,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1670字,纯文字阅读大概需要3分钟。
内容图文
![Linux 安装Redis](/upload/InfoBanner/zyjiaocheng/871/7b86bb88f57c47798bf7d68680426656.jpg)
Linux版本信息:
[root@VM-0-12-centos bin]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
安装gcc环境:
[root@VM-0-12-centos bin]# yum install gcc
Centos7默认gcc4,Redis6需要gcc9
将下载好安装上传到linux,并解压到安装目录:
[root@VM-0-12-centos bin]# tar -zxvf redis-6.0.8.tar.gz -C /usr/local/redis/
[root@VM-0-12-centos bin]# cd /usr/local/redis/redis-6.0.8/
编译安装:
[root@VM-0-12-centos bin]# make
[root@VM-0-12-centos bin]# make install PREFIX=/usr/local/redis/redis-6.0.8
启动Redis:
[root@VM-0-12-centos redis-6.0.8]# cd bin/
[root@VM-0-12-centos bin]# ls
dump.rdb redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server
[root@VM-0-12-centos bin]# ./redis-server
配置后台启动Redis,并加入开机启动:
修改 redis.conf 文件,把 daemonize no 改为 daemonize yes
[root@VM-0-12-centos redis-6.0.8]# vi /usr/local/redis/redis-6.0.8/redis.conf
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes
添加开启启动服务(systemctl):
[root@VM-0-12-centos redis-6.0.8]# vi /etc/systemd/system/redis.service
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/redis/redis-6.0.8/bin/redis-server /usr/local/redis/redis-6.0.8/bin/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
# 重新加载启动项,设为开启启动,启动Redis
systemctl daemon-reload
systemctl enable redis.service
systemctl start redis.service
测试:
# 创建软连接
ln -s /usr/local/redis/redis-6.0.8/bin/redis-cli /usr/bin/redis
[root@VM-0-12-centos redis-6.0.8]# redis
127.0.0.1:6379> ping
PONG
内容总结
以上是互联网集市为您收集整理的Linux 安装Redis全部内容,希望文章能够帮你解决Linux 安装Redis所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。