How to install Redis in Ubuntu with IPV6 disabled
Disabling IPV6 in Ubuntu will cause Redis installation to fail with the error “Job for redis-server.service failed because a timeout was exceeded”.
In addition to enabling systemd
for Redis, you may have to remove the IPV6 binding from redis.conf
file for the Redis server to start without any issues. Follow the below steps to install and configure Redis.
Install Redis
To install Redis, execute the below command in terminal
sudo apt update
sudo apt install redis-server
If you have disabled IPV6, you may get the bellow error
Job for redis-server.service failed because a timeout was exceeded.
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; disabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: timeout) since Sun 2019-11-24 11:50:51 IST; 28ms ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Process: 31899 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)
Nov 24 11:50:51 lnx-srv systemd[1]: redis-server.service: Failed with result 'timeout'.
Nov 24 11:50:51 lnx-srv systemd[1]: Failed to start Advanced key-value store.
dpkg: error processing package redis-server (--configure):
installed redis-server package post-installation script subprocess returned error exit status 1
Processing triggers for systemd (237-3ubuntu10.31) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Errors were encountered while processing:
redis-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Changes to redis.conf
Make the below changes to redis.conf file to re-start the Redis Server. Edit the redis.conf file by executing the below command
nano /etc/redis/redis.conf
Change the line bind 127.0.0.1::1
to 127.0.0.1
Change the line supervised no
to spervised systemd
Save the changes and close the file. The next step is to start Redis server. Execute the below commands to start the Redis server and create necessary symlinks for Redis service.
systemctl enable redis-server
systemctl daemon-reload
Now you are all set and you can validate it by checking the status of the service by executing the command systemctl status redis. This would show a status similar to the one below.
Leave a comment