search
HomeDatabaseRedisHow to install and deploy Redis in CentOS7 environment

1. Search redis online and find the download link
How to install and deploy Redis in CentOS7 environment
The connection is http://download.redis.io/releases/redis-6.0.3.tar.gz

2. Use wget to download the gz package. The installation is successful as shown in the figure

wget http://download.redis.io/releases/redis-6.0.3.tar.gz
How to install and deploy Redis in CentOS7 environment

3. After downloading, decompress

tar -zxvf redis-6.0.3.tar.gz

How to install and deploy Redis in CentOS7 environment

4. After decompression Compile in the redis directory

make

How to install and deploy Redis in CentOS7 environment

5. If the following prompt appears during compilation, don’t be angry if the error is reported for the first time. There are also errors below

This error only means that gcc is not installed, we can just install it

How to install and deploy Redis in CentOS7 environment

6. Install gcc, then use the command yum install gcc

How to install and deploy Redis in CentOS7 environment
You will be asked during the installation of gcc if you want to install this. Enter y and press Enter to continue the installation.

How to install and deploy Redis in CentOS7 environment

After installing gcc, recompile happily. What the hell, an error occurred again, it’s different from before

Stay steady, don’t panic. After checking the relevant resources, I found that CentOS7 is installed with 4.8.5 by default, and redis6.0 only supports versions 5.3 and above. , it turns out that the version is not supported, upgrade version, upgrade

How to install and deploy Redis in CentOS7 environment

7, CentOS7 is installed by default 4.8.5, and redis6.0 only supports version 5.3 or above, here will Upgrade gcc to 9

yum -y install centos-release-scl

yum -y install devtoolset-9-gcc devtoolset-9-gcc-c devtoolset-9-binutils

How to install and deploy Redis in CentOS7 environmentHow to install and deploy Redis in CentOS7 environment

8. Gcc has finally been upgraded. At this time, don’t forget to switch the version. If you upgrade to a new version, you must use the new version.

I still recommend a permanent switch. Don’t reconnect to the server and then drop gcc back after the temporary switch is completed, which will be very troublesome.

Temporary switch: scl enable devtoolset-9 bash

Permanent switch: echo "source /opt/rh/devtoolset-9/enable" >> /etc/profile

After the switch is completed, reconnect to the server to take effect, check the gcc version

gcc -v

How to install and deploy Redis in CentOS7 environment

9. After the version switch is successful, enter the redis directory and recompile make install
How to install and deploy Redis in CentOS7 environment
Hey, no error is reported. Now let’s test whether redis is installed successfully. The following interface appears to indicate successful installation (I like this graphic very much, hahahaha)
How to install and deploy Redis in CentOS7 environment

Configuration after installation

After successful installation, here It is recommended that you modify the port. The default port of redis is vulnerable to hacker attacks for mining operations. So, for the security of the server, it is better to modify the port number (don’t ask me why I know, just follow the modification silently. I will not lie to you. )

Download redis.conf locally for modification, it is simple and convenient

1. Change the default port

from port 6379 to your own defined port

2. Start as a background process

Modify daemonize no to daemonize yes

3. Set up redis remote connection

(1), first release the port number you set

(2), comment out bind 127.0.0.1

(3), set the redis connection password: change requirepass foobard to requirepass mzy1314520

mzy1314520 is the set password, Try to make this password as complex as possible

4. Start redis. If your redis has already been started, shut it down first and shut it down as follows (close the default port)

Stop redis (close the default port) ):

./redis-cli shutdown

Find the process number and kill the process:

ps -aux|grep redis kill -9 13985
How to install and deploy Redis in CentOS7 environment
5. Startup of redis

Specify the configuration file to start, enter the src directory, and enter the command

./redis-server /usr/local/redis-6.0.3/redis.conf
How to install and deploy Redis in CentOS7 environment
Local connection test
Cracked version of RedisDesktopManager2019.04: https://pan .baidu.com/s/1C2WLnhXqiS3wuJKzPqJdkQ Extraction code: a6s9
(foolish installation)
How to install and deploy Redis in CentOS7 environment
The connection is successful, there are 16 default libraries
How to install and deploy Redis in CentOS7 environment

The above is the detailed content of How to install and deploy Redis in CentOS7 environment. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:亿速云. If there is any infringement, please contact admin@php.cn delete
Redis: Beyond SQL - The NoSQL PerspectiveRedis: Beyond SQL - The NoSQL PerspectiveMay 08, 2025 am 12:25 AM

Redis goes beyond SQL databases because of its high performance and flexibility. 1) Redis achieves extremely fast read and write speed through memory storage. 2) It supports a variety of data structures, such as lists and collections, suitable for complex data processing. 3) Single-threaded model simplifies development, but high concurrency may become a bottleneck.

Redis: A Comparison to Traditional Database ServersRedis: A Comparison to Traditional Database ServersMay 07, 2025 am 12:09 AM

Redis is superior to traditional databases in high concurrency and low latency scenarios, but is not suitable for complex queries and transaction processing. 1.Redis uses memory storage, fast read and write speed, suitable for high concurrency and low latency requirements. 2. Traditional databases are based on disk, support complex queries and transaction processing, and have strong data consistency and persistence. 3. Redis is suitable as a supplement or substitute for traditional databases, but it needs to be selected according to specific business needs.

Redis: Introduction to a Powerful In-Memory Data StoreRedis: Introduction to a Powerful In-Memory Data StoreMay 06, 2025 am 12:08 AM

Redisisahigh-performancein-memorydatastructurestorethatexcelsinspeedandversatility.1)Itsupportsvariousdatastructureslikestrings,lists,andsets.2)Redisisanin-memorydatabasewithpersistenceoptions,ensuringfastperformanceanddatasafety.3)Itoffersatomicoper

Is Redis Primarily a Database?Is Redis Primarily a Database?May 05, 2025 am 12:07 AM

Redis is primarily a database, but it is more than just a database. 1. As a database, Redis supports persistence and is suitable for high-performance needs. 2. As a cache, Redis improves application response speed. 3. As a message broker, Redis supports publish-subscribe mode, suitable for real-time communication.

Redis: Database, Server, or Something Else?Redis: Database, Server, or Something Else?May 04, 2025 am 12:08 AM

Redisisamultifacetedtoolthatservesasadatabase,server,andmore.Itfunctionsasanin-memorydatastructurestore,supportsvariousdatastructures,andcanbeusedasacache,messagebroker,sessionstorage,andfordistributedlocking.

Redis: Unveiling Its Purpose and Key ApplicationsRedis: Unveiling Its Purpose and Key ApplicationsMay 03, 2025 am 12:11 AM

Redisisanopen-source,in-memorydatastructurestoreusedasadatabase,cache,andmessagebroker,excellinginspeedandversatility.Itiswidelyusedforcaching,real-timeanalytics,sessionmanagement,andleaderboardsduetoitssupportforvariousdatastructuresandfastdataacces

Redis: A Guide to Key-Value Data StoresRedis: A Guide to Key-Value Data StoresMay 02, 2025 am 12:10 AM

Redis is an open source memory data structure storage used as a database, cache and message broker, suitable for scenarios where fast response and high concurrency are required. 1.Redis uses memory to store data and provides microsecond read and write speed. 2. It supports a variety of data structures, such as strings, lists, collections, etc. 3. Redis realizes data persistence through RDB and AOF mechanisms. 4. Use single-threaded model and multiplexing technology to handle requests efficiently. 5. Performance optimization strategies include LRU algorithm and cluster mode.

Redis: Caching, Session Management, and MoreRedis: Caching, Session Management, and MoreMay 01, 2025 am 12:03 AM

Redis's functions mainly include cache, session management and other functions: 1) The cache function stores data through memory to improve reading speed, and is suitable for high-frequency access scenarios such as e-commerce websites; 2) The session management function shares session data in a distributed system and automatically cleans it through an expiration time mechanism; 3) Other functions such as publish-subscribe mode, distributed locks and counters, suitable for real-time message push and multi-threaded systems and other scenarios.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SecLists

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.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool