Goto Top

Ubuntu: Build Redisearch v2 module for Redis from source code

Here is a tutorial to compile the Redisearch module v2.x for Redis by yourself. At the moment you can get it as binary only as subscriber of the Enterprise Version. With "apt-get" you can only install the Redisearch module v1.x. Version v1.x works fine, but has much less features. Without the subscription you can only build the v2.x version from the source code. The official documentation for the RediSearch module can be found here.

RediSearch is the search engine or more precisely, the search index for the Redis database. It is currently the fastest search index you can install for free.

back-to-topWhy not Docker?

The Redis company recommends a Docker install (redis-stack) for RediSearch and Redis. However, I want the server to run natively on the machine since our production is already virtualized (KVM). A virtualization (Docker) in a virtualization (KVM) works of course, but a lot of performance is lost and the operation is not that comfortable especially in development. The alternative installation method via "Docker" can be found on the RediSearch Quickstart page.

back-to-topPreparation, prerequisites for compiling

  • Tested under Ubuntu 22.04
  • All commands are executed under the Linux bash and as user "frank" and not directly as root! The hostname of the system is: "nexus". If "root" is needed, I use "sudo" for it.
  • The home directory ~/redis is used for the source code and compilation
  • All tools and programs needed for development under Ubuntu 22.04 must be installed before:

back-to-topLoad source code via Git

Tip: The "--recursive" is used to load submodules.

If you want to load a specific release via Git you can control this with the "--branch" option. For example, if we want to load the Redisearch release 2.4.15:

This has the advantage that the correct version number of Redisearch also appears in the Redis log and in "redis-cli". Without the "--branch" specification a 99.99.99 (Git=master-xxx) appears as version.

back-to-topCheck and install dependencies

Here the user password is requested (because internally "sudo" is called)

The result should look like this or similar:

back-to-topBuild and linking

A sequence from 1% to 100% appears with a few "deprecated:" warnings. These can be ignored.
The output should start like this and end like this:

back-to-topInstall Redis server (or does it already exist)?

For the next step Redis must be installed. If you already have the Redis server installed on your system, you can skip this step and go straight to "Test RediSearch Module".

Here is a short command sequence on how to install the Redis server using the official "" packages on Ubuntu 22.04:

After that the Redis-Server and the Redis-Cli is installed and started automatically. You can test the installation with the call "redis-cli ".

The following should appear with a blinking cursor:

With the command "info" you can display all kinds of information about redis:

With "exit" you get out of the Redis-Cli again.

With the "service" commands "start", "restart", "stop" and "status" you can start, restart, stop and read the current status of the Redis server. The log file can be found under "/var/log/redis/redis-server.log".

Redis Start:

Redis Stop:

back-to-topTest RediSearch module

Now, before going any further, you need to stop the Redis server:

With "status" you can read out the current status. Active: inactive (dead)" should appear.

Now test the newly created RediSearch module in the directory "~/redis/RediSearch":


The module was loaded and the Redis server started. In the output there should be the entry: "Module 'search' loaded from /var/lib/redis/modules/". If not an error has occurred somewhere. Then repeat the first steps of the tutorial again.

With "Ctrl "+"c" you stop the Redis server.

back-to-topLoad RediSearch module automatically when starting Redis

The newly created RediSearch module is located after the creation under:

We now create a module directory under "/var/lib/redis/" and copy the newly created library "" into the created directory:

You can check the copy process with:

The module should now appear under "/var/lib/redis/modules/".

Now we adjust the Redis server configuration file (/etc/redis/redis.conf). To do this, we open the file and add to it in the MODULES section:

Tip: If you don't know how to use the "vi", you can replace it with the command "nano". So "sudo nano /etc/redis/redis.conf".

Save the "redis.conf" file.

Tip: You can copy the Redis library "" wherever you want. You just have to change the path under "loadmodule".

Restart Redis server:

With "status" you can test the Redis server and see if everything is running. Status: "Ready to accept connections" should appear.

In the logfile "/var/log/redis/redis-server.log" should appear the entry: "Module 'search' loaded from /var/lib/redis/modules/".

Here is the snippet about it:

back-to-topTest Redis and RediSearch module in operation

The Redis server should now be running, the RediSearch module created, copied and activated. Now we test this at runtime using the "redis-cli":

If this appears, you have done everything right! Congratulations face-smile

If you are interested in Redis and RediSearch 2 you should have a look at the following:

There are also several clients for almost all programming languages (PHP, Ruby, Javascript, Go, etc.):


If an error occurs when starting or stopping the Redis server, you can solve this using the commands:


check exactly. Also the Redis logfile often gives an answer to errors:

I am always happy about feedback or improvements. If you like the tutorial please click on the "heart", as a small thank you face-smile


Content-Key: 4707820878


Printed on: March 20, 2023 at 13:03 o'clock