Upgrade Redis to 6.x on Ubuntu 20.04

Redis - Logo

I was looking to upgrade Redis from 5.x to the new stable 6.x release on Ubuntu Redis and at this time Redis that is in the apt source will not allow you to get to the 6.x branch. In order to upgrade to 6.x you will need to add the official beta apt source by running the commands below.

curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list

After adding the apt source you will want to update apt and then

sudo apt-get update
sudo apt-get install redis

You should now be running the newest stable release of Redis server on your Ubuntu 20.04 install. You can verify it with the following command redis-server -v, and will get something like the following

Redis server v=6.2.6 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=557672d61c1e18ba

You can confirm that the new Redis server is running and working with your current WordPress install by using the redis-cli command and then issuing keys * which will output all of the stored entries, if nothing shows then there is likely an issue.