• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
NameHero® Blog

NameHero® Blog

Web Hosting Tips & Resources From NameHero

  • AI Agents
    • OpenClaw
    • Claude Code
    • n8n
    • Hermes Agent
    • Open WebUI
    • Docker
  • Hosting
    • Web Hosting
    • WordPress Hosting
    • WooCommerce Hosting
    • Enterprise Hosting
    • Email Hosting
    • HeroicGuard
    • GPU Hosting
    • Website Builder
  • VPS
    • Managed VPS
    • Unmanaged VPS
    • Flex VPS
  • Reseller
  • Gaming
  • Domains
  • Account
  • Blog Home
  • Categories
  • Authors

How To Properly Undo Package Installation On CentOS

Bhagwad Park

Published on: December 27, 2021

Categories: VPS Hosting 0

If you’re not careful, your Linux system will become full of unused and discarded packages you installed a long time ago, and don’t use anymore. What’s worse, often when you install a particular program, it comes with a list of dependencies that get installed along with it. Ideally, you would want to get rid of these dependencies as well. But how do you know which packages were installed at the same time as the ones you want to remove?

In this tutorial, I’ll show you how to find packages you no longer want to use, how to see the commands that installed them, and also which packages were installed at the same time. And finally, how to undo the steps that led to the installation of the package. This way, you always have a clean system with no “fluff”, and no danger of conflicts.

Note: You need root access to run several of the commands here. Make sure the account you’re using has sudo privileges.

Step 1: Get the Exact Name of the Package you Want to Remove

Recently, I wrote a tutorial on how to install Redis on a VPS running WordPress. But what if you don’t want to use it anymore, and want to change to another object caching method – or not use it at all? You shouldn’t just let Redis remain on your system. So you should remove it properly.

But if it’s been a while since you installed Redis, you might not even remember the exact package name! So the first step is to find what you installed. On CentOS, you do this with the following command:

rpm -qa redis

You don’t need to remember the exact package name with the version number. This command will give you the details of the packages you have installed on your system along with the exact version number.

Step 2: See the History of the Package – When was it Installed, and How?

Now that we know what was installed, we use the yum history command to see how the package was installed and when using the following command:

yum history info redis

This will give an output like this:

Yum History Info Output
Yum History Info Output

Here you can see that redis was installed using the “yum install redis” command, and a dependency called “jemalloc” was installed along with it.

Most importantly, the transaction ID is 311. This is the key that we’re going to use to reverse the installation of redis.

Step 3: Undo the Transaction ID

In the previous step, we go to the transaction ID. This is useful because we’re going to use it to reverse the installation of redis in one step. Some packages might have several dependencies installed along with them, and you don’t want to uninstall each of them separately by typing in the exact package names and version numbers.

We see that in the example above, my transaction ID is 311. Now I just reverse it using the following command:

yum history undo 311

Yum will process the command and ask you for confirmation that you DO want to erase everything that was installed with the original command. Click yes, and you’re done!

Step 4: Restart Services that Use the Package

Finally, you should keep in mind that sometimes services live on in memory even after they’ve been uninstalled. So do the following:

  1. Restart services that use the uninstalled packages (in my example, httpd, and php-fpm)
  2. Find and kill the running processes
  3. Stop and disable the services using the “systemctl stop” and “systemctl disable” commands to clean everything up.

That should be everything! Now you know how to completely remove installed packages from CentOS without leaving any residue.

Bhagwad Park Profile Picture
Bhagwad Park

I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!

Related Posts

How to Use zsh Syntax Highlighting

In an earlier post, we discussed the basics of zsh, what it is, and how to get started. Today we’ll look at syntax highlighting in zsh, its meaning, and how to implement it. I’ll also explain why it doesn’t work well with bash, even though we can get it to work in a “hacky” way. […]

Using Bash Job Controls to Manage Multiple Processes

Bash job controls are used to send long running tasks into the background, and bring them forward when necessary.

Symbolic Links vs Hard Links in Linux

Linux offers various methods for referencing files and directories through other files and directories, without creating copies of the original. If you have color coding enabled in your bash terminal, you might have seen some folders full of files of a different color from regular files. There’s a good chance that these are all symbolic […]

How to Use the Tee Command in Linux

The tee command in Linux is useful when you want to direct the output of a command to multiple locations. Here's how to use it.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow & Subscribe

Exclusive promos, content and more!


Most Popular Posts

NameHero’s Recommended WordPress Plugin and Theme Setup

WordPress Hosting vs. Web Hosting – What’s The Difference?

How To Increase The InnoDB Buffer Pool Size

How To Fix A Stuck All-in-One WP Migration Import

How To Add A Subdomain In Cloudflare

Top Categories

  • WordPress
  • WordPress Tutorials
  • OpenClaw Hosting
  • Enterprise Hosting
  • WooCommerce
  • Web Hosting
  • Resellers
  • Website Security
  • Website Development
  • Website Performance
  • VPS Hosting
  • SEO Tips
  • Announcements
  • Domain Registration
NameHero

NameHero® proudly provides web hosting to over 40,000 customers with 99.9% uptime to over 750,000 websites.

  • Master Card
  • Visa
  • American Express
  • Discover
  • Paypal
Products
  • Web Hosting
  • Managed VPS Hosting
  • Unmanaged VPS Hosting
  • Flex VPS Hosting
  • WordPress Hosting
  • WooCommerce Hosting
  • Reseller Hosting
  • Enterprise Hosting
  • GPU Hosting
  • Email Hosting
  • HeroicGuard
  • Domains
  • Website Builder
  • AI Agent Hosting
Help & Support
  • NameHero Blog
  • NameHero Gaming Blog
  • Support
  • Help Center
  • Migrations
  • Affiliates
  • Gaming Affiliates
  • Call 1-855-984-6263
Company
  • About Us
  • Contact Sales
  • Reviews
  • Uptime
  • We're Hiring

Copyright © 2026 Name Hero, LLC. All rights reserved.
NameHero® is a registered trademark.

  • Privacy Policy
  • Terms of Use
  • Acceptable Use Policy
  • Payment Policy
  • DMCA