Installing Redis on a Linux Server

In this article you will learn steps for Installing Redis on a Linux Server. If you are a Redis beginner than I would recommend to read Redis Overview article first. Once you know the feature of Redis then remaining steps are going to be so much easy for you.

Ok, So since I have read about your previous blog and I know about Redis Features and using Redis online trial instance, So tell me now, How do I install Redis on my Linux Machine?

Alright, Let’s begin!!!

But, Wait a minute, A new version of Redis (Redis 6) has already launched just a few days ago on 30th Of April. Are we going to install that?

Well, Not really. Since Redis version 5 is there for quite some time and most of the organizations using that, so let’s learn Redis 5. Remember, 99% of what we learn is going to be true for Redis 6 as well.

Things to know before Installing Redis:

  • Redis by default runs on port 6379
  • Redis configurations are stored in a file known as redis.conf file. 
  • I don’t like this name for a configuration file, what do I do? Well, the name of the configuration file can be changed if needed.
  • Redis is written in C Language, It works on most of the Unix/Linux operating system without any prerequisite.
  • Redis stores all the data in memory by default, If you don’t want to lose all the data when server fails, enable Redis Persistence. We will learn how to do this later.
  • The Official Website to download Redis is https://redis.io/download

Downloading and Installing Redis

$ wget http://download.redis.io/releases/redis-5.0.8.tar.gz
$ tar xzf redis-5.0.8.tar.gz
$ cd redis-5.0.8
$ make

It is going to take between 2 to 5 minutes to compile Redis and the binaries are going to be available on “src” directory. Start Redis by running below command.

$ src/redis-server &

If you want to change the default port from 6379 and then start Redis, then follow below steps:
$ pwd
$ sed -i 's/6379/6370/g' redis.conf
$ grep "port 6370" redis.conf
$ ./src/redis-server redis.conf &

Commands Explanation:

<<pwd>> Use this command to check that you are in “src” directory inside redis folder.
<<sed -i ‘s/6379/6370/g’ redis.conf>> This command will modify redis.conf file and change the port from 6379 to 6370
<<grep “port 6370” redis.conf>> It will check whether the new values have been updated in redis.conf file
<<./src/redis-server redis.conf &>> This command will start the software as a background service

To verify that redis is running use below command “ps -ef|grep redis command”. It should show you a line ending with 

To verify that redis is running use below command “ps -ef|grep redis command”. It should show you a line ending with 

$ ps -ef|grep redis

Expected Output:
>> << blah blah blah>> redis-server 10.128.0.2:6370

Get any of the courses at a very special price. The offer is available only for a limited time.

Comments are closed.

Scroll to Top