Using RPMs/YUM

(build packages using rpm-build)
$ yum install rpm-build

(install/update/erase packages using yum)
$ yum update|install|erase package

(install ignoring package signature)
$ yum install package --nogpgcheck 

(install package locally)
$ yum localinstall package.rpm

(extract files from package)
$ rpm2cpio package.rpm | cpio -idmv

(list files from package)
$ rpm -qlp package.rpm or rpm -ql package or repoquery --list package

(search for package that provides a file)
$ yum provides */file

(download rpms from repo w/o install using yum-utils)
$ yum install yum-utils
$ yumdownloader httpd --resolve

(download rpms from repo w/o install using yum-downloadonly)
$ yum install yum-downloadonly
$ yum update package -y --downloadonly --downloaddir=/opt

(list installed repos, add/remove repo to /etc/yum.repos.d/)
$ yum repolist

(create a local repo, see http://yum.baseurl.org/wiki/RepoCreate)
(you should do this from within a rpm, see http://wiki.centos.org/AdditionalResources/Repositories/RPMForge)
$ yum install createrepo
$ cp package.rpm /srv/my/repo/`uname -i`/RPMS/
$ createrepo /srv/my/repo/`uname -i`/ or createrepo --update /srv/my/repo/`uname -i`/
$ echo "[myrepo]\nname = Myrepo-$releasever\nbaseurl = file:///srv/my/repo/$basearch/" > /etc/yum.repos.d/myrepo.repo

(sync all packages from the ’updates’ repo to the repos directory)
$ reposync -p repos --repoid=updates

(list/do/undo transactions using yum history, see http://yum.baseurl.org/wiki/YumHistory)
$ yum history list|info|undo|redo

(using groups, see http://yum.baseurl.org/wiki/YumGroups)
$ yum grouplist|groupinfo groupname|groupinstall groupname|groupupdate groupname|groupremove groupname

(creating groups)
$ yum-groups-manager -n "My Group" --id=mygroup --save=mygroups.xml --mandatory package1 package2 package2
$ createrepo -g /path/to/mygroups.xml /srv/my/repo

(cleanup yum cache)
$ yum clean all

from 20 Linux YUM (Yellowdog Updater, Modified) Commands for Package Management

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s