{"id":8388,"date":"2024-12-06T00:38:07","date_gmt":"2024-12-05T19:08:07","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=8388"},"modified":"2024-12-06T00:39:52","modified_gmt":"2024-12-05T19:09:52","slug":"how-to-install-redis-on-ubuntu-and-allow-remote-access-from-a-specific-server","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-install-redis-on-ubuntu-and-allow-remote-access-from-a-specific-server\/","title":{"rendered":"How to Install Redis on Ubuntu and Allow Remote Access from a Specific Server"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Introduction<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Redis is a popular in-memory database known for its speed and versatility. By default, Redis allows only local connections, we can enable secure remote access for specific use cases<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Prerequisite<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>A user with sudo privilege access to SSH the server<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Implementation<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 1: Install Redis<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$ sudo apt update<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$ sudo apt install redis-server -y<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 2: Start and enable the Redis service<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$ sudo systemctl start redis <br>$ sudo systemctl enable redis<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 3: Edit the Redis configuration to allow the remote access<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$ vi \/etc\/redis\/redis.conf<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Search for the keyword &#8220;bind&#8221; and update the IP as mentioned<br><br>bind 0.0.0.0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 4: Setup the secure password<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Search with the keyword &#8220;requirepass&#8221; on the same configuration file and update the strong password then save &amp; exit the file<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">requirepass YourSecurePasswordHere<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 5: Restart the Redis service<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$ sudo systemctl restart redis<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 6: Configure Firewall Rules to restrict access and allow only the specific remote server&#8217;s IP<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$ sudo ufw enable<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$ sudo ufw allow from &lt;IP&gt; to any port 6379<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Note: Redis default port is 6379<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 7: Reload UFW Rules<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$ sudo ufw reload<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Redis is a popular in-memory database known for its speed and versatility. By default, Redis allows only local connections, [&hellip;]<\/p>\n","protected":false},"author":495,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[475],"class_list":["post-8388","post","type-post","status-publish","format-standard","hentry","category-web-architecture","tag-redis","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-2bi","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8388","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/495"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=8388"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8388\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=8388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=8388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=8388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}