RPM & YUM tricks
So you're building a complex system that requires installing many software packages in RPM format and you keep having problems with dependencies, conflicts, and who knows what else. Here are some handy RPM commands that might come in useful.
# extracts the contents of an RPM to disk
rpm2cpio < packagename.rpm | cpio - ivd
# list the contents of an RPM file
rpm -qpi packagename.rpm
# install all the RPMs in the current folder
rpm -U *.rpm
# don't install, but print out what would happen
rpm -i --test list of RPM packages
# replace existing files in another package even if there is a conflict
rpm -i --replacefiles packagename.rpm
# Removes the last 'n' RPMs. The example below uses last 15 RPMs.
rpm -qa --last | head -15 | cut -d" " -f 1 | xargs rpm -e
# test a group of RPMs for missing dependencies (or other problems)
# definitely need to resolve "is needed by" errors
mkdir /tmp/testdb
rpm --initdb --dbpath /tmp/testdb
cd packages folder
rpm --test --dbpath /tmp/testdb -Uvh *.rpm
rpm -rf /tmp/testdb
# save the RPMs that are downloaded and installed by yum
Edit the /etc/yum.conf file and change (or insert) keepcache=1
# download only (don't install) RPMs using yum
yum install yum-downloadonly
yum update somepackage --downloadonly
yum update somepackage --downloadonly --downloaddir=/tmp/newpkgs
Labels: Linux, RPM, System Admin
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home