rpm
From Initq
YUM
Install from cd again
After installing redhat it discards the cd and you are left to only update from the net. You can re-enable the cd again. Edit the file /etc/yum.repo.d/mycd.repo.
If the file does not exist then create it.
For RH6
[base] name=RH6 baseurl=file:///mnt/cdrom/Server gpgcheck=0 enable=1
For RH5
[Server] name=Server baseurl=file:///mnt/cdrom/Server/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [VT] name=Virtualization baseurl=file:///mnt/cdrom/VT/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [Cluster] name=Cluster baseurl=file:///mnt/cdrom/Cluster/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [ClusterStorage] name=Cluster Storage baseurl=file:///mnt/cdrom/ClusterStorage/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
- yum clean all
- yum update
- yum install <package name>
Cleanup
- yum clean packages
Eliminate any cached packages from the system. Note that packages are not automatically deleted after they are downloaded.
- yum clean headers
Eliminate all of the files which yum uses to determine the remote availablility of packages. Using this option will force yum to download all the headers the next time it is run.
- yum clean oldheaders
Eliminate the old headers that yum no longer needs to determine the remote availablility of packages.
- yum clean [all]
Runs yum clean packages and yum clean oldheaders as above. Mount your RH6 cd in /mnt/cdrom and do yum update. Please delete all other files from /etc/yum.repo.d directory.
Flags
Install
To install a package (i=install v=verbose h=show hash marks) rpm -ivh package
Uninstall
To uninstall (erase) a package rpm -e package
Upgrade
To upgrade a package rpm -Uvh package
Test Install without installing
To test a package to see how it would install (without installing, also checks dependencies) rpm -Uvh --test package
Verify
To verify a package (extra verbose output) rpm -Vvv package
Verify all Packages
To verify ALL installed packages on the system rpm -Va
Check Signature
To verify the cryptographic signature of a package rpm -K package
Query
For example, rpm -ql package would become rpm -qpl package.
Package names
To find out the package names using wildcards rpm -qa | grep pattern
Show files in rpm
What files are included in the the package rpm -ql package
Which repo being used
- yum repolist all
General info of package
To show general info on a package rpm -qi package
Package Owner
What package owns this file? rpm -qf path/to/file
Config files of the package
What are the config files in a package? rpm -qc package
Doc files
What are the documentation files in a package? rpm -qd package
Script Packages
What are the scripts in a package? rpm -q --scripts package
Services
What services does this package provide? rpm -q --provides package
Requires
What services does this package require? rpm -q --requires package
Extract files from rpm
To extract an individual file from an rpm package without installing the rpm: 1. Use rpm2cpio or rpm -qpl to list files and full paths in the package: rpm2cpio package | cpio -t
You need the full path name of a file to extract it in step 2.
2. Use rpm2cpio to extract a file. Run this command from your home directory or /tmp in order to avoid overwriting any current system files.
rpm2cpio package | cpio -iv --make-directories full-path
This creates the full path in the current directory and extracts the file you specified.
3. If you just want to convert it to a cpio archive, use
rpm2cpio package > cpio-archive-file
RPM mass uninstall
If you want to remove a list of RPMs without typing each on separately, you can use the xargs command with rpm. Here are the commands and output from a session where I wanted to delete several RPMs at once. First, I used rpm -qa to find all the xine RPMs. When I verified the list, I passed the list to xargs to execute an rpm -e on each of them. The final rpm -qa verifies that they have all been uninstalled.
artifact:~/datacore/suse-7.3/xine # rpm -qa | grep xine xine-lib-0.9.7-0 xine-lib-aa-0.9.7-0 xine-lib-alsa05-0.9.7-0 xine-lib-arts-0.9.7-0 xine-lib-d4d-0.9.7-0 xine-lib-docs-0.9.7-0 xine-lib-oggvorbis-0.9.7-0 xine-lib-oss-0.9.7-0 xine-lib-w32dll-0.9.7-0 xine-ui-0.9.7-0 xine-ui-aa-0.9.7-0 artifact:~/datacore/suse-7.3/xine # rpm -qa | grep xine | xargs rpm -e artifact:~/datacore/suse-7.3/xine # rpm -qa | grep xine artifact:~/datacore/suse-7.3/xine #
Rebuild DB
rpm --rebuilddb
Force install
--force
Dependencies
--nodeps
Can't install gcc
Edit /etc/yum.conf and comment out
- #exclude=kernel*
Then do yum update.