• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to install Redis 5 on Ubuntu 21.04

  • 00:29 lsb_release -a
  • 00:40 apt install redis-server
  • 01:08 apt install php-redis
  • 01:29 systemctl restart redis-server
  • 01:54 systemctl enable redis-server
  • 02:21 redis-cli
  • 02:32 ping [hello]
  • 02:50 set keys hello
  • 03:04 get keys
{{postValue.id}}

Installation of Redis 5 on Ubuntu 21.04

Introduction:

Redis is an open-source data structure store that is stored in memory. In-memory databases (IMDBs) store computer data in the main memory of a computer rather than on a disk drive to increase response times.

Installation Procedure:

Step 1: Check the OS version by using the following command

root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 21.04
Release:	21.04
Codename:	hirsute

Step 2: Install the redis-server package by using the following command

root@linuxhelp:~# apt install redis-server 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  gcc-11-base libatomic1 libgcc-s1 libgomp1 libjemalloc2 liblua5.1-0 liblzf1 libstdc++6 lua-bitop lua-cjson
  redis-tools
Suggested packages:
  ruby-redis
The following NEW packages will be installed:
  libatomic1 libjemalloc2 liblua5.1-0 liblzf1 lua-bitop lua-cjson redis-server redis-tools
The following packages will be upgraded:
  gcc-11-base libgcc-s1 libgomp1 libstdc++6
4 upgraded, 8 newly installed, 0 to remove and 271 not upgraded.
Need to get 1,848 kB of archives.
After this operation, 5,387 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 gcc-11-base amd64 11.1.0-1ubuntu1~21.04 [19.0 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 libstdc++6 amd64 11.1.0-1ubuntu1~21.04 [583 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 libgomp1 amd64 11.1.0-1ubuntu1~21.04 [107 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 libgcc-s1 amd64 11.1.0-1ubuntu1~21.04 [42.2 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 libatomic1 amd64 11.1.0-1ubuntu1~21.04 [9,236 B]
Get:6 http://in.archive.ubuntu.com/ubuntu hirsute/universe amd64 libjemalloc2 amd64 5.2.1-2 [224 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu hirsute/universe amd64 liblua5.1-0 amd64 5.1.5-8.1build4 [99.9 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu hirsute/universe amd64 liblzf1 amd64 3.6-3 [7,444 B]
Get:9 http://in.archive.ubuntu.com/ubuntu hirsute/universe amd64 lua-bitop amd64 1.0.2-5 [6,680 B]
Get:10 http://in.archive.ubuntu.com/ubuntu hirsute/universe amd64 lua-cjson amd64 2.1.0+dfsg-2.1 [17.4 kB]
Processing triggers for libc-bin (2.33-0ubuntu5) ...

Step 3: Install the php-redis package by using the following command

root@linuxhelp:~# apt install php-redis
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  php-common php-igbinary php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-phpdbg php7.4-readline
Suggested packages:
  php-pear
The following NEW packages will be installed:
  php-common php-igbinary php-redis php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-phpdbg
  php7.4-readline
0 upgraded, 9 newly installed, 0 to remove and 271 not upgraded.
Need to get 4,353 kB of archives.
After this operation, 19.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu hirsute/main amd64 php-common all 2:76ubuntu1 [12.2 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 php7.4-common amd64 7.4.16-1ubuntu2.2 [986 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 php7.4-json amd64 7.4.16-1ubuntu2.2 [19.4 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 php7.4-opcache amd64 7.4.16-1ubuntu2.2 [197 kB]
Setting up php7.4-cli (7.4.16-1ubuntu2.2) ...
update-alternatives: using /usr/bin/php7.4 to provide /usr/bin/php (php) in auto mode
update-alternatives: using /usr/bin/phar7.4 to provide /usr/bin/phar (phar) in auto mode
update-alternatives: using /usr/bin/phar.phar7.4 to provide /usr/bin/phar.phar (phar.phar) in auto mode

Creating config file /etc/php/7.4/cli/php.ini with new version
Setting up php-igbinary (3.2.1+2.0.8-2build1) ...
Setting up php-redis (5.3.2+4.3.0-2+deb11u1) ...
Setting up php7.4-phpdbg (7.4.16-1ubuntu2.2) ...
update-alternatives: using /usr/bin/phpdbg7.4 to provide /usr/bin/phpdbg (phpdbg) in auto mode

Creating config file /etc/php/7.4/phpdbg/php.ini with new version
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for php7.4-cli (7.4.16-1ubuntu2.2) ...
Processing triggers for php7.4-phpdbg (7.4.16-1ubuntu2.2) ...

Step 4: Restart the redis-server by using the following command

root@linuxhelp:~# systemctl restart redis-server

Step 5: Enable the redis-server to start the services on boot time

root@linuxhelp:~# systemctl enable redis-server
Synchronizing state of redis-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable redis-server

Step 6: Login to Redis CLI shell by using following command

root@linuxhelp:~# redis-cli

Step 7: Using Ping command in Redis Shell

127.0.0.1:6379> ping [hello]
"[hello]"

Step 8: Setting the string “hello” to the value “keys”

127.0.0.1:6379> set keys hello
OK

Step 9: Getting the string in the value “keys”

127.0.0.1:6379> get keys
"hello"

By this installation of Redis 5 on Ubuntu 21.04 has been completed

Tags:
isaac
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is the use of Redis-cli?

A

Redis-cli is used to send commands to Redis, and read the replies sent by the server, directly from the terminal.

Q

What is the default port of Redis?

A

The default port of Redis is 6379.

Q

Can Redis be used as a database?

A

Yes, Redis can be used as a database,

Q

What type of database is Redis?

A

Redis is a NoSQL type of database?

Q

How Redis reponse fast ?

A

Instead of using disk drives, it uses the computer's main memory by its response is fast.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Isaiah ?
What is the use of SUID & SGID commands

How to set the special permissions to the files and folders using SUID and SGID commands...

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.