Redis

Redis Development Environment Setup

Redis is a popular in-memory database that provides low latency on high-performance applications.

As developers, we need a playing ground to build, test, debug and fix our applications before rolling them out to production. Hence, having an environment where you can play around with databases and configurations is essential.

Unfortunately, as of writing this tutorial, the latest version of the Redis server runs on Linux operating systems only. We will learn how to set up a Redis Server development environment using this guide.

Redis on Windows – WSL

The best way to run Redis on Windows is to use the Windows Subsystem for Linux.

WSL is a compatible layer that allows users to run Linux distributions as executable applications natively on the host os.

It removes the need to perform dual-booting or running a virtual machine on the host OS.

The first step is to enable the WSL feature on Windows. Click the start menu and search for “turn windows features on or off”

In the new window, select Windows Subsystem for Linux and enable it.

Once enabled, click OK to apply the changes. In some cases, you may need to restart your device.

Next, open your browser and download WSL 2 kernel. The link is as provided below:

WSL2 Linux kernel update package for x64 machines

Launch the installer and follow the installation instructions provided.

Next, open the Windows Store and search for a Linux distribution such as Debian or Ubuntu.

Once installed, open the launcher to begin the setup process. Follow along to create a user account for your system.

Check the following section to learn how to install Redis on Ubuntu or Debian.

Install Redis on Ubuntu/Debian

To set up Redis on Ubuntu or any Debian based distribution, open the terminal and enter the command:

$ sudo apt-get update

Next, update the system packages.

$ sudo apt-get upgrade

Install Redis with the command:

$ sudo apt-get install redis-server

Once the installation is complete, start the Redis server by running the command:

$ redis-server

You can connect to the Redis CLI using the command:

$ redis-cli

redis 127.0.0.1:6379>

Dockerizing Redis

Another tool you can use to run Redis on your local system is Docker. Docker is containerization software that has revolutionalized software development.

We will not cover docker installation in this guide. Learn how to install Docker on your system in the resource below:

https://www.docker.com/products/docker-desktop

Once you have Docker installed, open the terminal and run the command:

$ Docker pull redis

The command above will pull the latest image of the docker Redis image.

Next, run Redis with the command:

$ docker run --name redis-server -d redis

The above command should create a Redis server container.

Closing

This tutorial covers various methods and tools you can use to create a Redis development environment on your local machine.

Thanks for reading!!

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list