Solved

Removing unnecessary packages in Redhat 5

Posted on 2011-03-03
9
1,290 Views
Last Modified: 2012-05-11
I have many servers where the admin used the default Redhat install. About 3000 packages were installed as a just in case we need them way of thinking. Is there anyway via scripting that I can uninstall selected packages while leaving the necessary package files in place? Also how would I deal with dependency issues?
0
Comment
Question by:drei22
  • 4
  • 3
  • 2
9 Comments
 
LVL 76

Expert Comment

by:arnold
Comment Utility
rpm -e <list of packagenames to be removed>

Packages will not be removed if there is another package that relies on it.

Are the extra packages besides taking space affect the performance of the system?

You probably can remove all the graphical/X11, Gnome, etc. packages but I found that their existance on the system helps at times when a graphical tool can be exported via an SSH tunnel back to an X-Server or a graphical workstation.
0
 

Author Comment

by:drei22
Comment Utility
What happened is that we have two sites. Site A are the production the baseline servers which are fine.  Site B is where the backup servers are but they have a ton of unnecessary packages installed. I would like to get the Site B servers to match site A servers without having to rebuild the servers in site B. Actually management is insisting that we don't rebuild but but fix as rebuilding only makes sense to us Admins.
0
 
LVL 31

Accepted Solution

by:
farzanj earned 500 total points
Comment Utility
If you have enabled RedHat satellite server, you can do it very easily.

In any case, you need to know the packages you need and the ones you don't.  I would suggest that you should first test on a test box as to the number of packages you need.  If you want to start uninstalling on a production machine, well, it is risky.

Once you have accomplished that, you need to write a trivial script, that does

rpm -e  --nodeps << EOF
chatx
extra
EOF

Note that there are no version numbers or release etc.
This way you will not have to reboot the machines.  However, rebooting would be a good idea because you would know whether it still runs after the uninstall.

Extreme caution is required.  Planning part is most important.
0
 

Author Comment

by:drei22
Comment Utility
Wow. Now that really sucks as I'll have to basically manually go through 3000+ packages and decide what needs to be removed.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 31

Expert Comment

by:farzanj
Comment Utility
Unfortunately yes.  Planning deployment itself is a big thing.  The other solution is to reinstall with the correct packages, which would not be possible on production systems.  I have been doing deployments for a long time now and you have to very carefully plan the functionality you want and then packages are chosen, kickstart is created and deployment is automated.  Once you are using the systems, you would not like everything to break just because of one minor package.
0
 

Author Comment

by:drei22
Comment Utility
Thanks Farzanj! You're information has been very helpful indeed to a new admin.
0
 

Author Closing Comment

by:drei22
Comment Utility
I'm new to Linux administration and this was very helpful.
0
 
LVL 31

Expert Comment

by:farzanj
Comment Utility
You are most welcome
0
 
LVL 76

Expert Comment

by:arnold
Comment Utility
run rpm -qa on the baseline servers. and store the data in a file.

then run rpm -qa on the other servers.
use comm or anyother mechanism to get the listing of the extra packages and then remove them.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now