1. Install gcc dependencies
Since redis is developed in C language, you must first confirm whether the gcc environment (gcc -v) is installed before installation. If it is not installed, execute the following command to install it
[root@localhost local]# yum install -y gcc
2. Download and decompress the installation package
[root@localhost local]# wget http://download.redis.io/releases/redis-5.0.3.tar.gz [root@localhost local]# tar -zxvf redis-5.0.3.tar.gz
3. cd to the redis decompression directory and execute compilation
[root@localhost local]# cd redis-5.0.3 [root@localhost redis-5.0.3]# make
4. Install and specify the installation directory
[root@localhost redis-5.0.3]# make install PREFIX=/usr/local/redis
5. Start the service
5.1 Foreground startup
[root@localhost redis-5.0.3]# cd /usr/local/redis/bin/ [root@localhost bin]# ./redis-server
5.2 Background startup
Copy redis.conf from the redis source code directory to the redis installation directory
[root@localhost bin]# cp /usr/local/redis-5.0.3/redis.conf /usr/local/redis/bin/
Modify the redis.conf file and change daemonize no to daemonize yes
[root@localhost bin]# vi redis.conf
Background startup
[root@localhost bin]# ./redis-server redis.conf
6. Set boot startup
Add boot startup service
[root@localhost bin]# vi /etc/systemd/system/redis.service
Copy and paste the following content:
[Unit] Description=redis-server After=network.target [Service] Type=forking ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf PrivateTmp=true [Install] WantedBy=multi-user.target
Note: ExecStart is configured to its own path
Set up for startup
[root@localhost bin]# systemctl daemon-reload [root@localhost bin]# systemctl start redis.service [root@localhost bin]# systemctl enable redis.service
Create a redis command soft link
[root@localhost ~]# ln -s /usr/local/redis/bin/redis-cli /usr/bin/redis
Test redis
Service operation command
systemctl start redis.service #启动redis服务 systemctl stop redis.service #停止redis服务 systemctl restart redis.service #重新启动服务 systemctl status redis.service #查看服务当前状态 systemctl enable redis.service #设置开机自启动 systemctl disable redis.service #停止开机自启动
The above is the detailed content of How to install redis on centos7. For more information, please follow other related articles on the PHP Chinese website!

Redis是现在最热门的key-value数据库,Redis的最大特点是key-value存储所带来的简单和高性能;相较于MongoDB和Redis,晚一年发布的ES可能知名度要低一些,ES的特点是搜索,ES是围绕搜索设计的。

本篇文章给大家带来了关于redis的相关知识,其中主要介绍了关于redis的一些优势和特点,Redis 是一个开源的使用ANSI C语言编写、遵守 BSD 协议、支持网络、可基于内存、分布式存储数据库,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于redis的相关知识,其中主要介绍了Redis Cluster集群收缩主从节点的相关问题,包括了Cluster集群收缩概念、将6390主节点从集群中收缩、验证数据迁移过程是否导致数据异常等,希望对大家有帮助。

本篇文章给大家带来了关于redis的相关知识,其中主要介绍了Redis实现排行榜及相同积分按时间排序,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,希望对大家有帮助。

本篇文章给大家带来了关于redis的相关知识,其中主要介绍了关于原子操作中命令原子性的相关问题,包括了处理并发的方案、编程模型、多IO线程以及单命令的相关内容,下面一起看一下,希望对大家有帮助。

本篇文章给大家带来了关于redis的相关知识,其中主要介绍了bitmap问题,Redis 为我们提供了位图这一数据结构,位图数据结构其实并不是一个全新的玩意,我们可以简单的认为就是个数组,只是里面的内容只能为0或1而已,希望对大家有帮助。

本篇文章给大家带来了关于redis的相关知识,其中主要介绍了Redis实现排行榜及相同积分按时间排序,本文通过实例代码给大家介绍的非常详细,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于redis的相关知识,其中主要介绍了关于实现秒杀的相关内容,包括了秒杀逻辑、存在的链接超时、超卖和库存遗留的问题,下面一起来看一下,希望对大家有帮助。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
