{"id":1631,"date":"2024-11-24T23:51:46","date_gmt":"2024-11-24T21:51:46","guid":{"rendered":"https:\/\/www.shukko.com\/x3\/?p=1631"},"modified":"2024-11-24T23:51:46","modified_gmt":"2024-11-24T21:51:46","slug":"how-to-install-redis-on-almalinux-8","status":"publish","type":"post","link":"https:\/\/www.shukko.com\/x3\/2024\/11\/24\/how-to-install-redis-on-almalinux-8\/","title":{"rendered":"How to Install Redis on AlmaLinux 8"},"content":{"rendered":"\n<p>Step 1 &#8211; Keep the server up to date<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># dnf update -y\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><a href=\"https:\/\/dev.to\/inneutroncloud\/how-to-install-redis-on-almalinux-8-52k#step-2-install-redis\"><\/a>Step 2 &#8211; Install Redis<\/h4>\n\n\n\n<p>Run following DNF package manager command to install Redis.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># dnf install redis -y\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><a href=\"https:\/\/dev.to\/inneutroncloud\/how-to-install-redis-on-almalinux-8-52k#step-3-change-supervised-directive-from-no-to-systemd\"><\/a>Step 3 &#8211; Change supervised directive from no to systemd<\/h4>\n\n\n\n<p>This is important configuration change to make in the Redis configuration file. supervised directive allows you to delivery an init system to manage Redis as a service.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># vi \/etc\/redis.conf\n<\/code><\/pre>\n\n\n\n<p>Find supervised and change it from no to systemd which will looks like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># If you run Redis from upstart or systemd, Redis can interact with your\n# supervision tree. Options:\n# supervised no - no supervision interaction\n# supervised upstart - signal upstart by putting Redis into SIGSTOP mode\n# supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET\n# supervised auto - detect upstart or systemd method based on\n# UPSTART_JOB or NOTIFY_SOCKET environment variables\n# Note: these supervision methods only signal \"process is ready.\"\n# They do not enable continuous liveness pings back to your supervisor.\nsupervised systemd\n<\/code><\/pre>\n\n\n\n<p>Save and exit the Redis configuration file.<\/p>\n\n\n\n<p>After editing the file, start and enable the Redis service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># systemctl start redis\n\n# systemctl enable redis\n<\/code><\/pre>\n\n\n\n<p>To verify that Redis has installed successfully, we can run following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># redis-cli ping\n<\/code><\/pre>\n\n\n\n<p>Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PONG\n<\/code><\/pre>\n\n\n\n<p>If this is the case, it means we now have Redis running on our server and we can begin configuring it to enhance its security.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><a href=\"https:\/\/dev.to\/inneutroncloud\/how-to-install-redis-on-almalinux-8-52k#step-4-configure-a-redit-password\"><\/a>Step 4 &#8211; Configure a Redit password<\/h4>\n\n\n\n<p>Configuring a Redis password enables one of its built-in security features \u2014 the auth command \u2014 which requires clients to authenticate before being allowed access to the database. Like the bind setting, the password is configured directly in Redis\u2019s configuration file, \/etc\/redis.conf. Reopen that file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># vi \/etc\/redis.conf\n<\/code><\/pre>\n\n\n\n<p>Find requirepass<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># requirepass foobared\n<\/code><\/pre>\n\n\n\n<p>Uncomment it by removing the #, and change foobared to a very strong password of your choosing.<\/p>\n\n\n\n<p>After setting the password, save and close the file then restart Redis:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># systemctl restart redis\n<\/code><\/pre>\n\n\n\n<p>To test that the password works, open the Redis client:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># redis-cli\n<\/code><\/pre>\n\n\n\n<p>A sequence of commands used to verify whether the Redis password is working is as follows. Before authenticating, the first command tries to set a key to a value:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>127.0.0.1:6379&gt; set key1 23\n<\/code><\/pre>\n\n\n\n<p>That won\u2019t work as you have not yet authenticated, so Redis returns an error:<\/p>\n\n\n\n<p>Output<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(error) NOAUTH Authentication required.\n<\/code><\/pre>\n\n\n\n<p>The following command authenticates with the password specified in the Redis configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>127.0.0.1:6379&gt; auth your_redis_password\n<\/code><\/pre>\n\n\n\n<p>Redis will acknowledge that you have been authenticated:<\/p>\n\n\n\n<p>Output<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>OK\n<\/code><\/pre>\n\n\n\n<p>After that, running the previous command again should be successful:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>127.0.0.1:6379&gt; set key1 23\n<\/code><\/pre>\n\n\n\n<p>Output<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>OK\n<\/code><\/pre>\n\n\n\n<p>The get key1 command queries Redis for the value of the new key:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>127.0.0.1:6379&gt; get key1\n<\/code><\/pre>\n\n\n\n<p>Output<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"23\"\n<\/code><\/pre>\n\n\n\n<p>This last command exits redis-cli. You may also use exit:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>127.0.0.1:6379&gt; quit\n<\/code><\/pre>\n\n\n\n<p>We have successfully seen how to install Redis on AlmaLinux 8 and configure it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Step 1 &#8211; Keep the server up to date Step 2 &#8211; Install Redis Run following DNF package manager command to install Redis. Step 3 &#8211; Change supervised directive from no to systemd This is important configuration change to make in the Redis configuration file. supervised directive allows you to delivery an init system to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1631","post","type-post","status-publish","format-standard","hentry","category-kategerisiz"],"_links":{"self":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts\/1631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/comments?post=1631"}],"version-history":[{"count":1,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts\/1631\/revisions"}],"predecessor-version":[{"id":1632,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts\/1631\/revisions\/1632"}],"wp:attachment":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/media?parent=1631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/categories?post=1631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/tags?post=1631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}