How to install Redis server on Ubuntu 17.04

How to install Redis server on Ubuntu 17.04

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries. It also supports built-in replication, Lua scripting, LRU eviction, transactions and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster. This tutorial will explain on how to install Redis server on Ubuntu 17.04.

Installation procedure

To start the installation process, execute the following command to install the Redis package as shown below.

root@linuxhelp1:~# apt-get install redis-server
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following additional packages will be installed:
  libjemalloc1 redis-tools
Suggested packages:
  ruby-redis
.
.
.
Created symlink /etc/systemd/system/multi-user.target.wants/redis-server.service &rarr  /lib/systemd/system/redis-server.service.
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (232-21ubuntu2) ...

The Redis package has been successfully installed. Now install the php-redis package by running the following command.

root@linuxhelp1:~# apt-get install php-redis
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following additional packages will be installed:
  php-common php-igbinary php7.0-cli php7.0-common php7.0-json php7.0-opcache php7.0-phpdbg
  php7.0-readline
.
.
.
Creating config file /etc/php/7.0/phpdbg/php.ini with new version
Setting up php-igbinary (2.0.1-1) ...
Setting up php-redis (3.1.1-1) ...

Run the following command to open the configuration file in vim editor. Add the following statements in Redis configuration file. Save and exit from the file.

root@linuxhelp1:~# vim /etc/redis/redis.conf
maxmemory 128mb
maxmemory-policy allkeys-lru

The configuration file is saved with the changes. Now restart and enable the Redis service.

root@linuxhelp1:~# systemctl restart redis-server.service
root@linuxhelp1:~# systemctl enable redis-server.service

Now the Redis server is ready, run the below command to access Redis application.

root@linuxhelp1:~# redis-cli
127.0.0.1:6379> 

The Redis terminal is logged on, now the user can manage the database by using Redis server.

Wasn' t that an easy installation procedure? The Redis server influence queues, leaderboards, pub/sub, session cache and full page cache.

Tag : Ubuntu Redis
FAQ
Q
how to install the redis package in ubuntu server?
A
execute the following command to install the Redis package as shown below
# apt-get install redis-server
Q
which command to access the redis server in ubuntu terminal?
A
Now the Redis server is ready, run the below command to access Redis application.
# redis-cli
Q
Are Redis on-disk-snapshots atomic?
A
Yes, redis background saving process is always forked when the server is outside of the execution of a command, so every command reported to be atomic in RAM is also atomic from the point of
Q
What does Redis actually mean?
A
Redis means REmote DIctionary Server.
Q
Why did you start the Redis project?
A
Originally Redis was started in order to scale LLOOGG. But after I got the basic server working I liked the idea to share the work with other people, and Redis was turned into an open source