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 for centos7

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

Share

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

This article is a detailed introduction to "how to install redis in centos7" for everyone. The content is detailed, the steps are clear, and the details are properly handled. I hope this article "how to install redis in centos7" can help you solve your doubts. Let's go deeper and learn new knowledge together with the ideas of the small editor.

1. Install GCC dependency

Since redis is developed in C language, 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 2. Download and extract the installation package [root@localhost local]# wget http://www.localhostlocalhostlocal.com//download.redis.io/releases/redis-5.0.3.tar.gz [root@localhost local]# tar -zxvf redis-5.0.3.tar.gz 3. cd Switch to redis decompression directory and execute compilation [root@localhost local]# cd redis-5.0.3[root@localhost redis-5.0.3]# make 4. Install and specify installation directory [root@localhost redis-5.0.3]# make install PREFIX=/usr/local/redis 5. Startup Services 5.1 Front Desk Startup [root@localhost redis-5.0.3]# cd /usr/local/redis/bin/[root@localhost bin]# ./ redis-server 5.2 background startup

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

[root@localhost bin]# cp /usr/local/redis-5.0.3/redis.conf /usr/local/redis/bin/

Change redis.conf file to daemonize yes instead of daemonize no

[root@localhost bin]# vi redis.conf

background starts

[root@localhost bin]# ./ redis-server redis.conf VI. Set boot startup

Add boot service

[root@localhost bin]# vi /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 as its own path.

Set up boot up

[root@localhost bin]# systemctl daemon-reload[root@localhost bin]# systemctl start redis.service[root@localhost bin]# systemctl enable redis.service

Create redis command soft link

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

Testing redis

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 current status of services systemctl enable redis.service #Set boot auto-start systemctl disable redis.service #Stop booting and start reading here, this article "centos7 how to install redis" has been introduced, want to master the knowledge points of this article also need to be used by yourself to understand, if you want to know more related content of the article, welcome to pay attention to 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