Published Book on Amazon
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1 | |
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2 |
출판된 한글판 도서
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상) | |
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하) |
Original Book Contents
17.2.3 Package Management Tool - APT
17.2.3.1 Overview of APT Tool
The APT (Advanced Package Tool) is an advanced interface to the Debian packaging system, which provides "apt-get" program. The tool supports a sequential installation task completely, can process data from multiple sources, and in addition, provides many other distinguishing features. In Debian, you can use this APT-based package management tool to handle package management tasks using the repository.
APT management tools are mid-level tool, the most basic APT-based package management tools, is designed to use "dpkg" command internally, and provide command line user interface only.
The APT management tool includes the following commands:
■ apt-get -- Install, uninstall, and upgrade package.
■ apt-cache -- Used to query useful information about a package.
■ apt-cdrom -- Allows you to use removable media as a source for packages
■ apt-config -- Provides an interface to configuration settings.
■ apt-key -- Is a manager for authentication key management.
17.2.3.2 "apt-get" Command
The "apt-get" command provides a simple way to query and install packages in multiple sources using the command line. Unlike "dpkg", this does not understand "apt-get .deb" files. "apt-get" only works with the proper name of the package, and only ".deb" archives from the source specified in "/etc/apt/sources.list" file can be installed. The "apt-get" command calls "dpkg" command immediately after downloading the ".deb" archives at the specified source.
The "apt-get" command is best suited for major system upgrade between major releases, is a tool to reliably resolve package dependencies, and uses less hardware resources
[Command Format]
apt-get [options] command <package> |
[Command Overview]
■ This is a tool to search and install package of system easily and conveniently.
■ User privilege -- Super user.
[Detail Description]
■ This command perform the task such as newly installing or uninstalling program.
[Main Command]
update | Retrieve new lists of packages |
upgrade | Perform an upgrade |
install | Install new packages (pkg is libc6 not libc6.deb) |
remove | Remove packages |
autoremove | Remove automatically all unused packages |
purge | Remove packages and config files |
source | Download source archives |
build-dep | Configure build-dependencies for source packages |
dist-upgrade | Distribution upgrade, see apt-get(8) |
dselect-upgrade | Follow dselect selections |
clean | Erase downloaded archive files |
autoclean | Erase old downloaded archive files |
check | Verify that there are no broken dependencies |
changelog | Download and display the changelog for the given package |
download | Download the binary package into the current directory |
[Main Option]
-d, --download-only
| Download only; package files are only retrieved, not unpacked or installed. Configuration Item: APT::Get::Download-Only. |
--reinstall
| Re-install packages that are already installed and at the newest version. Configuration Item: APT::Get::ReInstall. |
--auto-remove
| If the command is either install or remove, then this option acts like running the autoremove command, removing unused dependency packages. Configuration Item: APT::Get::AutomaticRemove. |
--no-download
| Disables downloading of packages. This is best used with --ignore-missing to force APT to use only the .debs it has already downloaded. Configuration Item: APT::Get::Download. |
--reinstall
| Re-install packages that are already installed and at the newest version. Configuration Item: APT::Get::ReInstall. |
-s, --simulate, --just-print, --dry-run, --recon, --no-act | No action; perform a simulation of events that would occur but do not actually change the system. Configuration Item: APT::Get::Simulate. |
-y, --yes, --assume-yes
| Automatic yes to prompts; assume "yes" as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package, trying to install a unauthenticated package or removing an essential package occurs then apt-get will abort. Configuration Item: APT::Get::Assume-Yes. |
--assume-no | Automatic "no" to all prompts. Configuration Item: APT::Get::Assume-No. |
17.2.3.3 "apt-cache" Command
The "apt-cache" command is a tool that can be used to query various informations about package. It provides a standard search method for package name and description. It allows you to search the package lists, find a package that provides a specific function by using simple text or regular expression, or find the desired package by searching the dependencies of packages.
[Command Format]
apt-cache [options] command <package> |
[Command Overview]
■ This is a tool that can inquire various informations about package easily and conveniently.
■ User privilege -- Super user.
[Detail Description]
■ None
[Main Command]
search word | find packages whose description contain word |
show package | print the detailed information of a package |
depends package | print the packages a given package depends on |
showpkg package | print detailed information of the versions available for a package and the packages that reverse-depends on it |
showsrc pkg...
| showsrc displays all the source package records that match the given package names. All versions are shown, as well as all records that declare the name to be a binary package. |
pkgnames [prefix]
| This command prints the name of each package APT knows. The optional argument is a prefix match to filter the name list. The output is suitable for use in a shell tab complete function and the output is generated extremely quickly. This command is best used with the --generate option. |
[Main Option]
-i, --important | Print only important dependencies; for use with unmet and depends. Causes only Depends and Pre-Depends relations to be printed. Configuration Item: APT::Cache::Important. |
--installed | Limit the output of depends and rdepends to packages which are currently installed. Configuration Item: APT::Cache::Installed. |
--names-only, -n | Only search on the package names, not the long descriptions. Configuration Item: APT::Cache::NamesOnly. |
[Used Example]
The following is an example of inquiring the contents about the "xrdp" package used for Microsoft Windows remote desktop access. You can see that various informations about the package are displayed.
pi@raspberrypi ~ $ apt-cache show xrdp |
Version: 0.6.1-2 Architecture: armhf Maintainer: Vincent Bernat <bernat@debian.org> Installed-Size: 1449 Depends: libc6 (>= 2.15), libpam0g (>= 0.99.7.1), libssl1.0.0 (>= 1.0.0), libx11-6, libxfixes3, adduser Recommends: vnc4server | tightvncserver | vnc-server Homepage: http://xrdp.sourceforge.net Priority: optional Section: net Filename: pool/main/x/xrdp/xrdp_0.6.1-2_armhf.deb Size: 195340 SHA256: ee9faa30e8382f220ced3c4b00480281e14f088f7b64c02ca211e6780ffc669d SHA1: 55af41486deb72a8b3484caf5496cc67b75da4b7 MD5sum: bbae86c2f2cf8054b58629921fd10cdd Description: Remote Desktop Protocol (RDP) server Based on research work by the rdesktop project, xrdp uses the Remote Desktop Protocol to present a graphical login to a remote client. xrdp can connect to a VNC server or another RDP server. . Microsoft Windows users can connect to a system running xrdp without installing additional software. Description-md5: b98c1889e17be6136503794b3491891b |