D
DevynCJohnson
Guest
Many Linux distros are Debian-based. This group of Linux systems use the Debian installation packages (*.deb files). It helps to understand how to manage applications on such systems. Knowing the apt and dpkg software can greatly help system administrators and well as the average desktop user.
Advanced Packaging Tool (APT)
Apt is equivalent to Yum on RedHat-based systems; apt is to Debian as yum is to RedHat. Apt is commonly used to download software from repositories. Repositories are special servers that store installation packages for operating systems. For example, the command "apt-get install firefox" will download Firefox from a repository and install the software. Firefox can then be removed in one of two ways
Keep configuration files - apt-get remove firefox
Remove everything - apt-get purge firefox
NOTE: To manage software, Root privileges must be used.
The update command used by Apt refreshes the package index by downloading new index files (apt-get update). Apt is also used to download and apply updates to the local software - "apt-get upgrade". To apply updates that require other packages in the newer version, use "apt-get dist-upgrade".
When packages are being downloaded, they are stored in /var/cache/apt/archives/. Then, after all of the desired packages are in that directory, the installation process can begin one package at a time. Apt cannot install multiple packages at the exact same moment meaning that one is installed at a time. After the installation process, the *.deb files still remain in /var/cache/apt/archives/. To remove the cached Deb files that can no longer be installed on the system, execute "apt-get autoclean". To clear the cache, execute "apt-get clean".
Pinning is the act of specifying that a particular version of software be installed rather than the mainstream/newest version. This can also refer to specifying a piece of software from a non-default repository (repo). For example, an user may pin Firefox v21 to be the installed version even though Firefox v27 may be released. Or, the user may specify that only Firefox packages from repository "X" can be used. Pinning (also called apt-pinning) can easily be done in the GUI frontends (each frontend has different steps for performing a pin). Without a frontend, pinning is specified in this file - /etc/apt/preferences.
If a user wanted to compile a program, but needed all of the dependencies for building the application, then use "apt-get build-dep PROGRAM_PACKAGE_NAME" which will install the build dependencies. This will only work if the specified package is in the repositories.
One feature that makes Apt wonderful is that it can manage and find dependencies. This prevents the user from needing to manually find and install each and every dependency. The command "apt-get check" will see if any broken-dependencies exist on your system. A broken-dependency is the same as an unmet dependency, both of which mean a dependency is missing or there is a conflict among dependencies. If one occurs, there are a few ways to resolve the problem. One method is to use the command "apt-get -f install". Another way is to install the dependencies manually before installing the main software. If the issue results when many packages are being installed at once, then install a few packages at a time.
Sometimes, users may wish to configure an application an alternative way or hope to fix odd application behavior by reconfiguring the package. This is done using the "dpkg-reconfigure PACKAGE" command. To re-install a package, use this command - sudo apt-get --reinstall install PACKAGE
If users wish to clean the operating system, the libraries and other software that is no longer needed can be removed via "sudo apt-get autoremove". For illustration, assume many applications are installed along with their dependencies. Later, many of these applications are removed, but the dependencies are left on the system. No application is using this software, so these files are only wasting disk space. Removing the unneeded dependencies will free disk space and it may make the system perform better.
Various frontends exist for Apt. A frontend is software that provides an interface or an alternate platform for using a particular piece of software. Synaptic, Ubuntu Software Center, and Aptitude are some examples of popular Apt frontends.
APTonCD
APTonCD is a program that makes an ISO file containing all of the DEB files in the cache directory. This is useful when installing many applications after a fresh Linux install. Then, the user can have a copy of the installed software on a disk (if the ISO is burnt to a disk). This allows the user to install the same software off of the disk onto other Debian systems.
dpkg
Dpkg is equivalent to rpm (the command, not the file) on RedHat-based systems. To install a local Deb file, type "dpkg -i FILENAME" and to remove a package, type "dpkg -r PACKAGE".
To view the contents of a Deb file, use the "dpkg -c FILENAME" command. The output will look similar to executing "ls -l".
A Deb file can be extracted like this - dpkg -x FILE TARGET_DIR - However, this will only extract the files. For the control file, hash sum, and other metadata, try this command - dpkg -e FILE TARGET_DIR. Yes, this is the same, but with an "e" as the parameter.
wpkg
Debian-based Linux distros are not the only ones that use DEB files. wpkg is a program that allows Deb files to be installed on Windows. With wpkg, Debian files can be used on a Windows system just like on a Debian system. (http://windowspackager.org/documentation/wpkg)
NOTE: If anyone has tried this, please let us know. I do not believe that Debian software would work on Windows systems, but please feel free to prove me wrong. Do not be afraid; I will like it a lot. I mention this software in this article to inform readers of its existence.
Deb files (*.deb)
The Debian software package format is based off of the ar-archive format. The current Debian-file format version is 2.0. The Debian file contains two tar files, one containing the application and the other containing the control information (program info, description, install size, dependencies, etc.). The Deb file may use one of four compression formats - Bzip2, gzip, lzma, and XZ. However, compression is optional.
To see the actual tar files (the two mentioned above), use this command - ar -x FILE.deb - This command will also pull out a plain-text file stating the version of the Debian format. Users will see that each tar may be compressed. In addition, the tars may each use a different compression format.
Repositories (Repos)
As mentioned previously, repositories are a collection of installation packages. There are different types of repositories that offer different packages.
Stable - The current/mainstream software is found here.
Proposed - This repo contains updates that are being tested. BEWARE: the software may cause system conflicts and contain bugs.
Backports - Newer software.
Testing - Candidates for release are stored here. This software needs some more testing before being deemed stable. BEWARE: the software may cause system conflicts and contain bugs.
Unstable - Packages with known bugs are stored here. Obviously, this is dangerous software that should only be used by developers on dedicated computers. BEWARE: the software may cause system conflicts and contain bugs.
Oldstable - This software is stable. This repo is perfect for old systems where security is not a concern.
Snapshot - These repos contain old versions of software. Users needing some very old software will find this repo useful.
Experimental - The software here is highly experimental and in the early stages of development.
Non-free - Proprietary packages or software that does not pass the Debian Free Software Guidelines (DFSG) belong here.
Contrib - If a piece of software passes the DFSG, but depends on a package from "Non-free", then such a package goes here.
Within repos are further divisions called ports. For example, free stable software for SPARC processors would come from the SPARC port in "Stable". There are stable ports, unstable ports, and unofficial ports. “Stable” ports contain packages for well supported processors (i386, AMD64, MIPS, etc.). “Unstable” ports are still being developed (hurd-i386). “Unofficial” ports are unsupported except by small third-parties (ppc64, alpha, sh4, etc.).
The file that stores a list of the repositories used by the system is /etc/apt/sources.list. Lines that are commented are either comments or disabled repos. Here is a partial file -
Now, Debian-based systems should be easier to understand and manage. For those of you that want to develop or contribute software to the Debian community may find the organization of the repos helpful.
Advanced Packaging Tool (APT)
Apt is equivalent to Yum on RedHat-based systems; apt is to Debian as yum is to RedHat. Apt is commonly used to download software from repositories. Repositories are special servers that store installation packages for operating systems. For example, the command "apt-get install firefox" will download Firefox from a repository and install the software. Firefox can then be removed in one of two ways
Keep configuration files - apt-get remove firefox
Remove everything - apt-get purge firefox
NOTE: To manage software, Root privileges must be used.
The update command used by Apt refreshes the package index by downloading new index files (apt-get update). Apt is also used to download and apply updates to the local software - "apt-get upgrade". To apply updates that require other packages in the newer version, use "apt-get dist-upgrade".
When packages are being downloaded, they are stored in /var/cache/apt/archives/. Then, after all of the desired packages are in that directory, the installation process can begin one package at a time. Apt cannot install multiple packages at the exact same moment meaning that one is installed at a time. After the installation process, the *.deb files still remain in /var/cache/apt/archives/. To remove the cached Deb files that can no longer be installed on the system, execute "apt-get autoclean". To clear the cache, execute "apt-get clean".
Pinning is the act of specifying that a particular version of software be installed rather than the mainstream/newest version. This can also refer to specifying a piece of software from a non-default repository (repo). For example, an user may pin Firefox v21 to be the installed version even though Firefox v27 may be released. Or, the user may specify that only Firefox packages from repository "X" can be used. Pinning (also called apt-pinning) can easily be done in the GUI frontends (each frontend has different steps for performing a pin). Without a frontend, pinning is specified in this file - /etc/apt/preferences.
If a user wanted to compile a program, but needed all of the dependencies for building the application, then use "apt-get build-dep PROGRAM_PACKAGE_NAME" which will install the build dependencies. This will only work if the specified package is in the repositories.
One feature that makes Apt wonderful is that it can manage and find dependencies. This prevents the user from needing to manually find and install each and every dependency. The command "apt-get check" will see if any broken-dependencies exist on your system. A broken-dependency is the same as an unmet dependency, both of which mean a dependency is missing or there is a conflict among dependencies. If one occurs, there are a few ways to resolve the problem. One method is to use the command "apt-get -f install". Another way is to install the dependencies manually before installing the main software. If the issue results when many packages are being installed at once, then install a few packages at a time.
Sometimes, users may wish to configure an application an alternative way or hope to fix odd application behavior by reconfiguring the package. This is done using the "dpkg-reconfigure PACKAGE" command. To re-install a package, use this command - sudo apt-get --reinstall install PACKAGE
If users wish to clean the operating system, the libraries and other software that is no longer needed can be removed via "sudo apt-get autoremove". For illustration, assume many applications are installed along with their dependencies. Later, many of these applications are removed, but the dependencies are left on the system. No application is using this software, so these files are only wasting disk space. Removing the unneeded dependencies will free disk space and it may make the system perform better.
Various frontends exist for Apt. A frontend is software that provides an interface or an alternate platform for using a particular piece of software. Synaptic, Ubuntu Software Center, and Aptitude are some examples of popular Apt frontends.
APTonCD
APTonCD is a program that makes an ISO file containing all of the DEB files in the cache directory. This is useful when installing many applications after a fresh Linux install. Then, the user can have a copy of the installed software on a disk (if the ISO is burnt to a disk). This allows the user to install the same software off of the disk onto other Debian systems.
dpkg
Dpkg is equivalent to rpm (the command, not the file) on RedHat-based systems. To install a local Deb file, type "dpkg -i FILENAME" and to remove a package, type "dpkg -r PACKAGE".
To view the contents of a Deb file, use the "dpkg -c FILENAME" command. The output will look similar to executing "ls -l".
A Deb file can be extracted like this - dpkg -x FILE TARGET_DIR - However, this will only extract the files. For the control file, hash sum, and other metadata, try this command - dpkg -e FILE TARGET_DIR. Yes, this is the same, but with an "e" as the parameter.
wpkg
Debian-based Linux distros are not the only ones that use DEB files. wpkg is a program that allows Deb files to be installed on Windows. With wpkg, Debian files can be used on a Windows system just like on a Debian system. (http://windowspackager.org/documentation/wpkg)
NOTE: If anyone has tried this, please let us know. I do not believe that Debian software would work on Windows systems, but please feel free to prove me wrong. Do not be afraid; I will like it a lot. I mention this software in this article to inform readers of its existence.
Deb files (*.deb)
The Debian software package format is based off of the ar-archive format. The current Debian-file format version is 2.0. The Debian file contains two tar files, one containing the application and the other containing the control information (program info, description, install size, dependencies, etc.). The Deb file may use one of four compression formats - Bzip2, gzip, lzma, and XZ. However, compression is optional.
To see the actual tar files (the two mentioned above), use this command - ar -x FILE.deb - This command will also pull out a plain-text file stating the version of the Debian format. Users will see that each tar may be compressed. In addition, the tars may each use a different compression format.
Repositories (Repos)
As mentioned previously, repositories are a collection of installation packages. There are different types of repositories that offer different packages.
Stable - The current/mainstream software is found here.
Proposed - This repo contains updates that are being tested. BEWARE: the software may cause system conflicts and contain bugs.
Backports - Newer software.
Testing - Candidates for release are stored here. This software needs some more testing before being deemed stable. BEWARE: the software may cause system conflicts and contain bugs.
Unstable - Packages with known bugs are stored here. Obviously, this is dangerous software that should only be used by developers on dedicated computers. BEWARE: the software may cause system conflicts and contain bugs.
Oldstable - This software is stable. This repo is perfect for old systems where security is not a concern.
Snapshot - These repos contain old versions of software. Users needing some very old software will find this repo useful.
Experimental - The software here is highly experimental and in the early stages of development.
Non-free - Proprietary packages or software that does not pass the Debian Free Software Guidelines (DFSG) belong here.
Contrib - If a piece of software passes the DFSG, but depends on a package from "Non-free", then such a package goes here.
Within repos are further divisions called ports. For example, free stable software for SPARC processors would come from the SPARC port in "Stable". There are stable ports, unstable ports, and unofficial ports. “Stable” ports contain packages for well supported processors (i386, AMD64, MIPS, etc.). “Unstable” ports are still being developed (hurd-i386). “Unofficial” ports are unsupported except by small third-parties (ppc64, alpha, sh4, etc.).
The file that stores a list of the repositories used by the system is /etc/apt/sources.list. Lines that are commented are either comments or disabled repos. Here is a partial file -
Code:
# deb cdrom:[Ubuntu 13.10 _Saucy Salamander_ - Release amd64 (20131016.1)]/ saucy main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ saucy main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ saucy main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ saucy-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ saucy-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ saucy universe
deb-src http://us.archive.ubuntu.com/ubuntu/ saucy universe
deb http://us.archive.ubuntu.com/ubuntu/ saucy-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ saucy-updates universe
Now, Debian-based systems should be easier to understand and manage. For those of you that want to develop or contribute software to the Debian community may find the organization of the repos helpful.
Attachments
Last edited: