Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and deploy Redis in CentOS7 environment

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to install and deploy Redis in CentOS7 environment". In daily operation, I believe many people have doubts about how to install and deploy Redis in CentOS7 environment. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to install and deploy Redis in CentOS7 environment". Next, please follow the editor to study!

1. Search redis on the Internet to find download links

Connect to http://download.redis.io/releases/redis-6.0.3.tar.gz

2. Download the gz package using wget, and the installation is successful as shown in the figure

Wget http://download.redis.io/releases/redis-6.0.3.tar.gz

3. Decompress after downloading

Tar-zxvf redis-6.0.3.tar.gz

4. Go to the decompressed redis directory to compile

Make

5. If the following prompt appears during compilation, do not be angry when you report an error for the first time. There is also an error report below.

This error only indicates that gcc is not installed, so let's just install it.

6. To install gcc, use the command yum install gcc

In the middle of installing gcc, I will ask you if you want to install this. Enter y and press enter to continue the installation.

After installing gcc, happy to recompile, what the heck, there is another error, it is not the same as before

Steady, do not panic, check the relevant resources and found that the default installation of CentOS7 is 4.8.5, while redis6.0 only supports version 5.3 or above, the original version does not support ah, upgrade version, upgrade

7. CentOS7 installs 4.8.5 by default, but redis6.0 only supports version 5.3 or above. Upgrade gcc to 9.

Yum-y install centos-release-scl

Yum-y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils

8. Gcc has finally been upgraded. Don't forget to switch versions at this time. If you upgrade a new version, you must use a new version.

I still recommend a permanent handover so that you don't reconnect to the server after the temporary switchover is completed and the gcc is dropped back, which is very troublesome.

Temporary switch: scl enable devtoolset-9 bash

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

Reconnecting to the server takes effect after the switch is completed. Check the gcc version.

Gcc-v

9. After the version switch is successful, go to the redis directory and recompile make install

Ah ho ho, there is no error. Now let's test whether redis is installed successfully. The following interface indicates that the installation is successful (like this graphic very much, ho)

Configuration after installation

After the installation is successful, it is recommended that you modify the port. The default port of redis is vulnerable to hackers. So, modify the port number for the security of the server (don't ask me why I know, just change it silently, I won't lie to you)

It is simple and convenient to download redis.conf locally and modify it.

1. Change the default port

Change from port 6379 to your own defined port

2. Start it as a background process

Change daemonize no to daemonize yes

3. Set up redis remote connection

(1) release the port number you set first

(2) comment out bind 127.0.0.1

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

Mzy1314520 is the set password. This password is as complicated as possible.

4. Start redis. If your redis is already started, close it first and close it 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

5. The startup of redis

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

. / redis-server / usr/local/redis-6.0.3/redis.conf

Do connection testing locally

Cracked version of RedisDesktopManager2019.04: https://pan.baidu.com/s/1C2WLnhXqiS3wuJKzPqJdkQ extraction code: a6s9

(stupid installation)

In this way, the connection is successful. There are 16 libraries by default.

At this point, the study on "how to install and deploy Redis in CentOS7 environment" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report