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 redis with centos7

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

In this article, the editor introduces in detail "how to use centos7 to install redis", the content is detailed, the steps are clear, and the details are handled properly. I hope this "how to use centos7 to install redis" article can help you solve your doubts.

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@192 local] # yum install-y gcc

Download and extract the installation package. If you don't have wget installed, you can install it through yum first.

[root@192 local] # yum install-y wget [root@192 local] # wget http://download.redis.io/releases/redis-5.0.3.tar.gz[root@192 local] # tar-zxvf redis-5.0.3.tar.gz

Cd changes to the directory extracted by redis to perform the compilation

[root@192 local] # cd redis-5.0.3 [root@192 redis-5.0.3] # make

Install and specify the installation directory, which is / usr/local/redis

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

Start the service

[root@192 redis-5.0.3] # cd / usr/local/redis/bin/ [root@192 bin] #. / redis-server

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

[root@192 bin] # cp / usr/local/redis-5.0.3/redis.conf / usr/local/redis/bin/ [root@192 bin] # lsredis-benchmark redis-check-aof redis-check-rdb redis-cli redis.conf redis-sentinel redis-server

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

[root@192 bin] # vim redis.conf

Background start

[root@192 bin] #. / redis-server redis.conf 6535:C 17 Nov 2020 09:40:30.395 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo6535:C 17 Nov 2020 09:40:30.395 # Redis version=5.0.3, bits=64, commit=00000000, modified=0, pid=6535 Just started6535:C 17 Nov 2020 09 Configuration loaded [root@192 bin] # ps-ef | grep redisroot 6536 10 09:40? 00:00:00. / redis-server 127.0.0.1:6379root 6541 1126 0 09:40 pts/0 00:00:00 grep-- color=auto redis

Set up boot boot

Add Boot Startup Service

[root@192 bin] # vim / etc/systemd/system/redis.service

Copy and paste 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

[root@192 bin] # systemctl daemon-reload [root@192 bin] # systemctl start redis.service [root@192 bin] # systemctl enable redis.serviceCreated symlink from / etc/systemd/system/multi-user.target.wants/redis.service to / etc/systemd/system/redis.service.

Create a redis command soft link

[root@192 bin] # ln-s / usr/local/redis/bin/redis-cli / usr/bin/redis

Test redis

[root@192 bin] # redis127.0.0.1:6379 > pingPONG127.0.0.1:6379 > exit

Service operation command

Systemctl start redis.service # start redis service systemctl stop redis.service # stop redis service systemctl restart redis.service # restart service systemctl status redis.service # View service current status systemctl enable redis.service # set boot systemctl disable redis.service # stop boot self-startup ```read here, this article "how to use centos7 to install redis" has been introduced If you want to master the knowledge of this article, you still need to practice and use it. If you want to know more about the articles, you are welcome to follow the industry information channel.

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