Tech Monger

Programming, Web Development and Computer Science.

Skip to main content| Skip to information by topic

Redis Linux Installation without Root Aceess

If you want to install redis on Linux machine but do not have an administrative access (root access) then you can follow this installation guide. This setup will work on all linux distributions like Ubuntu, Fedora, Red Hat, Debian, Raspbian etc. This will also work on Mac as it does not make use of packet managers for installation. If you are windows users then please check redis windows installation without admin access.

Installation Steps without Sudo

  1. Download stable version of redis tarball from redis website.
  2. (Current version is 4.0.11 and filename is redis-4.0.11.tar.gz)

    https://redis.io/download
  3. Create directory to install redis and extract content of downloaded tar ball into it.
  4. mkdir /home/techmonger/redis/

  5. Copy tar ball in above directory and extract it using following commands.
  6. cp redis-4.0.11.tar.gz /home/techmonger/redis/
    tar -xf redis-4.0.11.tar.gz

    This will generate one more directory redis-4.0.11 inside your directory.

  7. Navigate into generated directory and compile redis binaries using make.
  8. cd /home/techmonger/redis/redis-4.0.11
    make 

    This will take some time to complete and it will create redis server binary (redis-server) and redis client binary (redis-cli) inside src directory of the current directory. (/home/techmonger/redis/redis-4.0.11/src/)

  9. Navigate into src directory and start redis server with default configuration.
  10. cd /home/techmonger/redis/redis-4.0.11/src/
    ./redis-server

    This will start redis server on the default port 6379 with following standard output suggesting redis server has started.

    26486:C 04 Aug 14:28:15.785 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    26486:C 04 Aug 14:28:15.785 # Redis version=4.0.11, bits=64, commit=00000000, modified=0, pid=26486, just started
    26486:C 04 Aug 14:28:15.785 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
    26486:M 04 Aug 14:28:15.787 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                    _._                                                  
               _.-``__ ''-._                                             
          _.-``    `.  `_.  ''-._           Redis 4.0.11 (00000000/0) 64 bit
      .-`` .-```.  ```\/    _.,_ ''-._                                   
     (    '      ,       .-`  | `,    )     Running in standalone mode
     |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
     |    `-._   `._    /     _.-'    |     PID: 26486
      `-._    `-._  `-./  _.-'    _.-'                                   
     |`-._`-._    `-.__.-'    _.-'_.-'|                                  
     |    `-._`-._        _.-'_.-'    |           http://redis.io        
      `-._    `-._`-.__.-'_.-'    _.-'                                   
     |`-._`-._    `-.__.-'    _.-'_.-'|                                  
     |    `-._`-._        _.-'_.-'    |                                  
      `-._    `-._`-.__.-'_.-'    _.-'                                   
          `-._    `-.__.-'    _.-'                                       
              `-._        _.-'                                           
                  `-.__.-'                                               
    
    26486:M 04 Aug 14:28:15.789 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
    26486:M 04 Aug 14:28:15.789 # Server initialized
    26486:M 04 Aug 14:28:15.789 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
    26486:M 04 Aug 14:28:15.789 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
    26486:M 04 Aug 14:28:15.789 * DB loaded from disk: 0.000 seconds
    26486:M 04 Aug 14:28:15.789 * Ready to accept connections
    
  11. Open new terminal and test connection using redis client.
  12. cd /home/techmonger/redis/redis-4.0.11/src
    ./redis-cli
    
    127.0.0.1:6379> PING
    PONG

    Above will confirm that redis server is running and accepting client connections.

Redis Server Configuration

Above method will boot redis server in command line mode with default configuration. You can also boot in background using daemon mode and make configuration changes according to your need using file redis.conf present inside installation directory (/home/techmonger/redis/redis-4.0.11/).
If you dont have administrative access of the machine then make sure you make configuration changes which do not require root access. Also by default redis server starts on the port 6379 which is non privileged port hence can be opened by any non root users without configuring firewall.

Tagged Under : Linux Raspberry Pi Redis Ubuntu