How to install Redis on Debian 11.3
To Installation of Redis on Debian 11.3
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 below command
root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
Step 2: Install the redis-server package by using the below command
root@linuxhelp:~# apt install redis-server
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
libgnutls-dane0 libunbound8
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
libjemalloc2 liblua5.1-0 liblzf1 lua-cjson redis-tools
Suggested packages:
ruby-redis
The following NEW packages will be installed:
libjemalloc2 liblua5.1-0 liblzf1 lua-cjson redis-server redis-tools
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,224 kB of archives.
After this operation, 5,288 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://deb.debian.org/debian bullseye/main amd64 libjemalloc2 amd64 5.2.1-3 [248 kB]
Get:2 http://deb.debian.org/debian bullseye/main amd64 liblua5.1-0 amd64 5.1.5-8.1+b3 [109 kB]
Get:3 http://deb.debian.org/debian bullseye/main amd64 liblzf1 amd64 3.6-3 [10.2 kB]
Get:4 http://deb.debian.org/debian bullseye/main amd64 lua-cjson amd64 2.1.0+dfsg-2.1 [17.5 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 redis-tools amd64 5:6.0.16-1+deb11u2 [741 kB]
Get:6 http://deb.debian.org/debian bullseye/main amd64 redis-server amd64 5:6.0.16-1+deb11u2 [98.2 kB]
Fetched 1,224 kB in 1s (2,111 kB/s)
Selecting previously unselected package libjemalloc2:amd64.
Created symlink /etc/systemd/system/redis.service → /lib/systemd/system/redis-server.service.
Created symlink /etc/systemd/system/multi-user.target.wants/redis-server.service → /lib/systemd/sys
tem/redis-server.service.
/usr/sbin/policy-rc.d returned 101, not running 'start redis-server.service'
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.31-13+deb11u3) ...
Step 3: Install the php-redis package by using the below command
root@linuxhelp:~# apt install php-redis
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
libgnutls-dane0 libunbound8
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
php-igbinary
The following NEW packages will be installed:
php-igbinary php-redis
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 234 kB of archives.
After this operation, 979 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://deb.debian.org/debian bullseye/main amd64 php-igbinary amd64 3.2.1+2.0.8-2 [85.1 kB]
Get:2 http://deb.debian.org/debian bullseye/main amd64 php-redis amd64 5.3.2+4.3.0-2+deb11u1 [149 kB]
Fetched 234 kB in 0s (852 kB/s)
Selecting previously unselected package php-igbinary.
(Reading database ... 359860 files and directories currently installed.)
Preparing to unpack .../php-igbinary_3.2.1+2.0.8-2_amd64.deb ...
Unpacking php-igbinary (3.2.1+2.0.8-2) ...
Selecting previously unselected package php-redis.
Preparing to unpack .../php-redis_5.3.2+4.3.0-2+deb11u1_amd64.deb ...
Unpacking php-redis (5.3.2+4.3.0-2+deb11u1) ...
Setting up php-igbinary (3.2.1+2.0.8-2) ...
Setting up php-redis (5.3.2+4.3.0-2+deb11u1) ...
Processing triggers for libapache2-mod-php7.4 (7.4.30-1+deb11u1) ...
Processing triggers for php7.4-cli (7.4.30-1+deb11u1) ...
Step 4: Restart the redis-server by using the below command
root@linuxhelp:~# systemctl restart redis-server
Step 5: Enable the redis-server to start the services on boot time by using the below command
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 the below command
root@linuxhelp:~# redis-cli
Step 7: Use Ping command in Redis Shell
127.0.0.1:6379> ping [hello]
"[hello]"
Step 8: Set the string “hello” to the value “keys”
127.0.0.1:6379> set keys hello
OK
Step 9: Get the string in the value “keys”
127.0.0.1:6379> get keys
"hello"
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to Installation of Redis on Debian 11.3. Your feedback is much welcome.