about package.deb & apt
Apt is a mainly-online-repository-based (“AppStore”) software installation & package management system used by Debian, Ubuntu and Mint (and other apt based distributions).
But – it is possible to manually download a package.deb and install it with: (WARNING! just as with Apps downloaded from random websites, this could mean security problems! (MALWARE))
dpkg -i package.deb
What might be confusing, there are multiple commands to deal with repositories & package.deb
- dpkg (dpkg manpage)
- basically dpkg = rpm the low-level package-install-utility. (both can NOT resolve dependencies)
- apt (apt manpage)
- apt is better and aptitude is best at resolving dependencies.
- aptitude (aptitude manpage)
- if there are conflicts, aptitude will let the user choose what constellation the user prefers
commands:
su - root; # become root (only root is allowed to install/update/remove packages) apt update; # get new list of all available packages apt list --installed; # list all installed packages dpkg -l; # list all installed packages apt search pattern; # search for a package by string in all package descriptions apt show packagename; # show info on a package apt install package; # install that package apt remove package; # remove that package apt --purge remove package; # remove that package and it's config files apt -f install; # the magic command that magically fixes (almost) all problems :) apt upgrade; # update-upgrade all installed packages to their latest versions apt-mark hold packagename; # do not update-upgrade this package
Where?
per default packages are downloaded to this folder:
ll /var/cache/apt/archives/|less find / -name *.deb; # start to find where downloaded packages.deb are
/etc/sources.list
Debian11
example version:
vim /etc/apt/sources.list
deb https://ftp.halifax.rwth-aachen.de/debian/ bullseye main non-free contrib
deb-src https://ftp.halifax.rwth-aachen.de/debian/ bullseye main non-free contrib
deb https://security.debian.org/debian-security bullseye-security main contrib non-free
deb-src https://security.debian.org/debian-security bullseye-security main contrib non-free
# bullseye-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
deb https://ftp.halifax.rwth-aachen.de/debian/ bullseye-updates main contrib non-free
deb-src https://ftp.halifax.rwth-aachen.de/debian/ bullseye-updates main contrib non-free
deb https://ftp.halifax.rwth-aachen.de/debian/ bullseye main non-free contrib
deb-src https://ftp.halifax.rwth-aachen.de/debian/ bullseye main non-free contrib
deb https://ftp.halifax.rwth-aachen.de/debian/ bullseye-updates main contrib non-free
deb-src https://ftp.halifax.rwth-aachen.de/debian/ bullseye-updates main contrib non-free
deb https://deb.debian.org/debian/ bullseye main contrib non-free
deb https://security.debian.org/debian-security bullseye-security main contrib
deb https://security.debian.org/debian-security bullseye-security main contrib non-free
deb-src https://security.debian.org/debian-security bullseye-security main contrib non-free
deb https://deb.debian.org/debian/ bullseye-updates main contrib non-free
deb https://deb.debian.org/debian/ bullseye-backports main contrib non-free
deb https://ftp.halifax.rwth-aachen.de/debian/ bullseye main contrib
deb-src https://ftp.halifax.rwth-aachen.de/debian/ bullseye main contrib
deb https://ftp.halifax.rwth-aachen.de/debian/ bullseye-updates main contrib
deb-src https://ftp.halifax.rwth-aachen.de/debian/ bullseye-updates main contrib
deb https://deb.debian.org/debian/ bullseye main contrib
deb https://security.debian.org/debian-security bullseye-security main contrib
deb https://security.debian.org/debian-security bullseye-security main contrib
deb-src https://security.debian.org/debian-security bullseye-security main contrib
deb https://deb.debian.org/debian/ bullseye-updates main contrib
deb https://deb.debian.org/debian/ bullseye-backports main contrib
Debian8
contains a list with all available sources of software – may it be a CD or an online-repository.
depending on what you want to install – you will have to modify this file until it works. 😀
cat /etc/apt/sources.list # deb cdrom:[Debian GNU/Linux 8.7.1 _Jessie_ - Official i386 NETINST Binary-1 20170116-10:07]/ jessie main # deb cdrom:[Debian GNU/Linux 8.7.1 _Jessie_ - Official i386 NETINST Binary-1 20170116-10:07]/ jessie main deb http://ftp.uni-erlangen.de/debian/ jessie main deb-src http://ftp.uni-erlangen.de/debian/ jessie main deb http://security.debian.org/ jessie/updates main deb-src http://security.debian.org/ jessie/updates main # jessie-updates, previously known as 'volatile' deb http://ftp.uni-erlangen.de/debian/ jessie-updates main deb-src http://ftp.uni-erlangen.de/debian/ jessie-updates main
dpkg
# install a manually downloaded package
dpkg -i package.deb
# list all installed packages
dpkg -l
dpkg -l|grep packageName; # check if this package in what version is installed
dpkg -p bsdgames; # give details about that package dpkg -L nsnake; # what files and folders belong to this package/came with that package /. /usr /usr/games /usr/games/nsnake /usr/share /usr/share/games /usr/share/games/nsnake ... dpkg-reconfigure tzdata; # reconfigure / re-setup that package, in this case you can change the time-zone
apt
older debian used “apt-get”
newer debian it was renamed to just “apt”
apt-get; # older name of the command apt; # newer name of the command (does the same) apt -f install; # the most important command, magically fix all problems :) apt update; # "what's new?" update list of available packages and versions apt upgrade; # actually downloads the packages and performs the updates
upgrade is used to install the newest versions of all packages
currently installed on the system from the sources enumerated in
/etc/apt/sources.list. Packages currently installed with new
versions available are retrieved and upgraded; under no
circumstances are currently installed packages removed, or packages
not already installed retrieved and installed. New versions of
currently installed packages that cannot be upgraded without
changing the install status of another package will be left at
their current version. An update must be performed first so that
apt-get knows that new versions of packages are available.
# WARNING! THIS IS VERY VERY DANGEROUS AND MIGHT FAIL COMPLETELY # OR RENDER USER'S SYSTEM UNUSABLE! # when a new distro version is released (Debian 11) # preferred way would be a complete RE-INSTALL! (user has been warned) apt dist-upgrade; # tries to upgrade to newer Distribution version (very old debian -> old debian)
dist-upgrade in addition to performing the function of upgrade,
also intelligently handles changing dependencies with new versions
of packages; apt-get has a “smart” conflict resolution system, and
it will attempt to upgrade the most important packages at the
expense of less important ones if necessary. So, dist-upgrade
command may remove some packages. The /etc/apt/sources.list file
contains a list of locations from which to retrieve desired package
files. See also apt_preferences(5) for a mechanism for overriding
the general settings for individual packages. (src)
And with the newer
apt
tool available from 14.04 onwards:
full-upgrade
full-upgrade performs the function of upgrade but may also remove
installed packages if that is required in order to resolve a
package conflict.
# needs to be done before any update or install - updates the local apt-cache database of available packages - to know if there are updates available apt-cache search package; # search for that package apt install package; # install that package apt remove package; # uninstall but keep config files apt purge package; # uninstall but also delete config files apt autoremove; # is used to remove packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed. apt clean; # free up disk space - remove all locally downloaded *.deb files apt-cache policy bsdgames; # what version is installed and from what repository it came from bsdgames: Installed: 2.17-22 Candidate: 2.17-22 Version table: *** 2.17-22 0 500 http://ftp.uni-erlangen.de/debian/ jessie/main i386 Packages 100 /var/lib/dpkg/status apt-cache show bsdgames; # show more informations about that package Package: bsdgames Version: 2.17-22 Installed-Size: 2378 Maintainer: Debian Games Team <pkg-games-devel@lists.alioth.debian.org> Architecture: i386 Depends: libc6 (>= 2.11), libgcc1 (>= 1:4.1.1), libncurses5 (>= 5.5-5~), libstdc++6 (>= 4.1.1), libtinfo5, wamerican | wordlist Description-en: collection of classic textual unix games This is a collection of some of the text-based games and amusements that have been enjoyed for decades on unix systems. . It includes these programs: adventure, arithmetic, atc, backgammon, battlestar, bcd, boggle, caesar, canfield, countmail, cribbage, dab, go-fish, gomoku, hack, hangman, hunt, mille, monop, morse, number, pig, phantasia, pom, ppt, primes, quiz, random, rain, robots, rot13, sail, snake, tetris, trek, wargames, worm, worms, wump, wtf Description-md5: baad5e80259494938d2b2c34b0259cb7 Tag: game::adventure, game::board, game::puzzle, game::rpg, game::simulation, game::sport, game::toys, game::typing, implemented-in::c, implemented-in::shell, interface::commandline, interface::text-mode, role::program, suite::bsd, uitoolkit::ncurses, use::gameplaying Section: games Priority: optional Filename: pool/main/b/bsdgames/bsdgames_2.17-22_i386.deb Size: 930174 MD5sum: 8fd0dddf8d67197ee11bfbaadc9702ee SHA1: 565158d7ea60702fc412f93aaa2ef0d9794fafd6 SHA256: d045d6076407bacab9eade5b91ff2b828b5c2adb942a663821c11f4fb78b813c apt-cache showpkg package; # same as: apt show -a package apt-cache showpkg bsdgames Package: bsdgames Versions: 2.17-22 (/var/lib/apt/lists/ftp.uni-erlangen.de_debian_dists_jessie_main_binary-i386_Packages) (/var/lib/dpkg/status) Description Language: File: /var/lib/apt/lists/ftp.uni-erlangen.de_debian_dists_jessie_main_binary-i386_Packages MD5: baad5e80259494938d2b2c34b0259cb7 Description Language: en File: /var/lib/apt/lists/ftp.uni-erlangen.de_debian_dists_jessie_main_i18n_Translation-en MD5: baad5e80259494938d2b2c34b0259cb7 Reverse Depends: filters,bsdgames junior-math,bsdgames junior-games-text,bsdgames games-simulation,bsdgames games-rpg,bsdgames games-puzzle,bsdgames games-finest-light,bsdgames games-finest,bsdgames games-console,bsdgames games-board,bsdgames games-adventure,bsdgames Dependencies: 2.17-22 - libc6 (2 2.11) libgcc1 (2 1:4.1.1) libncurses5 (2 5.5-5~) libstdc++6 (2 4.1.1) libtinfo5 (0 (null)) wamerican (16 (null)) wordlist (0 (null)) Provides: 2.17-22 - Reverse Provides:
aptitude
if you run aptitude without any options it will start in grafical mode
if you type /search
you can search
has actually similar syntax than apt
aptitude update; # update local cache of available packages aptitude install package; # install package aptitude remove package; # remove package
use case examples:
# update / upgrade only certain single package apt update apt install --only-upgrade packagename; # update only this package
# checkout what file belongs to what package (yum can sometimes do that better (yum provides /etc/named.conf)) dpkg -S /usr/bin/lspci; # you could try this... but it does not succeed on config files. pciutils: /usr/bin/lspci apt install apt-file; apt-file update; apt-file search /usr/share/samba/setup/named.conf samba: /usr/share/samba/setup/named.conf samba: /usr/share/samba/setup/named.conf.dlz samba: /usr/share/samba/setup/named.conf.update # check if package samba is installed and what version dpkg -l |grep samba ii python-samba 2:4.2.14+dfsg-0+deb8u6 i386 Python bindings for Samba ii samba 2:4.2.14+dfsg-0+deb8u6 i386 SMB/CIFS file, print, and login server for Unix apt-file search /etc/hosts debian-lan-config: /usr/share/debian-lan-config/fai/config/files/etc/hosts/diskless debian-lan-config: /usr/share/debian-lan-config/fai/config/files/etc/hosts/mainserver fai-doc: /usr/share/doc/fai-doc/examples/etc/hosts puppet-testsuite: /usr/share/puppet-testsuite/spec/fixtures/unit/provider/augeas/augeas/etc/hosts rsh-server: /etc/hosts.equiv switchconf: /usr/share/doc/switchconf/examples/home/etc/hosts switchconf: /usr/share/doc/switchconf/examples/work/etc/hosts dpkg -l |grep debian-lan-config root@debian8:/etc# apt-cache search debian-lan-config debian-lan-config - FAI config space for the Debian-LAN system
Links:
http://lzone.de/cheat-sheet/Package%20Management
https://www.debian.org/doc/manuals/debian-faq/ch-pkgtools.en.html
liked this article?
- only together we can create a truly free world
- plz support dwaves to keep it up & running!
- (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
- really really hate advertisement
- contribute: whenever a solution was found, blog about it for others to find!
- talk about, recommend & link to this blog and articles
- thanks to all who contribute!