Introduction
Redis is a flexible open-source, key-value data store, used as a database, cache and message broker. Redis allows the user to store vast amounts of data without the limits of a relational database.
In order to achieve its outstanding performance, Redis works with an in-memory dataset. Depending on your use-case, you can persist it either by dumping the dataset to disk every once in a while or by appending each command to a log. Persistence can be optionally disabled if you just need a feature-rich, networked, in-memory cache.
We are assuming that you have root permission, otherwise, you may start commands with “sudo”.
Install dependencies
Redis 4 is not provided by any repository yet, so we have to compile it from source. In order to compile Redis 4 you have installed the “build essential” package:
apt-get install build-essential tclDownload Redis 4 source
We can download the Redis source from its official website with the following command:
wget http://download.redis.io/releases/redis-stable.tar.gzAfter the download is finished you have to extract it with the following command:
tar xvzf redis-stable.tar.gzCompile Redis
In the previous versions you had to compile “hiredis”, “jemalloc” and “lua” first, But in version 4 you can go ahead and compile Redis right away and the process will take care of the dependencies.
Switch to the Redis source file directory:
cd redis-stableExecute the following command will completely install Redis:
make && make installAfter the installation process is finished, execute the following command to make sure that everything is OK!
make testCreate the Redis service
Redis 4 has a script that creates the necessary files and directories automatically.
Switch to the following directory:
cd utils/Run the “install_server.sh” script with the following command:
bash install_server.shHit enter for all of the prompts to get the default configuration.
Now you can use the following commands to start and make your Redis service run at startup:
systemctl start redis_6379systemctl enable redis_6379
Test if Redis is working properly
You can execute the following command to see if Redis is listening on the preferred port:
netstat -ln | grep 6379You should see the following line in your output:
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTENAlso, you can test the Redis using the “redis-cli”:
redis-cli
$ set test HugeServer
$ get testNow you should see:
HugeServer 
For more information and news, check out Redis official website!
Very helpful, but please update the Download URL to redis-stable.tar.gz as this always delivers the latest version.
Hello,
I’m glad you liked it and thanks for the heads up we have updated the article.
Thanks
You have updated to redis-stable.tar.gz in wget, you also need to do it for subsequent commands (tar xvzf, cd)
Corrected! Thanks.
Now also available as backport package: 😉
https://packages.debian.org/stretch-backports/redis-server