Skip to content

Instantly share code, notes, and snippets.

@Tsangares
Last active April 3, 2024 05:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tsangares/e07e8b14dc6ca26afd11d127fe18bfb6 to your computer and use it in GitHub Desktop.
Save Tsangares/e07e8b14dc6ca26afd11d127fe18bfb6 to your computer and use it in GitHub Desktop.
Install RedisJSON on CentOS (CentOS Stream)

DISCLAIMER

Please if this install works or you find it helpful, make a comment and star so that this gist can propogate to help others.

Installation

We are going to install rust, clang and the latest redis, along with additional utilities described below.

Dependencies

Updating

To begin, I would reccomend updating:

sudo yum update

Build Dependencies

Start with installing the basics. You need rust, cargo and clag in order to build the tar. Additionally, I am just placing the installed for tar and wget because I use those commands. I used dnf but you can used yum.

Installing Dependencies

sudo dnf install tar wget
sudo dnf install cargo rust
sudo dnf install clang

Installing Redis

Make sure you have an up to date redis. I had an old version of redis on my machine. To get the latest version we need the REMI repository.

REMI

The REMI Repo provides latest builds of files.

Install Latest EPEL

From the website. From following the Linode Documentation for Installing Redis on Centos, you need to add and update the epel-release, before installing.

dnf config-manager --set-enabled crb
dnf install epel-release epel-next-release

To enable the EPEL which we need for REMI.

Install REMI

Now install REMI, change the number at the end to whichever version of CentOS Streams you are using:

yum -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm

Install Latest REDIS from REMI

Now for the best part, installing the redis package. I had some issues because my default repository was set wrong for this. Run the following to see what redis packages are available,

sudo dnf module list redis

Then from this stack I found to get the latest version to run,

dnf module reset redis

Then you can pick which version you want like so:

sudo dnf module install redis:remi-7.2 

Finally I have the latest version of redis as of writing this gist. Here is where I can verify the version of the redis installed:

$ redis-server --version
Redis server v=7.2.2 

Building

Then make a build directory somewhere like ~/.local/share/redis_json

mkdir -p ~/.local/share/redis_json
cd ~/.local/share/redis_json

Then get the latest tar ball from https://github.com/RedisJSON/RedisJSON/releases. At the time of writing this the version is v2.6.7.

wget https://github.com/RedisJSON/RedisJSON/archive/refs/tags/v2.6.7.tar.gz

Then untar the release,

tar -xvf v2.6.7.tar.gz

Then build the release,

cd RedisJSON-2.6.7/
cargo build --release

Installing

Now you can install the shared libraries:

sudo /usr/bin/install -D target/release/deps/librejson.so /usr/lib/redis/rejson.so
sudo /usr/bin/install -Dm644 LICENSE.txt /usr/share/licenses/rejson/LICENSE

Redis Config

Then you can edit your redis config to allow the module so open up /etc/redis.conf,

sudo emacs /etc/redis.conf

Then in the modules section add,

loadmodule  /usr/lib/redis/rejson.so

Restarting

Then restart redis,

sudo systemctl restart redis

Testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment