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

The method of installing Redis in Centos 7

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article is about how to install Redis in Centos 7. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

First, install gcc dependencies

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

$yum install-y gcc II. Download and extract the installation package $wget http://download.redis.io/releases/redis-5.0.7.tar.gz$ tar-zxvf redis-5.0.7.tar.gz III. Switch to the redis directory for cd. Execute compilation $cd redis-5.0.7 & & make IV, install and specify the installation directory $make install PREFIX=/usr/local/redis V, startup service 5.1 foreground launch $cd / usr/local/redis/bin/$. / redis-server5.2 background startup

Copy redis.conf from the redis source directory to the redis installation directory

$cp / usr/local/redis-5.0.7/redis.conf / usr/local/redis/bin/

Modify the redis.conf file to change daemonize no to daemonize yes

$vim redis.conf## GENERAL # # 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

Background start

$. / redis-server redis.confession VI. Set boot

Add Boot Startup Service

$vim / etc/systemd/system/redis.service

Add the following

[Unit] Description=redis-serverAfter=network.target [Service] Type=forkingExecStart=/usr/local/redis/bin/redis-server / usr/local/redis/bin/redis.confPrivateTmp= true[Install] WantedBy=multi-user.target

Note: ExecStart is configured with its own path

Set up boot boot

$systemctl daemon-reload$ systemctl start redis.service$ systemctl enable redis.service

Create a redis command soft link

$ln-s / usr/local/redis/bin/redis-cli / usr/bin/redis# test $redis127.0.0.1:6379 > pingPONG127.0.0.1:6379 >

Finally, post some common commands.

# start redis Service systemctl start redis.service# stop redis Service systemctl stop redis.service# restart Service systemctl restart redis.service# View Service current status systemctl status redis.service# Settings Boot systemctl enable redis.service# stop Boot systemctl disable redis.service

OK~ finished ~

Thank you for reading! This is the end of this article on how to install Redis in Centos 7. I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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

Database

Wechat

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

12
Report