CHAPTER 6. Installing Applications
Exam objectives in this chapter
■ Installing, Removing, and Updating Programs
■ Adding and Removing Repositories

Introduction

Once Linux is installed and configured, as an administrator most of your time will be spent installing, configuring, supporting, and removing applications. This chapter will walk you through these processes using a variety of methods and tools, with the two most prevalent tools for managing application packages are Advanced Packaging Tool (APT) and Red Hat Package Manager (RPM). When you need to install applications that are not packaged, you will need to resort to compiling and installing from the source code.

Installing, Removing, and Updating Programs

Within the Linux system, there are a number of ways to install programs or packages, as they are commonly known within Linux. A package can be considered to be a group of files that are bundled together into one archive file, and the package format you will need depends entirely on the Linux distribution you are running. Whichever package type you need to install, each will usually have one or more associated libraries or support packages that have to be installed with it to make it work. These additional packages are called dependencies, as the main program is dependent on these to work. If you already have these dependencies installed, then you do not have to reinstall them.
In principal, there are two types of packages: binary packages and source packages. The source packages need to be compiled and built for your system, whereas the binary packages have already been compiled for a specific installation. The utilities that distribute and manage the binaries for a particular distribution are called package managers. Table 6.1 shows the most common ones.
Table 6.1. Main Linux Package Formats

.rpmRPM Package Manager is used by Red Hat, openSUSE, Mandriva Linux, Mandrake, and many more.
.debDebian package is used by Debian and Ubuntu, Knoppix.
tgz or tar.gztar and gzip package is used by Slackware.
The packages can be found individually on various Web sites or on installation disk but also in software repositories, which are locations where the software packages can be found and downloaded. These repositories can vary from having a small number of packages (even one) on them or with a whole operating system on them.

Crunch Time
You need to know and understand the following for the exam:
■ Packages contain a group of (usually) related program files.
■ Packages often have associated library files in them.
■ Packages can be binary or source files.
■ Dependencies are other packages a program needs installed.
■ Software repositories are locations where packages are located.

RPM

RPM stands for RPM Package Manager and is a feature of Red Hat Linux and similar distributions. The basic rpm file is a precompiled binary package bundled with a script file, which can be used to build, install, remove, modify, and verify the software archives. The rpm packages contain a complete archive of the files, along with a host of other information on the package, such as name, version, and checksums. In addition, there can be scripts included to install, upgrade, or remove the software, along with preinstallation and postinstallation scripts where necessary.
The RPM system uses a database to hold and track all this information, including the version of all the software that is installed. This basic information is held in the /var/lib/rpm directory, and a sample listing of this directory is shown below:
$ ls -l
total 46184
-rw-r--r-- 1 root root2994176 2009-06-23 12:29 Basenames
-rw-r--r-- 1 root root12288 2009-06-23 12:29 Conflictname
-rw-r--r-- 1 root root 0 2009-06-23 12:13 __db.000
-rw-r--r-- 1 root root 24576 2009-06-23 12:31 __db.001
-rw-r--r-- 1 root root 180224 2009-06-23 12:31 __db.002
-rw-r--r-- 1 root root 1318912 2009-06-23 12:31 __db.003
-rw-r--r-- 1 root root 352256 2009-06-23 12:31 __db.004
-rw-r--r-- 1 root root 1507328 2009-06-23 12:29 Dirnames
-rw-r--r-- 1 root root 5300224 2009-06-23 12:29 Filedigests
-rw-r--r-- 1 root root 32768 2009-06-23 12:29 Group
-rw-r--r-- 1 root root 24576 2009-06-23 12:29 Installtid
-rw-r--r-- 1 root root 45056 2009-06-23 12:29 Name
-rw-r--r-- 1 root root 35545088 2009-06-23 12:29 Packages
-rw-r--r-- 1 root root 331776 2009-06-23 12:29 Providename
-rw-r--r-- 1 root root 118784 2009-06-23 12:29 Provideversion
-rw-r--r-- 1 root root 12288 2008-11-19 14:17 Pubkeys
-rw-r--r-- 1 root root 503808 2009-06-23 12:29 Requirename
-rw-r--r-- 1 root root 270336 2009-06-23 12:29 Requireversion
-rw-r--r-- 1 root root 163840 2009-06-23 12:29 Sha1header
-rw-r--r-- 1 root root 86016 2009-06-23 12:29 Sigmd5
-rw-r--r-- 1 root root 12288 2009-06-23 12:29 Triggername
The /var/lib/rpm/packages file is the primary database of all the installed software in the system and will grow depending on the number of packages you install. A file of 40 MB or larger is not an unusual size for a fully loaded system. This directory is used by RPM to manage all the software and versions.
The rpm package names are in a standard format and contain
■ Package software name
■ Version of the software
■ Release number of the package
■ Architecture the package was built for (for example, i386, i686).
The actual format will be as below:
<package_name>-<version>-<release>.<arch>.rpm
As an example, the rpm for a Telnet package file, with a version of 0.17 and a release of 23 built for the i386 platform, would look like telnetd-0.17-23 .i386.rpm.

Command-Line Tools

Both the graphical user interface (GUI) and the command-line interface are similar in one respect – they need to be executed by the superuser account. The basic format of the rpm command is
rpm option package_name

Fast Facts
The basic options used with the rpm command are shown below, and any system administrator needs to learn these:
-i installs the package.
-e removes (erases) the package.
-U removes the installed package first and then installs the new version.
-V verifies the installation of the package.
-q queries the package.
Each of these can be combined with a number of other options to make the rpm command very powerful.

Package Installation

Packages are installed using the –i option. A simple install of the Telnet package specified above would therefore be
rpm –i telnetd-0.17-23.i386.rpm
There are number of useful options that are often combined with the install option, as well as with the other options, namely -v and -h. The -v option is for verbose and will give some useful feedback during the process. The -h option will print a series of hash marks on the screen as the work proceeds, with the sole purpose of keeping you aware that something is still happening.

Package Updating

Packages already installed on system can be upgraded to a later release using the –U option. This option will remove the old version, keeping any modified files such as the configuration files. It will then install the new version. To upgrade the Telnet package above to version 18, release 5, the command to use is
rpm –U telnetd-0.18-5.i386.rpm
To see this upgrade in verbose mode and printing hash marks when the archive is unpacked, the command would look like
rpm –Uvh telnetd-0.18-5.i386.rpm

Package Querying

The query command, -q, queries the rpm database and gives you data on the package. Information on all the packages installed can easily be displayed using rpm -qa, but the output will be very long and should be piped through more or less or redirected to a file.

Package Removing

Packages already installed on a system can be removed or erased with the -e option. For instance, removing the Telnet package above can be achieved thus:
rpm –e telnetd-0.17-23.i386

Did You Know?
The two most widely used package types within Linux are rpm and deb.
■ Both allow the user to install, update, remove, and query software.
■ Additional tools can be used to resolve dependencies (for example, yum and APT).
■ Remove or erase packages with the “e” option with rpm.
■ Remove packages with the “r” option with dpkg.

YUM

There is an automatic installation, removal, and update utility for rpm packages called yellowdog updater modified (yum). The advantage of using yum is that it resolves the dependencies automatically. Fedora Linux provides a number of software repositories and is preconfigured to work with three repositories:
■ Base repository contains the Fedora release, usually on your installation media.
■ Updates have all the updates from the base package.
■ Extras is a large selection of additional software that a user may want to install.
In addition, there are also development repositories available which will have the newest code, but which may not be stable. Like rpm, yum needs to have superuser privileges to be performed.

Installing Software with yum

You can install new software packages or package groups with yum. The following shows the commands for a single package (firefox) and a package group (MySQL database).
su –c ‘yum install firefox’
su –c ‘yum groupinstall “MySQL Database”’
When the yum command executes, it checks for any dependencies, resolves them, and then installs the specified package. The dependency check needs to be recursive, so new packages that have to be installed are checked for dependencies and so on.

Exam Warning
When you install a service, the Linux system will not start it. You must configure the service to run on bootup, which can be achieved from the command line using chkconfig and service commands.

Updating Software

To update a software package that is already installed, you can use the update option within yum. For example, to update the tsclient package you would type the command su –c ‘yum update tsclient’.
If the software being updated is currently in use by the system, the application or service needs to be restarted before the update is made current. The kernel can also be updated using yum, and these updates will only come into force upon a restart of the system. When the kernel is updated, yum will retain the old version in order that the old kernel can be booted into in case of an error with the new kernel. Only the current and previous versions are kept.
Package groups can also be updated, for example, the MySQL Database package group is updated using the command su –c ‘yum groupinstall “MySQL Database”’.

Removing Software

The removal of software is achieved using the remove option. Again, both packages and package groups can be removed. When this is invoked, yum checks the software package and the dependencies and removes both.
su –c ‘yum remove firefox’
su –c ‘yum groupinstall “MySQL Database”’
When yum removes the software package, it leaves any user data in place, but the configuration files may be removed.

deb

The Debian-derived distributions of Linux are based on the GNU project, and the Debian packages can be considered to be similar to the rpm packages in that they are precompiled for easy installation on the target system.
There are three main package libraries available from the Debian package Web site (http://packages.debian.org):
■ Stable libraries are well tested and will change only for security or major bug fixes.
■ Testing libraries have had a lot of testing and are destined to be in the next release.
■ Unstable have had little testing and may well contain bugs that could make the system unstable.
The low level or base tool of the Debian package manager is the command dpkg. This command and the main options will be discussed below. In addition to this tool, there are also a number of higher level tools such as APT, which can be used to fetch packages from many locations.

Installing Software Packages Using dpkg

To install a package, the following is used:
dpkg –i package_name
As with rpm above, you will need to have superuser privileges to run the command. Without this, the following error message will be displayed:
dpkg: requested operation requires superuser privilege

Removing Software Packages Using dpkg

Packages can be removed easily using the –r option:
dpkg –r package_name
This option leaves the configuration files on the computer so that it will be easier to reinstall it later. If you want to erase the configuration files as well, you can add the –purge option as well.

APT

Another package management tool for Debian is APT, which was designed to facilitate the administration of the packages. The default location for the APT configuration files is /etc/apt. APT has a list of locations where packages can be obtained from, and this is in /etc/apt/sources.list, part of which is shown below:
#
# deb cdrom:[Debian GNU/Linux 5.0.1 _Lenny_ - Official i386 DVD Binary-1 20090413-00:33]/lenny contrib main
deb cdrom:[Debian GNU/Linux 5.0.1 _Lenny_-Official i386 DVD Binary-1 20090413-00:33]/lenny contrib main
There is an internal database kept by APT to track the packages that are currently installed, those that are not installed, and those that are available to be installed. You can use the apt-get command to query this database, install, remove packages, and check for dependencies in packages. As this list changes when new packages are added and new dependencies coming into force, the list needs to be updated. This is achieved using the command:
apt-get update

Installing Packages

Packages can be installed using the install option, with the general syntax of
apt-get install package_name(s)
An example of the first part of the output is shown below, when the abiword package is installed:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
abiword-common abiword-help abiword-plugin-grammar abiword-plugin-mathview
aspell-en doc-base latex-xft-fonts libaiksaurus-1.2-0c2a
libaiksaurus-1.2-data libaiksaurusgtk-1.2-0c2a libfreezethaw-perl
libfribidi0 libgdome2-0 libgdome2-cpp-smart0c2a libgoffice-0-4
libgoffice-0-common libgsf-gnome-1-114 libgtkmathview0c2a liblink-grammar4
libloudmouth1-0 libmldbm-perl libots0 libt1-5 libuuid- perl libwv-1.2-3
link-grammar-dictionaries-en
Suggested packages:
abiword-plugin-goffice
The following NEW packages will be installed:
abiword abiword-common abiword-help abiword-plugin- grammar
abiword-plugin-mathview aspell-en doc-base latex-xft- fonts
libaiksaurus-1.2-0c2a libaiksaurus-1.2-data libaiksaurusgtk-1.2-0c2a
libfreezethaw-perl libfribidi0 libgdome2-0 libgdome2-cpp-smart0c2a
libgoffice-0-4 libgoffice-0-common libgsf-gnome-1-114 libgtkmathview0c2a
liblink-grammar4 libloudmouth1-0 libmldbm-perl libots0 libt1-5 libuuid-perl
libwv-1.2-3 link-grammar-dictionaries-en
0 upgraded, 27 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/9858kB of archives.
After this operation, 31.3MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Selecting previously deselected package libaiksaurus-1.2-data.
(Reading database ... 95088 files and directories currently installed.)
Unpacking libaiksaurus-1.2-data (from .../libaiksaurus-1.2-data_1.2.1+dev-0.12-6_all.deb)...
This invokes apt-get to search the database for the most recent version of the package and then retrieves it from the location specified in /etc/apt/sources.list, and if there are any dependencies, install these packages as well. The option –y can be used with the install option to assume Yes to all queries to reduce the user interaction.

Package Removal

Packages are removed from the system using the remove option.
apt-get remove package_name(s)
The package will be removed, along with all the packages that depend on it. The configuration files will not be removed, but adding the option –purge will remove all files associated with the package. Using this option is worthwhile if you know you will not be using this package in the future, as it will clean up the disk and not leave a lot of unwanted files in the filesystem.

Upgrading Packages

The upgrading of packages can be accomplished very easily within the APT system. All the packages within the current distribution can be upgraded with a single command:
apt-get upgrade
For upgrading the packages to a new distribution, it is better to use the command below to ensure that all relationships between packages are updated:
apt-get dist-upgrade
For both commands, it is worth adding the option –u to ensure that there is sufficient output for you to see what is being upgraded. The initial part of the output is shown below:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
libcupsimage2 libcupsys2 libdns45 libebook1.2-9 libecal1.2-7
libedata-book1.2-2 libedata-cal1.2-6 libedataserver1.2-9
libedataserverui1.2-8 libegroupwise1.2-13 libexchange- storage1.2-3
libfreetype6 libgdata-google1.2-1 libgdata1.2-1 libglib2.0-0 libicu38
libisc45 libisccc40 libisccfg40 libkrb53 liblwres40 libmozjs1d
libmysqlclient15off libnss3-1d libpango1.0-0 libpango1.0- common
libpoppler-glib3 libpoppler3 libpostproc51 libpurple0 libsasl2-2
libsasl2-modules libsmbclient libssl0.9.8 libvolume-id0 libwbclient0

Obtaining Information About Packages

You may often want to install a package but not sure what the name of the package is. One method of finding these packages is to use apt-cache. To search for packages, you will need to use:
apt-cache search name
For instance, suppose you want to search for abiword, you would execute the command apt-cache search abiword, with the output shown below:
abiword - efficient, featureful word processor with collaboration
abiword-common - efficient, featureful word processor with collaboration -- common files
abiword-help - online help for AbiWord
libgtkmathview0c2a - rendering engine for MathML documents
abiword-plugin-grammar - grammar checking plugin for AbiWord
abiword-plugin-mathview - equation editor plugin for AbiWord
abiword-plugin-goffice - GOffice interaction plugin for AbiWord

Resolving Application Dependencies

You can download dependent application packages manually as you try to install an application from an .rpm package, or you can use Yum. Yum is used on RPM-based systems, such as Red Hat and Fedora. For Linux distributions that use dpkg, APT natively resolves application dependencies. Although APT is a terrific tool from the command line, you are not forced to open a terminal window or change runlevels to drop to a command line when working in a GUI environment.

Compiling and Installing Applications from Source

Compiling and installing from source presents a terrific opportunity to tune applications to your specific hardware and software platform. This section starts with a description of how and where to include these hardware- and software-specific parameters and then continues through the process to compile and install the application. It concludes with several prominent utilities for archiving and packaging source code: tar, bzip, and gzip.

Configuring the Source

We will discuss downloading the package archive later on in the section, but suppose for now that you have the source in a suitable directory on your hard drive. The first place to look is to see if there are any readme or install files in the directory and read them. These usually contain very useful information on the software and often will give details on how to install them with any specific options or dependencies that you may need.
After reading the documentation, you need to change directories to the directory where the package is stored. You can then configure the package, which is usually achieved using the configure script by typing ./configure.
The configure script is a shell script which configures the makefile, which is used by the compilation tool make (described below). This makefile will have information on your system to enable make to compile the source correctly. The machine output from this command will be a new makefile, and if the command worked correctly, this will be constructed and placed in the correct directory. There could be a lot of messages scrolled to the standard output during this process. If it finds an error, it will be reported, and configure will exit. If there are no errors, configure will end gracefully.

Make

The utility make is used to automatically determine which components of a software package need to be complied and then to guide this compile process. make uses the makefile, which details the relationships among the files in the package and how to update these files. This will be undertaken from the data in the database and the last modification times of the files. The executables are typically made up from object files, which themselves are compiled from source files.
Once you have the makefile after running compile, then you can run make. This shell script is typically run initially with no options and will parse the makefile and update any files as necessary. If make completes, this will build a binary of the software package. This does not install the binary; that step is achieved in the last step using the command make install and will have to be run with superuser privileges.
If this exits with no errors displayed, then the software has been installed correctly. The configure script determines where the program will be installed, typically in /usr/local/bin. To clean up your system from the temporary files left by make, you can run the command make clean.

Autoconf

The autoconf utility is a package of M4 macros that are used to build a set of shell scripts to automatically configure software source packages. The utility will create a configuration script from a template file listing the operating system features that the package uses. The generation of the configuration files is primarily to make the user's experience easier, to ensure that the configure process is easier to use and less prone to errors.

Archive Files

The tar file format has been in existence since the early days of UNIX and was originally designed for tape archives (tar). The utility to use this file format is also called tar and is now a common method for archiving or collecting a large number of files into one larger file, while preserving all the file information, such as directory structures, dates, and user and group permissions. Files that are packed into this format have a naming structure of filename.tar. These large files can be compressed using a compression utility such as gzip, bzip, or compress. Depending on the compression utility used, the tar file will be renamed.
■ filename.tar becomes filename.tar.gz if gzip is used.
■ filename.tar becomes filename.tar.bz or filename.tar.bz 2 if bzip/bzip2 is used.
To create a tar file, the following general syntax can be used:
tar –cvf filename.tar files|directories
The options used are c to create a tar file, v for verbose output, and f to put the output in the specified file. The tar archive will be created from one or more files and/or directories specified at the end. There could be multiple files and directories specified on the same command line. For instance, suppose you wanted to compress everything in your work directory in your home folder, say /home/syngress/work. The command to create an archive work.tar in the current directory would be
tar –cvf work.tar /home/syngress/work
Once the tar file has been created, you can list its contents by using tar –tvf work.tar. The tar file can be decompressed or the files extracted using tar –xvf work.tar. This extraction process does not remove the tar file but places the files in the current working directory.
The tar utility can also be used to compress the tar file that has been created. In the above example, to compress the tar file of the work directory, you would use:
tar –czvf work.tar
The files are compressed using gzip and will be given the .tgz extension. The compressed file can be decompressed using
tar –xzvf work.tar

Compression Utilities

Some compression utilities work best on certain types of file, but we will concentrate on a couple of them. We have just mentioned gzip that can be used with tar. It is also a stand-alone program that can be invoked to compress files at any time. The format of the command is
gzip filename.ext
This will compress filename.ext and save it as filename.ext.gz. The original file will be deleted during the process. This can be decompressed by using the command:
gunzip filename.ext.gz
Again, the command will delete filename.ext.gz and leave filename.ext only. The gzip utility can compress files to different levels from 1 to 9, with 1 being quick but least efficient to 9 being slow but very efficient with the default is a level 6. For both gzip and gunzip, the option –r can be used, which will recursively compress or decompress all the files in the current directory and the subdirectories.
The bzip2/bunzip2 utilities are another pair of compression and decompression tools, which often give slightly better compression ratios. The command-line options are very similar to that of gzip/gunzip. The compressed files will usually have an extension of bz/bz2 or tbz/tbz2 (compressed file or a compressed tar file).

Adding and Removing Repositories

There are thousands of software packages for Linux stored in software repositories, and the main repositories are usually set up at install time. If you are not connected to the Internet during the initial load of Linux, these may not be set up or may be marked as inactive.

yum Repositories

Software repositories can be defined on remote servers as well as locally. The repositories are defined in the /etc/yum.conf file and in /etc/yum.repos.d directory. You can make a local repository by downloading the software from other repositories and then setting up a local repository to save downloading these for a number of machines on your network. When you have downloaded the packages, you need to generate the correct information for a repository. This is achieved using createrepo, which extracts all the data from the rpm files to generate the necessary metadata for yum. The command to create the metadata from the rpm files in the /rpm_directory is
createrepo /rpm_directory
This can then be included into the file in the /etc/yum.repo.d directory.

Fast Facts
Depending on your environment, you may use different repositories depending on the actual use of the system.
■ For servers and general users, repositories for the stable distribution are recommended.
■ If you need the additional functionality of new, development, or unstable repositories, allow adequate testing time before deployment.
■ Users who can add packages from any repository may make their system unstable and add work for your system administrators.

Adding a Repository in Debian

The method of adding a repository that use the APT packaging tool is different. The file /etc/apt/sources.list contains a list of available software repositories, and it can be updated manually or (if installed) by a graphical manager tool. If you want to add a new repository manually, the format to follow is package type, Web address (URL), distribution, and section. For example, one of the lines in sources.list could be

Summary of Exam Objectives

In this chapter, you learned how to download and install applications using a variety of methods, both from binary packages and using source code. Initially, we looked at the software package formats that you will most likely encounter on the Linux systems you are administrating – RPM and DEB packages. With both the software package formats, you were guided through the main aspects of software management, namely adding, deleting, and updating the various packages. Although both command sets are very similar to each other, there are a number of differences which you should understand and remember for the exam. The update commands for both should be memorized, and any additional options that can be added to these commands understood.
The downloading, compiling, and building software from source was described, and some background on when and why this may be necessary. The instructions for undertaking this and any command-line switches that may be necessary are usually found in the install text file bundled with the software.
Linux packages often have dependencies when the installation of one package will depend on another package to be installed. This can be resolved using tools such as yum and apt that will work out what are all the dependencies and install these as well.
All these packages are located in software repositories, which can be considered to be buckets containing one or more software packages. Once these are defined on your system, when you want to download a new software package, the system will look into these repositories to download the package and install it. In addition, updates to the system will be located in the software repositories, and the system will use these to compare with the version of software you have loaded and suggest that any are upgraded if a newer version is released.
1. You have downloaded the rpm files for a new program. Assuming that you are a normal user, what else must you do to ensure that you can install the programs?
A. Change the owner of the files to everyone, and run rpm.
B. Run chmod 777 on the files before executing the rpm command.
C. Use the command rpm –c rpmfile to ensure that the system prompt you for the superuser password.
D. Run rpm as superuser.
2. You want to set up a local repository on a server in your network. You are using yum and want to ensure that the repositories will work with this. What tool should you use, and where should the metadata files be stored?
A. Use createrepo and store the metadata in /etc/yum.repo.d.
B. Use create-repo and store the metadata in /etc/yum.repo.d.
C. Use createrepo and store the metadata in /etc/yum/yum.repo.d.
D. Use createrepo and the metadata will be stored automatically in the correct location.
3. Which of the following commands will not upgrade an installed .deb package?
A. apt-get install package_name
B. dpkg -i package_name
C. apt-get --reinstall install package_name
D. apt-get update package_name
4. You are compiling source code for installation, and you want to string all the required commands together to run while you are going downstairs to grab a coffee so that the binary file is ready when you return. What answer below has syntax that will work?
A. ./configure; make; make install
B. ./configure / make / make install
C. ./configure & make & make install
D. ./configure | make | make install
5. You are powering up a laptop that has Linux installed and that has not been used in a couple of months. Because you will be handing it over to a user who needs to use it on a long trip, you want to ensure that its applications are current. What command do you run once the APT database is up-to-date?
A. apt-get update
B. apt-get upgrade
C. apt-get dist-upgrade
D. apt-get install
Answers
1. Correct answer and explanation: D. Answer D is correct, as rpm must be run with superuser privileges.
Incorrect answers and explanations: A, B, and C. Answer A is incorrect, as you do not need to change the ownership of the files and you need to have superuser privileges. Answer B is incorrect, as you do not need to change the permissions of the files and you need to have superuser privileges. Answer C is incorrect, as the –c option will not make the system prompt you for a superuser password.
2. Correct answer and explanation: A. Answer A is correct, as you need to use createrepo and then store this data in its own file in /etc/yum.repo.d.
Incorrect answers and explanations: B, C, and D. Answer B is incorrect, as there is no create-repo command. Answer C is incorrect, as the correct file location is normally /etc/yum.repo.d. Answer D is incorrect, as createrepo will not store the data automatically.
3. Correct answer and explanation: D. Answer D is correct because apt-get update performs an update of the APT database but does not upgrade any of the installed applications themselves. Furthermore, the syntax is incorrect because a package name is not used with apt-get update.
Incorrect answers and explanations: A, B, and C. Answers A, B, and C are incorrect because all three these commands can be used to install or upgrade an installed .deb package.
4. Correct answer and explanation: A. Answer A is correct because semicolon command allows for commands to be concatenated, and hence this will work.
Incorrect answers and explanations: B, C, and D. Answer B is incorrect because the forward slash is not a valid character for use in concatenating commands. It is used in denoting filesystem locations, such as the root directory, “/”. Answer C is incorrect because double ampersands not a single ampersand allow for concatenation of commands, and this allows all the commands to execute one after another. Answer D is incorrect, as the pipe command “|” allows for the output of the first command to be input into the second command, but the string above will result in an error not a complied program.
5. Correct answer and explanation: B. Answer B is correct because apt-get upgrade uses the information in the APT database (which is updated using apt-get update) to update all installed applications to their most current versions.
Incorrect answers and explanations: A, C, and D. Answer A is incorrect because it is the command to update the APT database. Answer C is incorrect because the dist-upgrade option upgrades the entire distribution to the latest version, and the requirements in this question ask for only the installed applications to be updated. Answer D is incorrect because when a package name is specified, it is the command to install an individual application.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.72.74