Linux software management systems

From Got Opinion Wiki
Jump to navigation Jump to search

yum

yum how to has some yum basics. yum is a software installation tool for Red Hat Enterprise Linux & Fedora Linux.

managing packages with yum

some yum examples

package-cleanup, a yum utility

yum basics

List

List all installed packages:

# yum list installed

List might be large you can pipe to scroll through list:

# yum list installed | more
# yum list installed | less

You may also redirect output to file:

# yum list installed > /tmp/yum-installed

List certain packages:

# yum list vsftpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: mirror.trouble-free.net
 * base: mirror.steadfast.net
 * extras: mirror.trouble-free.net
 * updates: styx.biochem.wfubmc.edu
Available Packages
vsftpd.x86_64                      2.0.5-16.el5_5.1                      updates

Install

Install packages

# yum install packagename

Install local RPM

# yum localinstall rpmname

yum group commands

List available package groups:

# yum grouplist

Display details about a package group:

# yum groupinfo 'FTP Server'
Loaded plugins: fastestmirror
Setting up Group Process
Loading mirror speeds from cached hostfile
 * addons: mirror.trouble-free.net
 * base: mirror.steadfast.net
 * extras: mirror.trouble-free.net
 * updates: styx.biochem.wfubmc.edu

Group: FTP Server
 Description: These tools allow you to run an FTP server on the system.
 Mandatory Packages:
   vsftpd
 Optional Packages:
   xferstats

Install the packages in a group on your system:

# yum groupinstall 'FTP Server'
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: mirror.trouble-free.net
 * base: mirror.steadfast.net
 * extras: mirror.trouble-free.net
 * updates: styx.biochem.wfubmc.edu
Setting up Group Process
Checking for new repos for mirrors
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.0.5-16.el5_5.1 set to be updated
addons/filelists                                         |  197 B     00:00     
base/filelists_db                                        | 4.0 MB     00:00     
extras/filelists_db                                      | 220 kB     00:00     
updates/filelists_db                                     | 1.4 MB     00:04     
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch           Version                    Repository       Size
================================================================================
Installing:
 vsftpd         x86_64         2.0.5-16.el5_5.1           updates         139 k

Transaction Summary
================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 139 k
Is this ok [y/N]: y
Downloading Packages:
vsftpd-2.0.5-16.el5_5.1.x86_64.rpm                       | 139 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : vsftpd                                                   1/1 

Installed:
  vsftpd.x86_64 0:2.0.5-16.el5_5.1                                              

Complete!

Remove the packages in a group from your system:

# yum groupremove 'FTP Server'
Loaded plugins: fastestmirror
Setting up Group Process
Loading mirror speeds from cached hostfile
 * addons: mirror.trouble-free.net
 * base: mirror.steadfast.net
 * extras: mirror.trouble-free.net
 * updates: styx.biochem.wfubmc.edu
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.0.5-16.el5_5.1 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch           Version                  Repository         Size
================================================================================
Removing:
 vsftpd         x86_64         2.0.5-16.el5_5.1         installed         283 k

Transaction Summary
================================================================================
Remove        1 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing        : vsftpd                                                   1/1 

Removed:
  vsftpd.x86_64 0:2.0.5-16.el5_5.1                                              

Complete!

yum help & output

Note that not all commands are documented. Example is installed.

# yum -h
Loaded plugins: fastestmirror
You need to give some command
usage: yum [options] COMMAND

List of Commands:

check-update   Check for available package updates
clean          Remove cached data
deplist        List a package's dependencies
downgrade      downgrade a package
erase          Remove a package or packages from your system
groupinfo      Display details about a package group
groupinstall   Install the packages in a group on your system
grouplist      List available package groups
groupremove    Remove the packages in a group from your system
help           Display a helpful usage message
info           Display details about a package or group of packages
install        Install a package or packages on your system
list           List a package or groups of packages
localinstall   Install a local RPM
makecache      Generate the metadata cache
provides       Find what package provides the given value
reinstall      reinstall a package
repolist       Display the configured software repositories
resolvedep     Determine which package provides the given dependency
search         Search package details for the given string
shell          Run an interactive yum shell
update         Update a package or packages on your system
upgrade        Update packages taking obsoletes into account


options:
  -h, --help            show this help message and exit
  -t, --tolerant        be tolerant of errors
  -C                    run entirely from cache, don't update cache
  -c  [config file]     config file location
  -R  [minutes]         maximum command wait time
  -d  [debug level]     debugging output level
  --showduplicates      show duplicates, in repos, in list/search commands
  -e  [error level]     error output level
  -q, --quiet           quiet operation
  -v, --verbose         verbose operation
  -y                    answer yes for all questions
  --version             show Yum version and exit
  --installroot=[path]  set install root
  --enablerepo=[repo]   enable one or more repositories (wildcards allowed)
  --disablerepo=[repo]  disable one or more repositories (wildcards allowed)
  -x [package], --exclude=[package]
                        exclude package(s) by name or glob
  --disableexcludes=[repo]
                        disable exclude from main, for a repo or for
                        everything
  --obsoletes           enable obsoletes processing during updates
  --noplugins           disable Yum plugins
  --nogpgcheck          disable gpg signature checking
  --disableplugin=[plugin]
                        disable plugins by name
  --enableplugin=[plugin]
                        enable plugins by name
  --skip-broken         skip packages with depsolving problems
  --color=COLOR         control whether color is used

RPM

RPM basics

RPM Package Manager (RPM) is a powerful command line driven package management system capable of installing, uninstalling, verifying, querying, and updating computer software packages. Each software package consists of an archive of files along with information about the package like its version, a description, and the like. There is also a library API, permitting advanced developers to manage such transactions from programming languages such as C or Python.


RPM help

# rpm --help
Usage: rpm [OPTION...]
  --quiet

Query options (with -q or --query):
  -c, --configfiles                list all configuration files
  -d, --docfiles                   list all documentation files
  --dump                           dump basic file information
  -l, --list                       list files in package
  --queryformat=QUERYFORMAT        use the following query format
  -s, --state                      display the states of the listed files
  -a, --all                        query/verify all packages
  -f, --file                       query/verify package(s) owning file
  -g, --group                      query/verify package(s) in group
  -p, --package                    query/verify a package file
  -W, --ftswalk                    query/verify package(s) from TOP file tree
                                   walk
  --pkgid                          query/verify package(s) with package
                                   identifier
  --hdrid                          query/verify package(s) with header
                                   identifier
  --fileid                         query/verify package(s) with file identifier
  --specfile                       query a spec file
  --triggeredby                    query the package(s) triggered by the
                                   package
  --whatrequires                   query/verify the package(s) which require a
                                   dependency
  --whatprovides                   query/verify the package(s) which provide a
                                   dependency
  --nomanifest                     do not process non-package files as
                                   manifests

Verify options (with -V or --verify):
  --nomd5                          don't verify MD5 digest of files
  --nofiles                        don't verify files in package
  --nodeps                         don't verify package dependencies
  --noscript                       don't execute verify script(s)
  -a, --all                        query/verify all packages
  -f, --file                       query/verify package(s) owning file
  -g, --group                      query/verify package(s) in group
  -p, --package                    query/verify a package file
  -W, --ftswalk                    query/verify package(s) from TOP file tree
                                   walk
  --pkgid                          query/verify package(s) with package
                                   identifier
  --hdrid                          query/verify package(s) with header
                                   identifier
  --fileid                         query/verify package(s) with file identifier
  --specfile                       query a spec file
  --triggeredby                    query the package(s) triggered by the
                                   package
  --whatrequires                   query/verify the package(s) which require a
                                   dependency
  --whatprovides                   query/verify the package(s) which provide a
                                   dependency
  --nomanifest                     do not process non-package files as
                                   manifests

File tree walk options (with --ftswalk):
  --comfollow                      FTS_COMFOLLOW: follow command line symlinks
  --logical                        FTS_LOGICAL: logical walk
  --nochdir                        FTS_NOCHDIR: don't change directories
  --nostat                         FTS_NOSTAT: don't get stat info
  --physical                       FTS_PHYSICAL: physical walk
  --seedot                         FTS_SEEDOT: return dot and dot-dot
  --xdev                           FTS_XDEV: don't cross devices
  --whiteout                       FTS_WHITEOUT: return whiteout information

Signature options:
  --addsign                        sign package(s) (identical to --resign)
  -K, --checksig                   verify package signature(s)
  --delsign                        delete package signatures
  --import                         import an armored public key
  --resign                         sign package(s) (identical to --addsign)
  --nodigest                       don't verify package digest(s)
  --nosignature                    don't verify package signature(s)

Database options:
  --initdb                         initialize database
  --rebuilddb                      rebuild database inverted lists from
                                   installed package headers

Install/Upgrade/Erase options:
  --aid                            add suggested packages to transaction
  --allfiles                       install all files, even configurations
                                   which might otherwise be skipped
  --allmatches                     remove all packages which match <package>
                                   (normally an error is generated if
                                   <package> specified multiple packages)
  --badreloc                       relocate files in non-relocatable package
  -e, --erase=<package>+           erase (uninstall) package
  --excludedocs                    do not install documentation
  --excludepath=<path>             skip files with leading component <path> 
  --fileconflicts                  detect file conflicts between packages
  --force                          short hand for --replacepkgs --replacefiles
  -F, --freshen=<packagefile>+     upgrade package(s) if already installed
  -h, --hash                       print hash marks as package installs (good
                                   with -v)
  --ignorearch                     don't verify package architecture
  --ignoreos                       don't verify package operating system
  --ignoresize                     don't check disk space before installing
  -i, --install                    install package(s)
  --justdb                         update the database, but do not modify the
                                   filesystem
  --nodeps                         do not verify package dependencies
  --nomd5                          don't verify MD5 digest of files
  --nocontexts                     don't install file security contexts
  --noorder                        do not reorder package installation to
                                   satisfy dependencies
  --nosuggest                      do not suggest missing dependency
                                   resolution(s)
  --noscripts                      do not execute package scriptlet(s)
  --notriggers                     do not execute any scriptlet(s) triggered
                                   by this package
  --oldpackage                     upgrade to an old version of the package
                                   (--force on upgrades does this
                                   automatically)
  --percent                        print percentages as package installs
  --prefix=<dir>                   relocate the package to <dir>, if
                                   relocatable
  --relocate=<old>=<new>           relocate files from path <old> to <new>
  --repackage                      save erased package files by repackaging
  --replacefiles                   ignore file conflicts between packages
  --replacepkgs                    reinstall if the package is already present
  --test                           don't install, but tell if it would work or
                                   not
  -U, --upgrade=<packagefile>+     upgrade package(s)

Common options for all rpm modes and executables:
  -D, --define='MACRO EXPR'        define MACRO with value EXPR
  -E, --eval='EXPR'                print macro expansion of EXPR
  --macros=<FILE:...>              read <FILE:...> instead of default file(s)
  --nodigest                       don't verify package digest(s)
  --nosignature                    don't verify package signature(s)
  --rcfile=<FILE:...>              read <FILE:...> instead of default file(s)
  -r, --root=ROOT                  use ROOT as top level directory (default:
                                   "/")
  --querytags                      display known query tags
  --showrc                         display final rpmrc and macro configuration
  --quiet                          provide less detailed output
  -v, --verbose                    provide more detailed output
  --version                        print the version of rpm being used

Options implemented via popt alias/exec:
  --scripts                        list install/erase scriptlets from
                                   package(s)
  --setperms                       set permissions of files in a package
  --setugids                       set user/group ownership of files in a
                                   package
  --conflicts                      list capabilities this package conflicts
                                   with
  --obsoletes                      list other packages removed by installing
                                   this package
  --provides                       list capabilities that this package provides
  --requires                       list capabilities required by package(s)
  --info                           list descriptive information from package(s)
  --changelog                      list change logs for this package
  --xml                            list metadata in xml
  --triggers                       list trigger scriptlets from package(s)
  --last                           list package(s) by install time, most
                                   recent first
  --dupes                          list duplicated packages
  --filesbypkg                     list all files from each package
  --fileclass                      list file names with classes
  --filecolor                      list file names with colors
  --filecontext                    list file names with security context from
                                   header
  --fscontext                      list file names with security context from
                                   file system
  --recontext                      list file names with security context from
                                   policy RE
  --fileprovide                    list file names with provides
  --filerequire                    list file names with requires
  --redhatprovides                 find package name that contains a provided
                                   capability (needs rpmdb-redhat package
                                   installed)
  --redhatrequires                 find package name that contains a required
                                   capability (needs rpmdb-redhat package
                                   installed)
  --buildpolicy=<policy>           set buildroot <policy> (e.g. compress man
                                   pages)
  --with=<option>                  enable configure <option> for build
  --without=<option>               disable configure <option> for build

Help options:
  -?, --help                       Show this help message
  --usage                          Display brief usage message

Aptitude

Ubuntu package management

Installed packages on your computer may periodically have upgrades available from the package repositories (e.g., security updates). To upgrade your system, first update your package index and then perform the upgrade – as follows:

sudo apt update
sudo apt upgrade

Copied from Garfield Tech for reference:

aptitude update: Update the local cache of available packages (formerly apt-get update.
aptitude upgrade: Upgrade available packages (formerly apt-get upgrade).
aptitude dist-upgrade: Upgrade available packages even if it means removing stuff (formerly apt-get dist-upgrade).
aptitude install pkgname: Install package (formerly apt-get install).
aptitude remove pkgname: Uninstall package (formerly apt-get remove).
aptitude purge pkgname: Uninstall package and config files (formerly apt-get --purge remove).
aptitude search string: Search for a package with "string" in the name or description (formerly apt-cache search string).
aptitude show pkgname: Show detailed of a package (formerly apt-cache show pkgname).
aptitude clean: Delete downloaded package files (formerly apt-get clean).
aptitude autoclean: Delete only out-of-date package files but keep current ones (formerly apt-get autoclean).
aptitude hold pkgname: Fix a package at its current version and don't upgrade it automatically (formerly an obscure echo-to-file command). unhold to remove the hold.

Aptitude Links

Package Management with APT Ubuntu


To Linux