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 Redis5.0 for Centos7

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

Share

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

This article mainly explains "Centos7 how to install Redis5.0", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Centos7 how to install Redis5.0" bar!

First, install gcc dependencies

Since redis is developed in C language, you must confirm whether to install gcc environment (gcc-v) before installation. If not, execute the following command to install.

[root@localhost local] # yum install-y gcc

Download and extract 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. Change cd to the directory extracted by redis and execute the compilation.

[root@localhost local] # cd redis-5.0.3

[root@localhost redis-5.0.3] # make

Install and specify the installation directory

[root@localhost redis-5.0.3] # make install PREFIX=/usr/local/redis

V. start the service

5.1 Front desk launch

[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 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 to change daemonize no to daemonize yes

[root@localhost bin] # vi redis.conf

Modify the redis.conf file

Vim redis.conf

# comment it so that it can be accessed by the public network

# bind 127.0.0.1

# start with background process

Daemonize yes

# requirepass foobared removes comments, and foobared changes to its own password

Background start

[root@localhost bin] #. / redis-server redis.conf

6. Set up boot boot

Add Boot Startup Service

[root@localhost bin] # vi / etc/systemd/system/redis.service

Copy and paste the following:

[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 with its own path

Set up boot boot

[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 # start the redis service

Systemctl stop redis.service # stop the redis service

Systemctl restart redis.service # restart the service

Systemctl status redis.service # View the current status of the service

Systemctl enable redis.service # set Boot self-boot

Systemctl disable redis.service # stop booting self-starting

{{o.name}}

{{m.name}}

Thank you for reading, the above is the content of "how to install Redis5.0 in Centos7". After the study of this article, I believe you have a deeper understanding of how to install Redis5.0 in Centos7, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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