====== Playing around with RPMs and the rpm command ====== <color purple>RPM</color> is the package manager format used on Fedora Core (it's also widely used on others). It stands for Red Hat package Manager (well, who cares anyway). You probably already know you can install or uninstall RPMs, but you can do way more than that. RPM is the filename extension of individual packages you can install, but it's also the name of the whole underlying system that keeps track of what's installed on your computer, where and how. The rpm command has lots of parameters and options. Here's a couple of ones I use 99% of the time. To install an .rpm package: <code console> # rpm -Uvh file.rpm </code> <color purple>-U</color> as in update which permits the package manager to update to a newer version a program you already installed before. Don't worry if the rpm file you install was never installed before, because if this is the case, then the package manager will behave as if you specified <color purple>-i</color>" instead of <color purple>-U</color>, which means of course: install.\\ So in short: always use <color purple>-U</color>, never use <color purple>-i</color>.\\ One exception is to be noted: kernels can be installed multiple times (in different versions), so always use <color purple>-i</color> and not <color purple>-U</color> when manually installing kernels.\\ <color purple>-h</color> and <color purple>-v</color> are only to display stuff while rpm is working (by default it's totally silent). To list currently installed packages: <code console> $ rpm -qa </code> <color purple>-q</color> as in query, which means that rpm has to just query its database, not installing or uninstalling anything. <color purple>-a</color> means all packages. For a faster version that doesn't check signatures or compute digests, you can use: <code console> $ rpm -qa --nodigest --nosignature </code> To list all the files installed by a specific package: <code console> $ rpm -ql package_name </code> <color purple>-l</color> as in list files. Note that you don't have to type the version number of the package.\\ For example if with the previous installed packages listing command you had "bash-3.1-6.2", you can only use "bash" here. To check the consistency of an installed package: <code console> $ rpm -V package_name </code> <color purple>-V</color> as in verify. If nothing is displayed, then everything is okay. Else, you will have one line per file-problem with a letter-code telling you what's the problem (missing file, changed size, changed permissions, changed checksum, etc.). It's detailed in the rpm manual. To uninstall a package: <code console> # rpm -e package_name </code> <color purple>-e</color> as in erase. Beware: it won't ask you for confirmation. To ask rpm to which package a given file belongs to: <code console> $ rpm -qf /path/to/some/file </code> I find this one particularely great ! To list the contents of an rpm file: <code console> $ rpm -qlp filename.rpm </code> <color purple>-p</color> as in package. You can also use <color purple>-qlpv</color> if you want more details.\\ Note the difference between <color purple>-ql</color> and <color purple>-qlp</color>: the first is about an already installed package (you don't even need to still have the rpm file you used to install it), the second is about an actual rpm file (installed or not). Now, last but not least... how to extract the contents of an rpm file ? I mean, how extracting the contents of an rpm file without installing it at all ? This can be useful if you just need one file stored in an rpm but don't want to install the whole stuff. Well, this is pretty easy (once you know it !). Place yourself into an empty directory, and type: <code console> $ rpm2cpio /path/to/somefile.rpm | cpio -idv </code> That's all ! The <color red>cpio</color> program is found in the RPM of the same name (just <color red>yum install</color> it if you don't have it). ~~META:date created = 2006-09-06 13:30:00~~

 
blog/playing_around_with_rpms_and_the_rpm_command.txt · Last modified: 08/03/2010 13:25 (external edit) · []
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki