About:

apt is a mainly-online-repository-based („AppStore“) software installation – package management system used by Debian and Ubuntu.

But – you can also manually download a package.deb and install it with dpkg -i package.deb.

What might be confusing – it consists of three commands – dpkg – apt – aptitude.

basically dpkg = rpm the low-level package-install-utility. (both can NOT resolve dependencies)

apt is better and aptitude is best at resolving dependencies.

if there are conflicts – aptitude will let you choose what constellation you would prefer…

per default packages are downloaded to this folder:

ll /var/cache/apt/archives/|less
find / -name *.deb; # start to find downloaded packages.deb

/etc/sources.list

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

dpkg.man.txt

# install a manually downloaded package

dpkg -i package.deb

# list all installed packages

dpkg -l
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 / resetup that package, in this case you can change the time-zone

dpkg-reconfigure.man.txt

apt

apt-get.man.txt

apt-cache.man.txt

the most important command is:

apt-get -f install; # magically fix all problems

apt-get update; # update list of available packages

# 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-get install package; # install that package

apt-get remove package; # uninstall but keep config files

apt-get purge package; # uninstall but also delete config files

apt-get autoremove; #  is used to remove packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed.

apt-get 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-get update
apt-get 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-get 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

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

admin