Erase multiple packages using rpm or yum

后端 未结 5 997
故里飘歌
故里飘歌 2021-02-01 23:17

I was given access to a server with 50+ php rpms installed. I\'m trying to remove them all.

Basically, I\'m trying to combine these two commands:

rpm -qa         


        
5条回答
  •  遇见更好的自我
    2021-02-01 23:28

    Using yum

    List and remove the indicated packages and all their dependencies, but with a y/N confirmation:

    yum remove 'php*'
    

    To bypass the confirmation, replace yum with yum -y.

    Using rpm

    This section builds upon the answers by twalburg and Ricardo.

    List which RPMs are installed:

    rpm -qa 'php*'
    rpm -qa | grep '^php'  # Alternative listing.
    

    List which RPMs which will be erased, without actually erasing them:

    rpm -e --test -vv $(rpm -qa 'php*') 2>&1 | grep '^D:     erase:'
    

    On Amazon Linux, you may need to use grep '^D: ========== ---' instead.

    If the relevant RPMs are not listed by the command above, investigate errors:

    rpm -e --test -vv $(rpm -qa 'php*')
    

    Erase these RPMs:

    rpm -e $(rpm -qa 'php*')
    

    Confirm the erasure:

    rpm -qa 'php*'
    

提交回复
热议问题