How to uninstall Redis server from Ubuntu

Today I came across with a bit of a problem while trying to remove Redis 2.6 from one of my servers. The problem was, when I was installing at the first time I used make install  (Source build) instead of apt-get install (from repository). Since the make file didn’t had a un-install option, I had to remove it manually. In this post I will guide you through both uninstallation methods, You can chose the suitable method depending on how you installed it.

If you use apt-get

You can simply type below command in your terminal. This will remove the redis-server package and any other dependant packages which are no longer needed (Because of --auto-remove). And also it will delete your local/config files for redis-server (Because of purge).

 

If you used makefile

This is where it gets bit tricky. Because you will have to manually remove installed files. Here is how to do it;

1. Stop Redis server if it’s already running. Remember if you have more than one instance, you have to stop all of them. In my case I only have redis_6379 running at the moment.

2.  Now delete everything related to Redis server from /usr/local/bin/

3. Now delete Redis Configuration files directory and it’s content.

4. Delete existing Redis log files.

5. Delete existing Redis data directory and it’s content.

6. Delete existing Redis server init scripts

7. Remove existing Redis PID files (Only if exists)

8. Restart your Ubuntu server.

9. Now Redis is completely removed from your Server.

Because of any reason if you need to Re-install Redis server on your Server, refer to my article on How to install Redis server in Ubuntu

If you find this useful, Please leave a comment below.

  • Steel Brain

    I had to uninstall it manually as I had compiled it from source. Your method works great.

  • xiao

    Had to change

    sudo rm /usr/local/bin/redis-*
    to
    
    sudo rm /usr/bin/redis-*
    
    
    • Carlos

      Thanks

  • Bill

    I installed Redis via make install.
    This method worked for me 🙂
    Thanks!

  • parveen

    how to remove it from chkconfig so that chkconfig script don’t look for this(/etc/init.d/redis_*) script after every server restart

  • Staatsfeind

    I got multiple mails from the abuse account of my provider, regarding un-secure Redis components. I used your method and everything worked out fine. Thank you very much for this great, short and easy to understand tutorial.

  • Sagar Pise

    Thanks your commands worked perfectly.

  • nitin

    thanks (Y)

  • Sergey V.

    Thank you!

  • Aleksandar Terziev

    Thanks, this worked perfectly!