Linux Format

Sysadmin training

Get a taste of the Linux Foundation’s System Administra­tion course, as Jonni Bidwell brushes up on how to manage software the Linux way

-

The Linux Foundation’ s Essentials of Linux System Administra­tion co ur se,LFS201,isfu ll of knowledge. It consists of 42 chapters, with short knowledge tests and longer lab assignment­s. In this taster we introduce the topic of package management systems (chapter 27) before skipping to a primer on Debian’s APT (chapter 32).

It’s necessary to introduce order into the way software is installed, updated and removed on Linux systems. Package management systems provide a clean way to achieve that goal and can prevent systems from descending into chaos, fossilisat­ion or breakage with time. Furthermor­e, they provide a method to verify that the software on the system hasn’t been corrupted, either maliciousl­y or by accident. An essential function of Linux distributo­rs is to develop and maintain the packages, and to ensure that dependenci­es are properly maintained over time.

Package management systems supply the tools that enable system administra­tors to automate installing, upgrading, configurin­g and removing software packages in a known, predictabl­e and consistent manner. These systems achieve the following:

Gather and compress associated software files into a single package (archive), which may require one or more other packages to be installed first; Allow for easy software installati­on or removal; Can verify file integrity via an internal database; Can authentica­te the origin of packages; Facilitate upgrades; Group packages by logical features; and Manage dependenci­es between packages.

A given package may contain executable files, data files, documentat­ion, installati­on scripts and configurat­ion files. Also included are metadata attributes such as version numbers, checksums, vendor informatio­n, dependenci­es, descriptio­ns and so on. Upon installati­on, all that informatio­n is stored locally in an internal database that can be queried for version status and update informatio­n.

Software package management systems are widely seen as one of the biggest advancemen­ts Linux brought to enterprise IT environmen­ts. By keeping track of files and metadata in an automated, predictabl­e and reliable way, system administra­tors can use package management­s systems to make their installati­on processes scale to thousands of systems without requiring manual work on each individual system. Features include: Automation – no need for manual installs and upgrades; Scalabilit­y – install packages on one or 10,000 systems; Repeatabil­ity and predictabi­lity; and Security and auditing;

Packages come in several different types: Binary packages contain files ready for deployment, including executable files and libraries. These are architectu­re dependent and must be compiled for each type of machine.

Source packages are used to generate binary packages. One should always be able to rebuild a binary package (for example, by using rpmbuild --rebuild on RPM-based systems) from the source package. One source package can be used for multiple architectu­res.

Architectu­re-independen­t packages contain files and scripts that run under script interprete­rs, as well as documentat­ion and configurat­ion files.

Meta-packages are groups of associated packages that collect everything needed to install a relatively large subsystem, such as a desktop environmen­t or an office suite.

Binary packages are the ones that system administra­tors have to deal with most of the time.

Double the fun

On 64-bit systems that can run 32-bit programs, one may have two binary packages installed for a given program, perhaps one with x86_64 or amd64 in its name, and the other with i386 or i686 in its name. Source packages can be helpful in keeping track of changes and source code used to come up with binary packages. They’re usually not installed on a system by default, but can be retrieved from the vendor.

There are two levels to packaging systems: Low-level utility – this simply installs or removes a single

package or a list of packages, each one of which is individual­ly and specifical­ly named. Dependenci­es aren’t fully handled, only warned about. So if another package needs to be installed first the installati­on will fail, and if the package is needed by another package, its removal will fail. The rpm and dpkg utilities play this role for the packaging systems that use them.

High-level utility – this solves the dependency problems. If another package or group of packages needs to be installed before software can be installed, such needs will be satisfied. If removing a package interferes with another installed package, the administra­tor will be given the choice of either aborting, or removing all affected software.

The yum , dnf and zypper utilities take care of the dependency resolution for rpm systems, and apt-get ,

apt-cache and other utilities take care of it for dpkg systems.

How terribly APT

For use on Debian-based systems, the APT (advanced packaging tool) set of programs provides a higher level of intelligen­t services for using the underlying dpkg program, and plays the same role as yum on Red Hat-based systems. The main utilities are apt-get and apt-cache . It can automatica­lly resolve dependenci­es when installing, updating and removing packages. It accesses external software repositori­es, synchronis­ing with them and retrieving and installing software as needed.

Queries are done using the apt-cache utility. To search the repository for a package named apache2 , use: $ apt-cache search apache2

To display basic informatio­n about the apache2 package, carry out the following: $ apt-cache show apache2

To display more detailed informatio­n about the apache2 package, type: $ apt-cache showpkg apache2

To list all dependent packages for apache2 : $ apt-cache depends apache2

Search the repository for a file named apache2.conf: $ apt-file search apache2.conf

List all the files in the apache2 package: $ apt-file list apache2

The apt-get program is the workhorse of installing, removing and upgrading packages.

The indices of available packages are fetched from the location(s) specified in /etc/apt/sources.list. To synchronis­e the package index files with their repository sources, use the following instructio­n: $ sudo apt-get update

If you want to install new packages or update an already installed package, type: $ sudo apt-get install [package] Remove a package from the system without removing its configurat­ion files: $ sudo apt-get remove [package] Remove a package from the system and its configurat­ion files as well: $ sudo apt-get --purge remove [package] Apply all available updates to packages already installed: $ sudo apt-get upgrade

Carry out a smart upgrade that will do a more thorough dependency resolution and remove some obsolete packages and install new dependenci­es. This will not, as is commonly misunderst­ood, update to a new version of the Linux distro: $ sudo apt-get dist-upgrade

Note that you must update before you upgrade, unlike with yum (or dnf ), where the update argument does both steps, updating the repositori­es and then upgrading the packages. This can be confusing to habitual yum users on Debian-based systems.

To get rid of any packages no longer required, such as older Linux kernel versions: $ sudo apt-get autoremove

Clean out cache files and any archived package files that have been installed: $ sudo apt-get clean This can save a lot of space.

There’s much more (around 40 chapters in fact) to this course and anyone wishing to brush up their skills, possibly with a view to securing a sysadmin job, would be well-advised to invest in it.

 ??  ?? As with all Linux commands, help for apt-get is only a few characters away.
As with all Linux commands, help for apt-get is only a few characters away.
 ??  ??
 ??  ?? The Apache webserver has many reverse dependenci­es. Apt-get lists them all, not just those that are installed.
The Apache webserver has many reverse dependenci­es. Apt-get lists them all, not just those that are installed.

Newspapers in English

Newspapers from Australia