Yum/rpm: Difference between revisions

From Cheatsheet
Jump to navigation Jump to search
Created page with "This page contains methods to work on the yum/rpm system. package-cleanup --dupes package-cleanup --cleandupes yum clean all yum update"
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
This page contains methods to work on the yum/rpm system.
This page contains methods to work on the yum/rpm system.


==RPM==
=== RPM basics ===
Rpm src packages go here
/usr/local/src/


remove old kernal srcs
rpm -qa | grep kernel-source | xargs rpm -e


Rpm remove installed packages
rpm -e --nodeps {package name here}


RPM remove only a rpm library entry
rpm -e --justdb --nodeps {package name here}


package-cleanup --dupes
=== RPM db repair ===
package-cleanup --cleandupes
Remove /var/lib/rpm/__db* files to avoid stale locks:
yum clean all
rm -f /var/lib/rpm/__db*
yum update
 
Rebuild RPM database:
rpm -vv --rebuilddb
rpmdb_verify Packages
 
 
== YUM ==
=== Cleaning out duplicate packages ===
Run the following:
package-cleanup --dupes
package-cleanup --cleandupes
yum clean all
yum update
 
=== YUM problems ===
First off always check this location
 
ls -lah /etc/yum.repos.d
 
And if it lists anything MORE than the following please mv everything else out of this folder.
 
root@host [/usr/local/cpanel/logs/easy/apache]# ls -lah /etc/yum.repos.d
total 20K
drwxr-xr-x  2 root    root    4.0K Nov 14 19:08 ./
drwxr-xr-x  63 root    root      12K Nov 14 20:02 ../
-rw-r--r--    1 root root  469 Dec 30  2011 yum.sourcedns.repo
-rw-r--r--    1 root root  606 Dec 30  2011 yum.system.repo
 
if you see anything more than this please move all other repos out of this folder and try again. If you problem still occurs please proceed on.  Next check you yum.conf to make sure it is correct should look like the following.
 
'''for cent5'''
[root@Shooltz.net [~]$ cat /etc/yum.conf
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=centos-release
tolerant=1
exactarch=1
retries=20
obsoletes=1
gpgcheck=1
exclude=apache* bind-chroot centos-yumconf courier* dovecot* exim* httpd* mod_ssl* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail*
 
If you yum.conf does not look lik ethat please back it up and replace it with what follows.
 
mv /etc/yum.conf /etc/yum.conf.bak
echo -e "[main]\ncachedir=/var/cache/yum\ndebuglevel=2\nlogfile=/var/log/yum.log\npkgpolicy=newest\ndistroverpkg=centos-release\ntolerant=1\nexactarch=1\nretries=20\nobsoletes=1\ngpgcheck=1\nexclude=apache* bind-chroot centos-yumconf courier* dovecot* exim* httpd* mod_ssl* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail*" > /etc/yum.conf
 
After this has been completed, and if it is still broken we will reset the rpm databases: go to [https://shooltz.net/w/index.php?title=Yum/rpm#RPM_db_repair RPM_db_repair]

Latest revision as of 21:49, 5 August 2016

This page contains methods to work on the yum/rpm system.

RPM

RPM basics

Rpm src packages go here

/usr/local/src/

remove old kernal srcs

rpm -qa | grep kernel-source | xargs rpm -e

Rpm remove installed packages

rpm -e --nodeps {package name here}

RPM remove only a rpm library entry

rpm -e --justdb --nodeps {package name here}

RPM db repair

Remove /var/lib/rpm/__db* files to avoid stale locks:

rm -f /var/lib/rpm/__db*

Rebuild RPM database:

rpm -vv --rebuilddb
rpmdb_verify Packages


YUM

Cleaning out duplicate packages

Run the following:

package-cleanup --dupes
package-cleanup --cleandupes
yum clean all
yum update

YUM problems

First off always check this location

ls -lah /etc/yum.repos.d

And if it lists anything MORE than the following please mv everything else out of this folder.

root@host [/usr/local/cpanel/logs/easy/apache]# ls -lah /etc/yum.repos.d
total 20K
drwxr-xr-x   2 root     root     4.0K Nov 14 19:08 ./
drwxr-xr-x  63 root     root      12K Nov 14 20:02 ../
-rw-r--r--    1 root root   469 Dec 30  2011 yum.sourcedns.repo
-rw-r--r--    1 root root   606 Dec 30  2011 yum.system.repo

if you see anything more than this please move all other repos out of this folder and try again. If you problem still occurs please proceed on. Next check you yum.conf to make sure it is correct should look like the following.

for cent5

[root@Shooltz.net [~]$ cat /etc/yum.conf
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=centos-release
tolerant=1
exactarch=1
retries=20
obsoletes=1
gpgcheck=1
exclude=apache* bind-chroot centos-yumconf courier* dovecot* exim* httpd* mod_ssl* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail*

If you yum.conf does not look lik ethat please back it up and replace it with what follows.

mv /etc/yum.conf /etc/yum.conf.bak
echo -e "[main]\ncachedir=/var/cache/yum\ndebuglevel=2\nlogfile=/var/log/yum.log\npkgpolicy=newest\ndistroverpkg=centos-release\ntolerant=1\nexactarch=1\nretries=20\nobsoletes=1\ngpgcheck=1\nexclude=apache* bind-chroot centos-yumconf courier* dovecot* exim* httpd* mod_ssl* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail*" > /etc/yum.conf

After this has been completed, and if it is still broken we will reset the rpm databases: go to RPM_db_repair