LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   centos how to check for dependency and uninstall package (https://www.linuxquestions.org/questions/linux-newbie-8/centos-how-to-check-for-dependency-and-uninstall-package-601503/)

jCash 11-21-2007 01:31 PM

centos how to check for dependency and uninstall package
 
I am running centos 5.

1) How do I use rpm command to list the package installed and its dependency.

2) How do I use rpm command to uninstall package and its dependency?

thnx.

ranger_nemo 11-21-2007 02:01 PM

This command will list any package that has "fox" in it's name...
Code:

rpm -qa | grep fox
This command will list what is required by the firefox package...
Code:

rpm -q -R firefox
This command will erase the firefox package...
Code:

rpm -e firefox
If something depends on a package you are erasing, it will error and tell you what it is. You can then add it to the erase command if you want, or not do anything. (Thunderbird doesn't depend on firefox, that's just an example of erasing two packages at once.)
Code:

rpm -e firefox thunderbird
It's prob'ly not a good idea to run a command that tries to delete all dependencies for a package... In the example above, it lists about 100 dependencies for firefox.

Now, having answered the questions, is there a reason you need / want to use rpm rather than yum? yum is a package manager that uses rpm. yum is also better at handling dependencies than rpm. The commands above would be similar in yum...
Code:

yum list | grep fox
Code:

yum deplist firefox
Code:

yum remove firefox
This command will install GIMP. It will check if there are any dependencies that need to be downloaded and installed, and do so. rpm won't retrieve dependencies, just error when you don't have them.
Code:

yum install gimp

jCash 11-21-2007 03:30 PM

I have package A, B and C. Package A needs B and B needs C.
I want to uninstall package A. If do:

Code:

rpm -e packA
I will complain about packB.
Code:

rpm -e packA, packB
then it will complain about packC. Do I have to keep doing this until I get to the bottom of the dependency and add the package to the command
Code:

rpm -e packA,..,packZ
?

Or any simpler way to remove or at least list this type of package dependency?

billymayday 11-21-2007 04:27 PM

Have you tried yum remove? It should be able to do this for you

ranger_nemo 11-22-2007 09:14 PM

Quote:

Originally Posted by jCash (Post 2966875)
I have package A, B and C. Package A needs B and B needs C.
I want to uninstall package A.

If you remove A, it should go without a problem... In your example, nothing depends on A.

Unfortunately, you'll have to track down and remove any packages A depends on.

tuewru 03-03-2010 08:41 AM

You can use YUM for install and uninstall packages

Task: Display list of updated software (security fix)

Quote:

Type the following command at shell prompt:
# yum list updates

Task: List all installed packages


List all installed packages, enter:
# rpm -qa
# yum list installed

Task: Check for and update specified packages

# yum update {package-name-1}

Task: Search for packages by name

Search httpd and all matching perl packages, enter:
# yum list {package-name}
# yum list {regex}
# yum list httpd
# yum list perl*


Task: Install the specified packages [ RPM(s) ]


Install package called httpd:
# yum install {package-name-1} {package-name-2}
# yum install httpd

Task: Remove / Uninstall the specified packages [ RPM(s) ]

Remove package called httpd, enter:
# yum remove {package-name-1} {package-name-2}
# yum remove httpd


Task: Update all the default packages by group


Update all 'Development Tools' group packages, enter:
# yum groupupdate "Development Tools"


Code:

http://www.cyberciti.biz/faq/rhel-centos-fedora-linux-yum-command-howto/
Best regards

chrism01 03-03-2010 07:26 PM

Please don't bring up old posts (3 yrs old).


All times are GMT -5. The time now is 11:34 AM.