Linux Operating System: Package Management
In this short series, we'll go over package management - an essential tool for both beginner Linux users and the more seasoned system adminstrators. Package management will help you seamlessly install, upgrade and maintain software. This series will cover Debian (Ubuntu) package management for now, but we will also include lessons for Red Hat in a future lesson.
A time before package management
Long ago when software wasn't as abundant as it is today, package management was nonexistent. This meant that users had to individually download and compile source code when installing software, a process that was redundant as it was time consuming. Additionally, software that required other dependencies had to be installed separately, making the process of installing large software systems incredibly tedious. With the number of software in a person's computer increasing, so did their complexity of management, as upgrading systems had to be performed manually.
Nowadays, almost all platforms come with a designated package management system. Package managements allow you to install, upgrade, configure and remove software packages from your computer's system. At the heart of this system is a database that contains information about your softwares' last-upgrade dates, dependencies, version number, and more. Package managers allow you to conveniently manage all the software without a sweat.
How package management changed the development community
Not only has package management allowed for users to easily download and maintain software, but it has also forced developers to uphold a strict convention as to how their software is structured.
Furthermore, we now have software available in packages, with information about dependencies, and version numbers. This allows us to keep track of bug information and whether it is necessary to download security patches.
What Package Managerment software is available?
Depending on your Linux distribution, (Debian, Red Hat or SUSE), or platform (OS X), we have different package management software and tools.
Red Hat, which includes CentOS, Fedora, Mandrivia and OpenSuSE, use packaging tools
For OS X, you can use Homebrew.
Review of some terminology before we begin
From the perspective of a package management system, a package file contains all the data files and programs that support the software. This is where all the metadata is found, including a description of its contents, version number and more. This also includes scripts that run before and after the installion is performed.
Dependencies are additional packages required by the principal package in order to function propertly. In short, it is a piece of software that is required for another to run. For example, if the year were 2004 and I wanted to watch a funny animation on the web, I would have to first install Adobe Flash Player. Thus, Adobe Flash Player serves as a dependency to flash animation videos.
Package managers maintain dependency information, allowing the system to know whether it needs to pull anything other programs in.
Libraries are software components that can be shared by many different programs. This allows a reduction in disk space and memory requirements, as multiple programs are allowed to access the same files.
The package management system uses checksums to validate and verify installed software. Checksums allows the computer to check for disk errors or accidental overwrites of files.
Sign in a root
To use any commands that have to deal with package management, you'll need to be signed in as root. To do so, use the
sudo -s command, and put in your system's password when prompted.
Debian (Ubuntu) Package Management dpkg
The Debian package management system works on packages with the .deb extension. The main commands are
aptitude is a text-user interface for
apt-get which we won't cover here.
Let's begin by going over
dpkg, which is mainly used to install, dissect and extract information about packages with the .deb extension.
Dissecting your packages with dpkg
To see a complete listing of all
dpkg commands and options, use the
--help option. Here are the actions (and some options) that go along with
- Install a debian package file.
--skip-same-versionto avoid installing the package if same version is already present.
-Gto avoid installing if newer version of package already exists.
--recursiveto install all packages that match the package name wildcard.
--no-actto check for dependencies, conflicts and other problems without actually installing.
- List contents of a debian package file.
- Reconfigure an installed package that has been unpacked.
- Purges an installed package (removing config files as well).
- Uninstall a package (does not remove config files).
--no-actto check for dependencies, conflicts and other problems without actually installing.
--auto-deconfigureto disable packages that depend on the one being removed.
- Shows information and status on the installed package.
- Print available status details
- Extract package information.
- List all packages on your system. Can add a pattern after the action to list matching installed packages.
- Lists all files installed (or "owned") by the package.
- Searches for partially installed packages and suggests what to do.
- Searches which packages installed a file. Place the name or pattern of the package as an argument after this option.
Additionally, here are some options you may use with one of the above actions.
- Ignores the dependency package.
- Force installation without dependency.
- Overcome conflict problems.
6 examples with dpkg
For practice with the
dpkg command, let's try installing the Vim package and testing out or
dpkg command. Here are just select 6 things you can do with with
dpkg on packages.
1) List information
To print out information about our package, use the
$ dpkg --info vim_7.4.488-7_amd64.deb
new debian package, version 2.0. size 952572 bytes: control archive=2080 bytes. 935 bytes, 22 lines control 237 bytes, 4 lines md5sums 2471 bytes, 78 lines * postinst #!/bin/sh 1218 bytes, 57 lines * prerm #!/bin/sh Package: vim Version: 2:7.4.488-7 Architecture: amd64 Maintainer: Debian Vim Maintainers <firstname.lastname@example.org> Installed-Size: 2233 Depends: vim-common (= 2:7.4.488-7), vim-runtime (= 2:7.4.488-7), libacl1 (>= 2.2.51-8), libc6 (>= 2.15), libgpm2 (>= 1.20.4), libselinux1 (>= 1.32), libtinfo5 Suggests: ctags, vim-doc, vim-scripts Provides: editor Section: editors Priority: optional Homepage: http://www.vim.org/ Description: Vi IMproved - enhanced vi editor Vim is an almost compatible version of the UNIX editor Vi. . Many new features have been added: multi level undo, syntax highlighting, command line history, on-line help, filename completion, block operations, folding, Unicode support, etc. . This package contains a version of vim compiled with a rather standard set of features. This package does not provide a GUI version of Vim. See the other vim-* packages if you need more (or less).
2) List file contents
To check the package file contents, use the
$ dpkg -c vim_7.4.488-7_amd64.deb drwxr-xr-x root/root 0 2015-03-31 16:37 ./ drwxr-xr-x root/root 0 2015-03-31 16:37 ./usr/ drwxr-xr-x root/root 0 2015-03-31 16:37 ./usr/bin/ -rwxr-xr-x root/root 2240936 2015-03-31 16:37 ./usr/bin/vim.basic drwxr-xr-x root/root 0 2015-03-31 16:37 ./usr/share/ drwxr-xr-x root/root 0 2015-03-31 16:37 ./usr/share/bug/ drwxr-xr-x root/root 0 2015-03-31 16:37 ./usr/share/bug/vim/ -rw-r--r-- root/root 516 2014-10-22 18:01 ./usr/share/bug/vim/presubj -rwxr-xr-x root/root 204 2014-10-22 18:01 ./usr/share/bug/vim/script drwxr-xr-x root/root 0 2015-03-31 16:37 ./usr/share/doc/ drwxr-xr-x root/root 0 2015-03-31 16:37 ./usr/share/lintian/ drwxr-xr-x root/root 0 2015-03-31 16:37 ./usr/share/lintian/overrides/ -rw-r--r-- root/root 138 2015-03-31 16:37 ./usr/share/lintian/overrides/vim lrwxrwxrwx root/root 0 2015-03-31 16:37 ./usr/share/doc/vim -> vim-common
3) Unpacking and Configuring
To unpack the package, use the
--unpack option. This won't configure any settings, so we must apply the
--configure option along with it.
$ dpkg --unpack vim_7.4.488-7_amd64.deb
(Reading database ... 166563 files and directories currently installed.) Preparing to unpack vim_7.4.488-7_amd64 (1).deb ... Unpacking vim (2:7.4.488-7) over (2:7.4.052-1ubuntu3) ...
When you run with the
--configure option, you may get some dependency issues, with the terminal erroring out and saying that the versions don't match up. We can handle these dependency installations easily by using
apt-get command. We'll study these in the next lesson, but for now, use the following command to automatically pull in any necessary dependencies and install vim.
$ sudo apt-get install vim
4) Checking the location of package
To check where the folders that your package or software is located, use the
$ dpkg -L vim
/. /usr /usr/bin /usr/bin/vim.basic /usr/share /usr/share/lintian /usr/share/lintian/overrides /usr/share/lintian/overrides/vim /usr/share/bug /usr/share/bug/vim /usr/share/bug/vim/presubj /usr/share/bug/vim/script /usr/share/doc /usr/share/doc/vim
5) Removing and Uninstalling
--remove option to remove Vim from our system, but keep the configuration files. To check if a package is installed or not, use the
$ dpkg -r vim # Vim is now removed $ dpkg -s vim
dpkg-query: package 'vim' is not installed and no information is available Use dpkg --info (= dpkg-deb --info) to examine archive files, and dpkg --contents (= dpkg-deb --contents) to list their contents.
To remove configuration files as well, we must use the
6) Listing out all packages
To list out all your packages on your system with the
-l option. There's going to be a good amount of output, so consider piping to
$ dpkg -l | grep vim
ii vim 2:7.4. | 052-1ubuntu3 amd64 Vi IMproved - enhanced vi editor ii vim-common 2:7.4. | 052-1ubuntu3 amd64 Vi IMproved - Common files ii vim-runtime 2:7.4. | 052-1ubuntu3 all Vi IMproved - Runtime files ii vim-tiny 2:7.4.052-1ubuntu3 amd64 Vi IMproved - enhanced vi editor - compact version r
View log files
To see a list of the previously run
dpkg commands, look at the /var/log/dpkg.log file. The
tail command shows a select few lines at the bottom of the file.
$ tail /var/log/dpkg.log
2015-09-14 13:49:12 startup archives unpack 2015-09-14 13:49:14 install vim:amd64 <none> 2:7.4.052-1ubuntu3 2015-09-14 13:49:14 status half-installed vim:amd64 2:7.4.052-1ubuntu3 2015-09-14 13:49:14 status unpacked vim:amd64 2:7.4.052-1ubuntu3 2015-09-14 13:49:14 status unpacked vim:amd64 2:7.4.052-1ubuntu3 2015-09-14 13:49:14 startup packages configure 2015-09-14 13:49:14 configure vim:amd64 2:7.4.052-1ubuntu3 <none> 2015-09-14 13:49:14 status unpacked vim:amd64 2:7.4.052-1ubuntu3 2015-09-14 13:49:14 status half-configured vim:amd64 2:7.4.052-1ubuntu3 2015-09-14 13:49:14 status installed vim:amd64 2:7.4.052-1ubuntu3
Reconfiguring a package back to default
In case you altered the default configurations of a package and want to revert back, simply use the
dpkg-reconfigure command, followed by the package name.
Limitations of dpkg
The main limitation of the
dpkg command is that it does not automatically pull in any dependencies. The commands that are able to link and pull the relevant dependencies are
apt-cache, which we'll see next.
Installing, removing and updating with Advanced Package Tool apt-get, apt-cache
The Advanced Package Tool (APT) is a suite of commands that allow us to interface with our package management system. With it, we can install new software packages (straight from the web via terminal) and upgrade existing ones. Additionally, the
apt-get command pulls in any dependencies necessary, which covers
dpkg's drawback. When dealing with installing and updating software, you'll mostly be working with these commands.
Again, make sure you're signed in as root permissions with the
sudo -s command.
Let's start with a moo:
apt-get moo (__) (oo) /------\/ / | || * /\---/\ ~~ ~~ ..."Have you mooed today?"...
Actions with apt-get
Here is a list of actions you can use with the
- Installs a package.
- Removes a package.
- Retrieves newest available source package file by name.
- Checks for consistency and if there are any broken packages.
- Clears out data regarding files from the Debian package database. Run this from time to time to save disk space.
- Resynchronizes the package index files from sources. Allows for new and updated information about packages.
- Upgrade all packages to the newest version from sources in /etc/apt/sources.list.
- Intelligently handles changing dependencies with new version of packages. Avoids dependency breaking.
Examples with apt
Okay, now let's get down to business! Here are 14 ways you can use the
apt tool to manage your packages.
1) Refreshing your cache
You may have wondered during the previous lesson how
apt-get knows where to look for Vim when we typed
apt-get install vim. The answer to this question lies in the system's cache. This is where all the software package names are linked to their location on the Debian packaging server. A list of where important packages can be obtained lies in /etc/apt/sources.list. Since the Debian package management system performs automatic updates via the links in this file, it's advisable to not add any repositories unless you're sure that it may be trusted.
To update the cache on your local system, use the
apt-get update command. This will make sure your current listing is up-to-date so you can download the latest packages.
apt-get update Ign http://security.ubuntu.com trusty-security InRelease Ign http://extras.ubuntu.com trusty InRelease ... Ign http://us.archive.ubuntu.com trusty/restricted Translation-en_US Ign http://us.archive.ubuntu.com trusty/universe Translation-en_US Reading package lists... Done
2) Upgrading current softwares
Overtime, there will be new releases of your software, fixing bugs and adding new features. On Windows, you may have had to install and update them individually (darn you annoying Java updates!). On Linux however, you can upgrade all your software in one go:
apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages have been kept back: linux-generic-lts-vivid linux-headers-generic-lts-vivid linux-image-generic-lts-vivid 0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
In the above case, there were no upgrades performed, but from time to time you may see changes. Remember that you must update your package index before running this command!
3) Installing packages
To install a package, use the
apt-get install command, followed by the package names. This will install any packages, along with its dependencies.
apt-get install vim Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: ctags vim-doc vim-scripts The following NEW packages will be installed: vim 0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded. Need to get 0 B/956 kB of archives. After this operation, 2,237 kB of additional disk space will be used. Selecting previously unselected package vim. (Reading database ... 166549 files and directories currently installed.) Preparing to unpack .../vim_2%3a7.4.052-1ubuntu3_amd64.deb ... Unpacking vim (2:7.4.052-1ubuntu3) ... Setting up vim (2:7.4.052-1ubuntu3) ... update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vim (vim) in auto mode update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/ex (ex) in auto mode
4) Removing packages
To remove any packages, use
apt-get remove. This will remove any particular package, but not its dependencies. It will also keep the configuration files, so you can revert to your normal settings in case you install the particular software again.
apt-get remove vim Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: vim 0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded. After this operation, 2,237 kB disk space will be freed. Do you want to continue? [Y/n] Y (Reading database ... 166554 files and directories currently installed.) Removing vim (2:7.4.052-1ubuntu3) ... update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/vi (vi) in auto mode update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/rview (rview) in auto mode
To remove a package along with all its dependencies and config files, use the
apt-get purge command. This is a combination of typing
apt-get remove and
5) Multiple packages
For multiple package installation and removals, separate each package name by spaces.
apt-get install vim-nox emacs24 nanoweb
6) Removing unnecessary dependencies
To remove any packages that were downloaded and are in your cache, you may remove them with the
apt-get clean command. This will free up a good amount of previously unused space.
7) Simulating installation
Sometimes you may want to simulate a run just to see what a
apt-get install command would do. In this case, you can pass in the simulate option
Instead of actually performing any actions, you'll see parameters such as Inst and Conf, indicating where the package will be installed and configured.
8) Setting all responses to yes
To set all responses to Yes, so that you don't have to type them per each confirmation prompt, use the
apt-get -y remove vim
9) Download but not install
To download but not install, use the
apt-get -d install vim
10) Suppressing output
To suppress output, use the
apt-get install -qq vim
11) Finding a package
apt-cache command is used to query the package database for information. For example, if you know the name of the package, but aren't sure of the keyword, you can search the package as a query string.
To find a package, first update your cache, the run
apt-cache search with your query.
apt-cache search convert wma
dir2ogg - audio file converter into ogg-vorbis format kid3 - KDE MP3 ID3 tag editor kid3-cli - Command line audio tag editor kid3-core - Audio tag editor core libraries and data kid3-qt - Audio tag editor nautilus-script-audio-convert - A nautilus audio converter script pacpl - multi-purpose audio converter/ripper/tagger script sorune - tool to manage the database on the Neuros Audio player
12) Viewing package details
You can easily see package details with
apt-cache show vim
Package: vim Priority: optional Section: editors Installed-Size: 2185 Maintainer: Ubuntu Developers <email@example.com> Original-Maintainer: Debian Vim Maintainers <firstname.lastname@example.org> Architecture: amd64 Version: 2:7.4.052-1ubuntu3 Provides: editor Depends: vim-common (= 2:7.4.052-1ubuntu3), vim-runtime (= 2:7.4.052-1ubuntu3), libacl1 (>= 2.2.51-8), libc6 (>= 2.15), libgpm2 (>= 1.20.4), libpython2.7 (>= 2.7), libselinux1 (>= 1.32), libtinfo5 Suggests: ctags, vim-doc, vim-scripts Filename: pool/main/v/vim/vim_7.4.052-1ubuntu3_amd64.deb Size: 955616 MD5sum: f870bba8885a240acb21977e22503c73 SHA1: 038639fda5e3a73d7f26a8e1bd20faa0282c74ff SHA256: 1c59553660fb37a9a0317ce7a906b55d580be53e4a478c55a88da4de9f9a86b9 Description-en: Vi IMproved - enhanced vi editor Vim is an almost compatible version of the UNIX editor Vi. . Many new features have been added: multi level undo, syntax highlighting, command line history, on-line help, filename completion, block operations, folding, Unicode support, etc. . This package contains a version of vim compiled with a rather standard set of features. This package does not provide a GUI version of Vim. See the other vim-* packages if you need more (or less). Description-md5: 59e8b8f7757db8b53566d5d119872de8 Homepage: http://www.vim.org/ Bugs: https://bugs.launchpad.net/ubuntu/+filebug Origin: Ubuntu Supported: 5y Task: ubuntu-usb, cloud-image, server, edubuntu-desktop-gnome, edubuntu-usb
13) View package's policies
To view the current and most recent package versions, use the
apt-cache policy command.
apt-cache policy vim
vim: Installed: 2:7.4.052-1ubuntu3 Candidate: 2:7.4.052-1ubuntu3 Version table: *** 2:7.4.052-1ubuntu3 0 500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages 100 /var/lib/dpkg/status h4 14) View package's dependencies p | To view a package's dependencies, use the code.lang-bash.single.command apt-cache showpkg | command. To view any unmet dependencies, use code.lang-bash.single.command apt-cache unmet | . pre # apt-cache showpkg vim Package: vim Versions: 2:7.4.052-1ubuntu3 (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_trusty_main_binary-amd64_Packages) (/var/lib/dpkg/status) Description Language: File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_trusty_main_binary-amd64_Packages MD5: 59e8b8f7757db8b53566d5d119872de8 Description Language: en File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_trusty_main_i18n_Translation-en MD5: 59e8b8f7757db8b53566d5d119872de8 Reverse Depends: vim-syntax-docker,vim mercurial,vim exuberant-ctags,vim byobu,vim vim:i386,vim vimhelp-de,vim 2:7.5 vimhelp-de,vim 2:7.4 vim-vimoutliner,vim vim-syntax-go,vim vim-syntax-docker,vim vim-scripts,vim vim-scripts,vim vim-rails,vim vim-migemo,vim vim-latexsuite,vim vim-latexsuite,vim vim-gocomplete,vim vim-addon-manager,vim supercollider-vim,vim ocaml-tools,vim mercurial,vim libvi-quickfix-perl,vim libtext-vimcolor-perl,vim kde-developer-sdk,vim halibut,vim gworkspace-apps-wrappers,vim edubuntu-desktop,vim debian-reference-common,vim vim-runtime,vim vim-dbg,vim 2:7.4.052-1ubuntu3 vim-common,vim exuberant-ctags,vim byobu,vim Dependencies: 2:7.4.052-1ubuntu3 - vim-common (5 2:7.4.052-1ubuntu3) vim-runtime (5 2:7.4.052-1ubuntu3) libacl1 (2 2.2.51-8) libc6 (2 2.15) libgpm2 (2 1.20.4) libpython2.7 (2 2.7) libselinux1 (2 1.32) libtinfo5 (0 (null)) ctags (0 (null)) vim-doc (0 (null)) vim-scripts (0 (null)) vim:i386 (0 (null)) Provides: 2:7.4.052-1ubuntu3 - editor Reverse Provides: vim-nox 2:7.4.052-1ubuntu3 vim-gtk 2:7.4.052-1ubuntu3 vim-athena 2:7.4.052-1ubuntu3 vim-gnome 2:7.4.052-1ubuntu3
Commands with aptitude
Want a more user-friendly interface to managing your packages? No problem! We can do most all commands performed with
apt-cache with the
aptitude interface. This uses a menu-driven, text-based application ran within the terminal, and serves as a front-end interface to the APT tool. Most commands are run with a single, lowercase letters.
To launch aptitude, simply type
aptitude. You may need to install it by typing
sudo apt-get install aptitude.
Here is a list of the most basic commands to get you started:
- arrow keys
- Preview and confirm actions
- Accept an action
- Reject an action
Updating the cache
Simply hit the u key to update the cache.
- Hover over the Not Installed Packages section.
- Move into the folder by pressing the ENTER key.
- Position your cursor over to the package you want and press the
- Package entry will turn green if successfully marked for installation.
- Press g to get a list of package actions.
- Press g again to download and install the package.
- Navigate to the installed packages category by using the keyboard arrow keys and hit ENTER.
- Highlight the desired package and press -.
- Package entry will turn pink if it has been successfully marked for removal.
- Press g to see a list of package actions, and press g again to remove the package.
- Press the U key to mark all packages with updates.
- Press g and you'll obtain a list of package actions.
- Press g again to download and install the new updated package contents.
- Press ENTER to return to the menu.
- Installed package.
- A package that is not installed, but its configuration is on system.
- Purged from system.
- Virtual package.
- Broken package, meaning you have not installed its dependencies.
- Unpacked files, but package not yet configured.
- Half-configured, configuration failed and rquires to fix.
- Half-installed, removal failed and requires fix.
To exit the interface, press q and confirm.
Using aptitude on the command line
Aptitude can also perform several command line tasks that are identical to
- Install one or more packages.
- Updates the list of available packages from apt sources.
- Conservative about removing packages or installing new ones. so it may fail.
- Less conservative. Removes and installs packages as necessary. May break software in the process.
- Searches database for packages matching specified name.
- Displays detailed information about on or more packages.
- Removes all previously downloaded .deb files from the package cache.
- Removes already downloaded packages that are no longer available.
- Removes all downloaded packages.
- Display help.
RPM Package Manager
The one other major package manager we will discuss is RPM (RPM Package Manager), which was developed by Red Hat under the General Public License. RPM is used in several distros - RedHat, Fedora, SUSE/openSUSE, and Mandriva.
Package Naming Convention
RPM files have a more stringent convention than the packages found for Debian. You may find these packages at the RPM repository or simply through the
yumdownloader command. In this lesson, we'll look at installing Ninvaders, space invaders for the command line!
Firstly, we want to install the package with the following command:
- Package Name
- The name of the package.
- Version Number
- The version number.
- Build Number
- Minor changes made not by the package author but the package maintainer. These include small tweaks in configuration files or added documentations. Here, we can also see that this was the 12th build version, made for Fedora 23.
- The package architecture. For example, i386 would signify the CPU's from 80386 onward. Here, we have the a x86_64 architecture.
The rpm command
rpm installs, verifies and queries RPM packages. Included are actions, along with options for fine-tuning. We'll look at the most well-used options, but for a more comprehensive list, check the man page.
rpm [action][options] [package]
Below are some general options you can use with the
- Print a longer usage than normal.
- Print out the version number of rpm.
- Print as little as possible.
Now here are five of the most commonly used actions with
You can verify if a package is installed with the
-q option. This will print out its name, version and release name.
rpm -q ninvaders package ninvaders is not installed
rpm -q openssh openssh-7.1p1-3.fc23.x86_64
Here, we can see that openssh is already installed, while ninvaders is not.
If you already know that a program is installed, tack on the
-i option to check its information.
rpm -qi openssh
Name : openssh Version : 7.1p1 Release : 3.fc23 Architecture: x86_64 Install Date: Thu 29 Oct 2015 02:23:32 PM PDT Group : Applications/Internet Size : 1586400 License : BSD Signature : RSA/SHA256, Fri 25 Sep 2015 06:44:55 PM PDT, Key ID 32474cf834ec9cba Source RPM : openssh-7.1p1-3.fc23.src.rpm Build Date : Fri 25 Sep 2015 05:31:51 AM PDT Build Host : buildvm-14.phx2.fedoraproject.org Relocations : (not relocatable) Packager : Fedora Project Vendor : Fedora Project URL : http://www.openssh.com/portable.html Summary : An open source implementation of SSH protocol versions 1 and 2 Description : SSH (Secure SHell) is a program for logging into and executing commands on a remote machine. SSH is intended to replace rlogin and rsh, and to provide secure encrypted communications between two untrusted hosts over an insecure network. X11 connections and arbitrary TCP/IP ports can also be forwarded over the secure channel. OpenSSH is OpenBSD's version of the last free version of SSH, bringing it up to date in terms of security and features. This package includes the core files necessary for both the OpenSSH client and server. To make this package useful, you should also install openssh-clients, openssh-server, or both.
To list all packages listed in your system, use:
... libvisio-0.1.3-2.fc23.x86_64 libsysfs-2.1.0-18.fc23.x86_64 librdmacm-18.104.22.168-4.fc23.x86_64 spice-glib-0.30-1.fc23.x86_64 sssd-client-1.13.1-2.fc23.x86_64 ...
We can also query as to what dependencies a package fulfills.
rpm -q --whatrequires openssh
openssh-clients-7.1p1-3.fc23.x86_64 openssh-askpass-7.1p1-3.fc23.x86_64 openssh-server-7.1p1-3.fc23.x86_64
To install a package, change into the directory that holds the .rpm file, then run with the
-i option. With this,
rpm will check for dependencies, conflicts, set config files, and unpack the files to place them in the right folders.
rpm -ivh ninvaders-0.1.1-12.fc23.x86_64.rpm Preparing... ################################# [100%] Updating / installing... 1:ninvaders-0.1.1-12.fc23 ################################# [100%]
-i option does the actual installing, while the
-v option is for verbosity, and
-h is to display hash marks for progression.
To specify a root folder, you may add the
--root dir option. This will specify where the root directory, which is helpful if you have more than one Linux installation.
When installing, you may run into dependency issues. To force the installation, use the
--force option. To not check for dependencies, use
Now that we've installed ninvaders, we can play it by typing
To upgrade a package to its most recent version, use the
-U option for upgrade (or install if unavailable) or
-F for freshen.
rpm -Uvh ninvaders-0.1.1-12.fc23.x86_64.rpm
To uninstall a package, specify the package name (not the .rpm) file.
rpm -e ninvaders
The RPM configuration file is located in /usr/lib/rpm/rpmrc. If you want to create your own settings, edit /etc/rpmrc or set a ~/.rpmrc file within your home folder.
Notably, this file allow you to fine-tune the compilation process, according to the CPU being used.
Just like how
dpkg doesn't provide you with the ability to install and manage package dependencies,
rpm does not either. Instead, we can use
yum, which we will discuss next.
Installing packages with dependencies yum
An easier way to install packages with their dependencies is through the
yum command. This pulls in any packages from its list of known repositories. Simply specify the package you want and it'll pull in all the necessary dependecies for you and download them.
dnf has replaced the command
yum since Fedora 22 versions. If you're using any Fedora versions before 22, you should read through this page - otherwise, skip to the next lesson.
yum command originally came from the Yellow Dog Linux distribution. It was used by distros such as Fedora, SUSE and Mandriva.
yum command comes with actions that specify a command, and options for fine-tuning. The syntax is as follows:
yum [options] [action] [package]
Here are a list of actions that are used with the yum command.
- Install package and its dependencies if any are missing.
- Check to see which packages have any updates available.
- Update the specified packages, or update all if no packages are specified. Note that it's similar to
- Delete any packages that are obsolete. Same as update with the --obsoletes flag.
- Delete the specified package from the system, including any of its dependencies.
- Displays information about a package - including version number and whether an update is available.
- Search through the repository for keywords included in the package name and description. Use this to identify the exact package name when knowing just a keyword.
- Shows information regarding a package.
- Clears out the yum cache directory.
- Updates system.
- Installs RPM files using Yum.
- Shows a list of dependencies for a specified package.
Installing a package is easy as just one step! All dependencies will be pulled in automatically.
yum install ninvaders
Yum command has been deprecated, redirecting to '/usr/bin/dnf install ninvaders'. See 'man dnf' and 'man yum2dnf' for more information. To transfer transaction metadata from yum to DNF, run: 'dnf install python-dnf-plugins-extras-migrate && dnf-2 migrate' Last metadata expiration check performed 2:10:26 ago on Mon Dec 28 12:03:27 2015. Dependencies resolved. ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: ninvaders x86_64 0.1.1-12.fc23 fedora 37 k Transaction Summary ============================================================================= Install 1 Package Total download size: 37 k Installed size: 87 k Is this ok [y/N]: y Downloading Packages: ninvaders-0.1.1-12.fc23.x86_64.rpm 35 kB/s | 37 kB 00:01 ----------------------------------------------------------------------------- Total 22 kB/s | 37 kB 00:01 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Installing : ninvaders-0.1.1-12.fc23.x86_64 1/1 Verifying : ninvaders-0.1.1-12.fc23.x86_64 1/1 Installed: ninvaders.x86_64 0.1.1-12.fc23 Complete!
If you need to just download a package (and not install it) you may use the
For a GUI front-end to
yum, consider using
yumex. You may need to install these using a
yum command from above.
yum configuration file lists where to find repositories as well as where all downloaded packages should go, along with access logs settings. The configuration file is located in /etc/yum.conf and the directory /etc/yum.repos.d.
Installing packages with dependencies dnf
DNF Does Not stand For anything. It was created to solve longstanding problems with
yum, such as dependency resolutions and interaction with online repositories. Furthermore, Yum's API is poorly documented, and after several bouts of poorly-managed refactoring, it has become difficult to keep the program slim and well-specified.
DNF has also improved on lower memory reduction and less automatic synchronization of metadata with respositories.
Here are five subcommands that you can use with
Here are some general commands about the dnf package itself.
- Check the version of DNF installed.
- List all enabled repositories on your system. Add all at the end to view disabled repositories as well.
- List all available packages on the repos and installed packages.
dnf search vim ... vim-minimal.x86_64 : A minimal version of the VIM editor ...
To get information about a package
dnf info vim
Name : vim-minimal Arch : x86_64 Epoch : 2 Version : 7.4.640 Release : 4.fc22 Size : 922 k Repo : @System Summary : A minimal version of the VIM editor URL : http://www.vim.org/ License : Vim Description : VIM (VIsual editor iMproved) is an updated and improved version of the : vi editor. Vi was the first real screen-based editor for UNIX, and is : still very popular. VIM improves on vi by adding new features: : multiple windows, multi-level undo, block highlighting and more. The : vim-minimal package includes a minimal version of VIM, which is : installed into /bin/vi for use when only the root partition is : present. NOTE: The online help is only available when the vim-common : package is installed. Available Packages Name : vim-minimal Arch : x86_64 Epoch : 2 Version : 7.4.827 Release : 1.fc22 Size : 465 k Repo : updates Summary : A minimal version of the VIM editor URL : http://www.vim.org/ License : Vim Description : VIM (VIsual editor iMproved) is an updated and improved version of the : vi editor. Vi was the first real screen-based editor for UNIX, and is : still very popular. VIM improves on vi by adding new features: : multiple windows, multi-level undo, block highlighting and more. The : vim-minimal package includes a minimal version of VIM, which is : installed into /bin/vi for use when only the root partition is : present. NOTE: The online help is only available when the vim-common : package is installed.
Instaling is similar to how it was done in yum.
sudo dnf install vim-minimal
In dfn, upgrading and updating mean the same thing.
# Update just vim-minimal
dnf update vim-minimal # Update all installed software
Converting between package formats alien
There are times you need to convert among tarbells, .rpm, and .deb. Not all software and packages are available on both platforms, so this is not uncommon. The command line tool that gets this done is the alien.
The alien program requires that you have both RPM and Debian package manager to convert between formats. Thus, install both using the appropriate
apt-get install alien
yum install alien
The syntax for
alien is as follows:
$ alien [options] file[...]
Here are some of the commonly used options with
- Convert the specified package to Debian. This option is the default.
- Convert to RPM.
- Convert for Stampede Linux.
- Convert to a Slackware tgz package.
- Installs the converted package, then removes it.
- Keep the version number of the generated package.
- Verbose mode: display each command.
Converting rpm to deb and vice versa
As mentioned above, converting to .deb files is the default option.
# Converting to .deb
alien packagename.rpm # Converting to rpm
alien -r packagename.deb