I am working with Laravel but i have installed all on my own (php, mysql, composer, nginx) and now i need to install Redis and configure it so i could use it for queue driver in Laravel.

How to install it, because it cannot be installed through apt-get install redis

i get this error:

ubuntu@ubuntu:~$ sudo apt-get install redis
[sudo] password for ubuntu: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package redis
  • 14
    sudo apt-get install redis-server May 1, 2017 at 22:25
  • E: Unable to locate package redis-server ...? Linux ubuntu-xenial 4.4.0-112-generic
    – citynorman
    Jul 8, 2018 at 2:36
  • Are you trying to install this on Windows? I mean there is E: in your line?
    – lewis4u
    Jul 8, 2018 at 6:59
  • I had to run sudo apt-get update to fix E: Unable to locate package redis-server
    – citynorman
    Jun 26, 2019 at 2:15

5 Answers 5


I think always is better (and simpler) to install from main repos as first option if you don't have any special requirements.

The package you are searching for is named redis-server. You can check its package info with apt show redis-server.

Also you can search all packages mentioning redis with apt search redis, or even do some simple filtering using grep, use apt search redis | grep php to search for php-redis or related package(s) for example.

So, you can simply run:

sudo apt install redis-server

on your terminal, to install a fully working redis(server) environment.

If you have any special requirements, you always can build from source and install as @George posted in his answer.

Hope it helps.

  • are there 2 versions of redis? a normal redis and a server redis or what, now i'm confused a bit
    – lewis4u
    Jan 8, 2017 at 14:13
  • 6
    OK i have tested it out and i came to a conclusion that i don't need to do anything except sudo apt-get install redis-server i don't know what that all is about in the answer above...somehow it is not necessary to do all of that!?
    – lewis4u
    Jan 8, 2017 at 20:43
  • 6
    I think its related to personal preferences, some people prefers building from source (and doing it for each software version) to keep more up to date, etc. I disagree with this except for very special cases, like I mentioned (with a stable system in mind), I prefer Ubuntu team packages because they are pretty well tested against all Ubuntu systems (desktop, server, core, cloud).
    – dgonzalez
    Jan 8, 2017 at 21:01
  • 2
    OK...for my needs apt-get install redis-server is more than enough
    – lewis4u
    Jan 8, 2017 at 21:06
  • 11
    This should be the accepted answer
    – Nam G VU
    Jun 15, 2017 at 6:03

To install redis follow these steps:

  1. Set up a non-root user with sudo privileges

  2. Install build and test dependencies:

    sudo apt update
    sudo apt full-upgrade
    sudo apt install build-essential tcl
  3. Set up redis:

    1. Download latest copy via this link or with this

      curl -O http://download.redis.io/redis-stable.tar.gz
    2. Create a temporary folder for it in say your /home/username/redis-stable directory
    3. Move into created folder and extract it

      tar xzvf redis-stable.tar.gz
    4. Change into the folder cd redis-stable and build it with

      make test
      sudo make install
  4. Configure redis:

    1. Create configuration directory:

      sudo mkdir /etc/redis
    2. Move sample redis configuration file:

      sudo cp /home/george/redis-stable/redis.conf /etc/redis
    3. Edit the file:

      sudo nano /etc/redis/redis.conf # or with any other text editor
    4. Make two changes there:
      supervised no to supervised systemd
      dir to dir /var/lib/redis # for persistent data dump
  5. Set up the systemd unit file:

    sudo nano /etc/systemd/system/redis.service

    Add the text:

    Description=Redis In-Memory Data Store
    ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
    ExecStop=/usr/local/bin/redis-cli shutdown
  6. Set up redis user, groups and directories:

    create redis user and group with same ID but no home directory:

    sudo adduser --system --group --no-create-home redis   
    sudo mkdir /var/lib/redis   # create directory
    sudo chown redis:redis /var/lib/redis   # make redis own /var/lib/redis
    sudo chmod 770 /var/lib/redis   # adjust permission
  7. Test redis:

    1. Start redis service:

      sudo systemctl start redis
    2. Check status:

      systemctl status redis

      Result of status if started successfully:

      ● redis.service - Redis Server
       Loaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: enabled)
       Active: active (running) since Wed 2016-05-11 14:38:08 EDT; 1min 43s ago
       Process: 3115 ExecStop=/usr/local/bin/redis-cli shutdown (code=exited, status=0/SUCCESS)
       Main PID: 3124 (redis-server)
       Tasks: 3 (limit: 512)
       Memory: 864.0K
       CPU: 179ms
       CGroup: /system.slice/redis.service
                └─3124 /usr/local/bin/redis-server
    3. Test instance:

      1. Connect:

      2. Test connectivity at prompt:> ping   # result PONG
      3. Check ability to set keys: set test "It's working!"  # result ok
      4. Get the key just set: get test  # result "It's working!"
      5. Exit redis: exit
      6. Restart redis and then re-run steps 1, 4, and 5 to connect with the client again and confirm that your test value is still available, hence it's working as expected:

        sudo systemctl restart redis
  8. Enable redis to start at boot:

    sudo systemctl enable redis


Digital Ocean - how to install and configure redis on Ubuntu 16.04

Direct download links

  • is it needed to do all of this as you have wrote? because i just tried to install redis on a different machine with sudo apt-get install redis-server and i can run redis-cli and set variables and call them without problem...so i am asking because i want to learn!
    – lewis4u
    Jan 8, 2017 at 16:53
  • 4
    If you want to install the latest version this is the route to take but if your are not so concerned about getting the latest then sudo apt-get install redis-server is the path to tow. Again this is an opportunity to learn how redis actually works and how it is setup. I personally prefer to do it this way so I know in and outs of the system and can alter it to suit my needs and expectations. Jan 8, 2017 at 22:11
  • I am your fan now. Apr 19, 2017 at 14:06
  • 1
    @TiagoBertolo obrigado! Apr 19, 2017 at 14:40
  • 1
    @PrimeTimeTran I think he means re-run steps 1, 4 and 5 of step 7:3, not of the overall procedure.
    – muru
    Mar 9, 2018 at 8:03

First add PPA repository to your OS then update your repository list and install it.

sudo add-apt-repository ppa:redislabs/redis
sudo apt-get update
sudo apt-get install redis
  • 4
    using ppa is far more convenient
    – cwhsu
    Sep 30, 2017 at 7:45
  • 5
    This worked great to upgrade in place from the default 3.0 version available in the standard repo to version 4.0 in Ubuntu 16.04. Thanks
    – james-see
    Dec 29, 2017 at 18:32
  • 3
    Best answer!!!!
    – James M
    Apr 13, 2018 at 11:47
  • 2
    Still valid for Ubuntu 18.04; I was able to get the latest Redis version this way, as opposed to a much older (1 major release/12 months behind) version.
    – cdjaco
    Apr 16, 2019 at 17:21
  • 2
    The chris-lea PPA seems to be out of date now. Redis Labs runs a PPA that has the most recent releases. Apr 10, 2021 at 15:15

Following @George's answer, after running make (step 3, part 4), cd into redis-stable/utils and run ./install_server.sh.

This interactive script will help you define a port and other file locations, and after which you can immediately run redis-cli.

That same directory also has a handy script for starting and stopping the server.

  • Job for redis-server.service failed because the control process exited with error code. See "systemctl status redis-server.service" and "journalctl -xe" for details. invoke-rc.d: initscript redis-server, action "start" failed. ● redis-server.service - Advanced key-value store Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Wed 2017-03-29 19:19:59 UTC; 37ms ago Docs: http://redis.io/documentation, man:redis-server(1)
    – tread
    Mar 29, 2017 at 19:21

1) First of all go to redis.io site

2) and you see there check the download page

3) Open the terminal

4) apt-cache policy redis-server

you able to see the version table for your operating system version display

5) sudo apt-get install redis-server

Don't getting this way install. Because redis server installing, but redis server install the your Ubuntu operating system version.

6) Easiest way Go to redis.io site and click on the download link Further you will go scroll on the more down you will see the installation

almost same way mac

7) First of all you are enter the update command. All the going to repo was update.

 sudo apt-get update

8) sudo apt-get install build-essential tcl

9) mkdir redis

10) wget http://download.redis.io/releases/redis-4.0.0.tar.gz

11) Now give the tar command

   unzip tar file.
   tar xzf redis-4.0.0.tar.gz

12) cd redis-4.0.0

13) make - making on redis binary

if once finish you can see the "make test" command

14) src/redis-server - start the redis server

15) src/redis-cli - start the redis client

set name vadivel
    get name

16) sudo make install - whenever give the redis command on enter the any dir

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .