From 11e1f5fb87bbc0ccdf4d29a9fd495a578679a369 Mon Sep 17 00:00:00 2001
From: Holger Dengler <dengler@linutronix.de>
Date: Fri, 11 Jan 2019 10:31:31 +0100
Subject: packaging: move to new apt tooling

Debian introduced a main apt command with several subcommands. Its
going to replace the apt-* series as the main interface, so we should
mention it here.

Signed-off-by: Holger Dengler <dengler@linutronix.de>
---
 .../package-management/pres_packaging_en.tex       | 93 +++++++++++++++-------
 1 file changed, 66 insertions(+), 27 deletions(-)

(limited to 'linux-basics/package-management/pres_packaging_en.tex')

diff --git a/linux-basics/package-management/pres_packaging_en.tex b/linux-basics/package-management/pres_packaging_en.tex
index ad5e37e..cf4be91 100644
--- a/linux-basics/package-management/pres_packaging_en.tex
+++ b/linux-basics/package-management/pres_packaging_en.tex
@@ -59,7 +59,7 @@ dpkg -S /bin/df
 # which will be installed
 # with a package
 dpkg -L coreutils
-# Get sone informations about an archive
+# Get some information about an archive
 dpkg -I packagename.deb
 # Reconfigure a package
 dpkg-reconfigure packagename
@@ -72,10 +72,19 @@ dpkg-reconfigure packagename
 \begin{itemize}
 \item DPKG is the mechanism to install the package itself. APT will keep track of
 the dependencies and so on...
-\item Consists of several tools:
-\item apt-get
-\item apt-cache
-\item ...
+\item The \textbf{apt} command has several sub-commands:
+ \begin{itemize}
+ \item search - search in package descriptions
+ \item install/remove - install/remove packages
+ \item update - update list of available packages
+ \item upgrade - upgrade the system by installing/upgrading packages
+ \end{itemize}
+\item old-style: various apt-commands
+ \begin{itemize}
+ \item apt-cache update
+ \item apt-get upgrade
+ \item apt-get install ...
+ \end{itemize}
 \end{itemize}
 \end{frame}
 
@@ -87,9 +96,9 @@ Repository list is kept in:
 \end{verbatim}
 The repository list looks like:
 \begin{verbatim}
-deb http://debian.tu-bs.de/debian lenny \
+deb http://debian.tu-bs.de/debian stretch \
       main contrib non-free
-deb-src http://debian.tu-bs.de/debian lenny \
+deb-src http://debian.tu-bs.de/debian stretch \
       main contrib non-free
 [...]
 \end{verbatim}
@@ -106,47 +115,58 @@ There are several frontends for APT. The most important ones are:
 \end{frame}
 
 \begin{frame}[fragile]
-\frametitle{apt-get}
+\frametitle{Update and Upgrade}
 \begin{verbatim}
 # Update the package list
-apt-get update
+apt update
+
 # Upgrade all packages on your system
-apt-get upgrade
+apt upgrade
+
 # Upgrade packages on your system AND
 # and resolves any new dependencies
-apt-get dist-upgrade
+apt dist-upgrade
 \end{verbatim}
 \end{frame}
 
 \begin{frame}[fragile]
-\frametitle{apt-get}
+\frametitle{Install and Remove}
 \begin{verbatim}
 # Install a package
-apt-get install packagename
+apt install <packagename>
+
 # Remove a package
-apt-get remove packagename
+apt remove <packagename>
+
+# Remove auto-installed packages, which are
+# no longer required by other packages.
+apt autoremove
+
 # Remove a package
 # including its configuration files
-apt-get --purge remove packagename
+apt purge <packagename>
+
 # Clean the local apt cache
-apt-get clean
+apt clean
 \end{verbatim}
 \end{frame}
 
 \begin{frame}[fragile]
-\frametitle{apt-cache}
+\frametitle{Search and Dependencies}
 \begin{verbatim}
 # Looking for a package
-apt-cache search minicom
+apt search minicom
+
 # Show dependencies
-apt-cache depends minicom
+apt depends minicom
+
 # Show a user readable record
-apt-cache show minicom
+apt show minicom
 \end{verbatim}
 \end{frame}
 
 \begin{frame}[fragile]
-\frametitle{apt-get behind a proxy}
+\frametitle{apt behind a proxy}
 /etc/apt/apt.conf.d/02proxy:
 \begin{verbatim}
 Acquire::http::Proxy "http://proxy:8080";
@@ -166,23 +186,42 @@ Acquire::http::Proxy \
 \begin{frame}[fragile]
 \frametitle{aptitude}
 Aptitude has an \textbf{advanced dependency handling} and a graphical front-end. The
-syntax is quite similar to apt-get and apt-cache:
+syntax is quite similar to apt:
 \begin{verbatim}
-# apt-get install minicom
+# alternative to: apt install minicom
 aptitude install minicom
-# apt-cache search minicom
+
+# alternative to: apt search minicom
 aptitude search minicom
 \end{verbatim}
 \end{frame}
 
 \begin{frame}[fragile]
-\frametitle{apt-get vs. aptitude ;-)}
-apt-get has super cow powers; aptitude does not!! ;-)
+\frametitle{apt vs. aptitude (I)}
+aptitude supports extended search patterns
+\begin{verbatim}
+# search only in installed packages (long and short version)
+$ aptitude search "?installed(linux-image)"
+$ aptitude search ~ilinux-image
+i A linux-image-4.19.0-1-amd64  - Linux 4.19 for 64-bit PCs
+i   linux-image-amd64           - Linux for 64-bit PCs
+
+# search packages, which are no longer present in repository
+aptitude search "?obsolete(openjdk)"
+aptitude search ~oopenjdk
+i A openjdk-10-jre              - OpenJDK Java runtime, ...
+i A openjdk-10-jre-headless     - OpenJDK Java runtime, ...
+\end{verbatim}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{apt vs. aptitude (II)}
+apt has super cow powers, aptitude does not!! ;-)
 \begin{verbatim}
 $ aptitude moo
 There are no Easter Eggs in this program.
 
-$ apt-get moo
+$ apt moo
          (__) 
          (oo) 
    /------\/ 
-- 
cgit v1.2.3

