Hamidreza
Hamidreza

Reputation: 1915

How to remove all packages from specific repo without dependencies

I know following code will remove all package from specific repo.

yum remove $(yum list installed | grep rpmforge | awk '{ print $1 }')

And following code will remove a package without dependencies.

rpm -e --nodeps "php-sqlite2-5.1.6-200705230937"

But i don't know how to use together.

Upvotes: 33

Views: 37610

Answers (5)

konradmb
konradmb

Reputation: 111

This one works with multiple versions of the same package

sudo rpm -e --nodeps `dnf repoquery --installed --queryformat '%{name}-%{epoch}:%{version}-%{release}.%{arch} %{from_repo}' | grep -i "reponame" | awk '{print $1}'`

Upvotes: 0

Donny Davis
Donny Davis

Reputation: 31

I like using
yum -y autoremove yum list installed | grep rpmforge | awk '{ print $1 }'

Upvotes: 3

AldaronLau
AldaronLau

Reputation: 1194

Check to Make Sure That You're Erasing Only What You Want To

dnf list installed | grep package_name.i686 | awk '{ print $1 }' | less

Actually Do The Removing

sudo rpm -e --nodeps `dnf list installed | grep package_name.i686 | awk '{ print $1 }'`

Upvotes: 2

czerny
czerny

Reputation: 16624

Print list of all repositories to get repo id (first column):

$ dnf repolist

Now remove all packages of selected repo:

# dnf repository-packages <repo-id> remove

See repository-packages section of dnf manual page for details regarding manipulation with all packages in specific repository.

Upvotes: 47

robinwen
robinwen

Reputation: 892

Try the following command:

rpm -e --nodeps `yum list installed | grep rpmforge | awk '{ print $1 }'`

Upvotes: 21

Related Questions