How to Configure Valkey for WordPress in Rocky Linux 10

Recently, I have got a new client who wanted to migrate his existing WordPress eCommerce website to new Linux server with latest PHP. He had a specific requirement that he want Rocky Linux 10 only. I said ok, he also mentioned that he want Redis also to be configured.

He also said that before making the decision, i should do a proper research whether i will be able to do the Redis configuration or not which pinched me a bit. Why is he asking like this?. After a bit of research i found that Redis server package has been removed from Rocky Linux 10. I also fount out that Valkey is the alternative of Redis server. So this means Valkey is the New Redis.

I confirmed the client that it will be done without any problem. Here is the complete guide to install WordPress with Nginx on Rocky Linux 10. Follow the steps below for Valkey

I have already shared a tutorial on configuring Redis for WordPress on Ubuntu 24.04 and here is how i configured Valkey for WordPress in Rocky Linux 10.

Note:- This tutorial is based on the complete setup running on one single server. So if your complete setup (WordPress + Database) in on one server, you can continue with the tutorial.

Prerequisite

  • A server with Rocky Linux 10 Installed
  • A working WordPress setup with LAMP/LEMP or OpenLitespeed
  • A sudo user

Step 1 – Updating the Server

As usual, our first step will be to update our server.

sudo dnf update -y

Step 2 – Installing Valkey and PHP Extension

Similarly like Redis, Valkey wont work without the PHP extension for WordPress. Dont worry about the PHP version, in Rocky Linux running the below command will install the php package based on the PHP version enabled on your server.

sudo dnf install valkey -y
sudo dnf install php-redis -y

Dont get confused with php-redis extension, for valkey to work, we will have to use Redis php extension only as there is no specific php extension for valkey.

Step 3 – Configuring Valkey Server

Since every server have a specific amount of RAM, we cannot allow Valkey use all of it. So to make valkey use a specific amount of RAM we will have to configure it accordingly.

sudo nano /etc/valkey/valkey.conf

scroll down at the end, and copy and paste the given below directives

maxmemory 256mb
maxmemory-policy allkeys-lru
Note:- If your server have higher amount of RAM like 16GB or 32GB then you can increase "maxmemory" to 2GB or 4GB or whatever. It's totally upto you.

Now scroll above and find “requirepass” and change it as below

requirepass your_strong_password
Note:- Make sure to change "your_strong_password" to a stronger password.

Again scroll and find “bind”. If it is commented with “#”, just uncomment it by removing “#”. Make sure it looks like this.

bind 127.0.0.1 ::1

Now save the file by pressing ctrl+x, y and hit enter

Let’s restart and enable the valkey server

sudo systemctl restart valkey
sudo systemctl enable valkey

Step 4 – Configuring WordPress for Valkey

Now edit your wp-config.php, and paste the given below directives just above the like that says “That’s all, stop editing!“.

define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_PASSWORD', 'your_strong_password');
define('WP_REDIS_MAXTTL', 86400); // 24 hours of cache expiration
Note:- Replace "your_strong_password" to the password you have entered in Step 3

Step 5 – Testing the Valkey setup

Now, lets test our valkey setup

valkey-cli
127.0.0.1:6379>AUTH your_strong_password
127.0.0.1:6379>ping

The reply you should get is

PONG

This reply confirms that your setup is correct and working fine.

Step 6 – Installing Redis Object Cache plugin

Next step is to install Redis Object Cache plugin from WordPress dashboard.

  • Login to WordPress admin
  • Hover on Plugins and click on Add New
  • Search “Redis Object Cache” plugin. Install and Activate it
  • Now go to Settings -> Redis
  • Click on Enable Object Cache
  • You should see the connection as “Connected” in green

Step 7 – Checking logs

Final step is to check whether the logs are coming. This final step will confirm whether our setup is working absolutely fine.

valkey-cli
127.0.0.1:6379>AUTH your_strong_password
127.0.0.1:6379>monitor

Conclusion

With this, we have configured Valkey for WordPress on Rocky Linux 10. If you face any issues, just drop a comment.

Frequently asked questions

Does Valkey replace page caching in WordPress?

No, Valkey provides persistant object caching means, it will cache only the database queries and WordPress objects. So you must use something else for page caching.

Which WordPress websites benefit the most from Valkey?

You can get the most out of Valkey if you configure it on woo commerce stores, membership websites, forums, LMS and websites where many users login.

Leave a Comment

Sourabh Verma

Hi, I'm Sourabh Verma, an IT professional with 12+ years of experience. At BeginnersBox, I share practical, well-tested how-to guides on Windows, Linux, WordPress, web hosting, and other tech topics. My goal is to provide simple, reliable solutions that actually work. Hope you like my work. Thanks

Discover more from BeginnersBox

Subscribe now to keep reading and get access to the full archive.

Continue reading