{"id":9469,"date":"2021-08-23T14:34:48","date_gmt":"2021-08-23T14:34:48","guid":{"rendered":"https:\/\/linuxways.net\/?p=9469"},"modified":"2021-08-23T14:34:48","modified_gmt":"2021-08-23T14:34:48","slug":"how-to-install-and-configure-redis-on-centos-8","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-and-configure-redis-on-centos-8\/","title":{"rendered":"How to Install and Configure Redis on CentOS 8"},"content":{"rendered":"<p>Redis is an in-memory data structure store. It is an open-source application that can be used as a Memcached alternative to store key-value pairs, means sets of two linked items, as a database NoSQL, message broker, and supports different data structures such as Hashes, Lists, Sets, Strings, and more.<\/p>\n<p>We will provide you in this article the complete installation and configuration details of Redis on the CentOS 8 Linux system.<\/p>\n<h2><strong>Prerequisites<\/strong><\/h2>\n<p>Log in as administrator or with root privileges on CentOS 8 to install Redis.<\/p>\n<h2><strong>Installation of Redis on CentOS 8<\/strong><\/h2>\n<p>Redis can install on CentOS 8 system into the following steps:<\/p>\n<h3><strong>Step 1: Install Redis using CentOS 8 repository<\/strong><\/h3>\n<p>First, login into the system and open the command line application \u2018Terminal\u2019 from the left sidebar of your CentOS 8 desktop. Now, update the system packages and CentOS 8 repositories by executing the below-mentioned command:<\/p>\n<pre>$ sudo dnf update<\/pre>\n<pre>$ sudo dnf install redis<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1202\" height=\"751\" class=\"wp-image-9470\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-395.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-395.png 1202w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-395-300x187.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-395-1024x640.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-395-768x480.png 768w\" sizes=\"auto, (max-width: 1202px) 100vw, 1202px\" \/><\/p>\n<h3><strong>Step 2: Verify Redis installation<\/strong><\/h3>\n<p>Once the installation of Redis is finished, check Redis installation details by using the below-mentioned terminal command:<\/p>\n<pre>$ rpm -qi redis<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1198\" height=\"748\" class=\"wp-image-9471\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-396.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-396.png 1198w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-396-300x187.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-396-1024x639.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-396-768x480.png 768w\" sizes=\"auto, (max-width: 1198px) 100vw, 1198px\" \/><\/p>\n<h3><strong>Step 3: Enable Redis service\u00a0<\/strong><\/h3>\n<p>In this step, enable and then start the Redis service on CentOS 8 by using the following commands:<\/p>\n<pre>$ sudo systemctl enable redis<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1194\" height=\"86\" class=\"wp-image-9472\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-397.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-397.png 1194w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-397-300x22.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-397-1024x74.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-397-768x55.png 768w\" sizes=\"auto, (max-width: 1194px) 100vw, 1194px\" \/><\/p>\n<pre>$ sudo systemctl start redis<\/pre>\n<p>Verify the running status of Redis service by executing the below-mentioned command:<\/p>\n<pre>$ sudo systemctl status redis<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1199\" height=\"437\" class=\"wp-image-9473\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-398.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-398.png 1199w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-398-300x109.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-398-1024x373.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-398-768x280.png 768w\" sizes=\"auto, (max-width: 1199px) 100vw, 1199px\" \/><\/p>\n<p>By default, port 6379 is used by Redis. Using the netstat command, you can easily confirm the port as follows:<\/p>\n<pre>$ sudo netstat -pnltu | grep redis<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1197\" height=\"120\" class=\"wp-image-9474\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-399.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-399.png 1197w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-399-300x30.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-399-1024x103.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-399-768x77.png 768w\" sizes=\"auto, (max-width: 1197px) 100vw, 1197px\" \/><\/p>\n<h3><strong>Step 4: Redis Configuration for remote access<\/strong><\/h3>\n<p>By default, Redis only allows the Redis server to localhost (127.0.0.1) connection means on which the Redis is running. Redis does not allow remote connections. If a user uses a single server where the client\u2019s database is also running on the same host then, in this case, the user cannot access the remote connection.<strong>\u00a0<\/strong><\/p>\n<p>However, using the Redis configuration file, users can access the remote connection. Open the configuration file of Redis by running the below-given command:<\/p>\n<pre>$ sudo nano \/etc\/redis.conf<\/pre>\n<p>Now, find the bind parameter in the configuration file and add your private server IP address with 127.0.0.1 as follows:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1098\" height=\"748\" class=\"wp-image-9475\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-400.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-400.png 1098w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-400-300x204.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-400-1024x698.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-400-768x523.png 768w\" sizes=\"auto, (max-width: 1098px) 100vw, 1098px\" \/><\/p>\n<p>Save the above configuration and close this file.<\/p>\n<p>Restart Redis by executing the following command:<\/p>\n<pre>$ sudo systemctl restart redis<\/pre>\n<p>By using the \u2018ss\u2019 command, you can easily check if Redis is either listening on port 6379 or not.<\/p>\n<pre>$ ss -an | grep 6379<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1102\" height=\"365\" class=\"wp-image-9476\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-401.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-401.png 1102w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-401-300x99.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-401-1024x339.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-401-768x254.png 768w\" sizes=\"auto, (max-width: 1102px) 100vw, 1102px\" \/><\/p>\n<p>To check the Redis is working correctly, send the ping Redis with the following command:<\/p>\n<pre>$ redis-cli<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1090\" height=\"133\" class=\"wp-image-9477\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-402.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-402.png 1090w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-402-300x37.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-402-1024x125.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-402-768x94.png 768w\" sizes=\"auto, (max-width: 1090px) 100vw, 1090px\" \/><\/p>\n<h3><strong>Step 5: Allow Firewall Access<\/strong><\/h3>\n<p>Configure the firewall on your CentOS 8 system to allow access to the remote connections. First, add the new Redis zone by running the below-mentioned command:<\/p>\n<pre>$ sudo firewall-cmd --permanent --new-zone=redis<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1092\" height=\"124\" class=\"wp-image-9478\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-403.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-403.png 1092w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-403-300x34.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-403-1024x116.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-403-768x87.png 768w\" sizes=\"auto, (max-width: 1092px) 100vw, 1092px\" \/><\/p>\n<p>Add the port number \u20186379\u2019 by using the following command:<\/p>\n<pre>$ sudo firewall-cmd --permanent --zone=redis --add-port=6379\/tcp<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1097\" height=\"123\" class=\"wp-image-9479\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-404.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-404.png 1097w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-404-300x34.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-404-1024x115.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-404-768x86.png 768w\" sizes=\"auto, (max-width: 1097px) 100vw, 1097px\" \/><\/p>\n<p>Enable firewall access to the private IP by running the below-mentioned command:<\/p>\n<pre>$ sudo firewall-cmd --permanent --zone=redis --add-source=private-IP-address<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1100\" height=\"109\" class=\"wp-image-9480\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-405.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-405.png 1100w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-405-300x30.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-405-1024x101.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-405-768x76.png 768w\" sizes=\"auto, (max-width: 1100px) 100vw, 1100px\" \/><\/p>\n<p>Finally, at the end reload the firewall by executing the below-mentioned command:<\/p>\n<pre>$ sudo firewall-cmd --reload<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1104\" height=\"90\" class=\"wp-image-9481\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-406.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-406.png 1104w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-406-300x24.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-406-1024x83.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-406-768x63.png 768w\" sizes=\"auto, (max-width: 1104px) 100vw, 1104px\" \/><\/p>\n<h2><strong>Remove or uninstall Redis from CentOS 8<\/strong><\/h2>\n<p>After using Redis, you can easily uninstall it to make some free space in your system. Use the following command to remove Redis from CentOS 8:<\/p>\n<pre>$ sudo dnf remove redis<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1107\" height=\"710\" class=\"wp-image-9482\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-407.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-407.png 1107w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-407-300x192.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-407-1024x657.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-407-768x493.png 768w\" sizes=\"auto, (max-width: 1107px) 100vw, 1107px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>We have provided in this tutorial the complete installation description of Redis on the CentOS 8 system. Furthermore, we have also described how to configure Redis for remote connections. In the end, we have explained in this article how a user can remove Redis from CentOS 8 using just a single command. Feel free to share thoughts via comments.<\/p>","protected":false},"excerpt":{"rendered":"<p>Redis is an in-memory data structure store. It is an open-source application that can be used as a Memcached alternative to store key-value pairs, means sets of two&hellip;<\/p>","protected":false},"author":1,"featured_media":9600,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[93,189],"class_list":["post-9469","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-centos-8","tag-redis"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=9469"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9469\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/9600"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=9469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=9469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=9469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}