Show Lecture.SoftwareInstallation as a slide show.
CT320 Software Installation
Software Installation
Colorado State University
Computer Science Department
Original slides from Dr. James Walden at Northern Kentucky University.
Software Installation
- Customization
- Select options, e.g., language.
- Select file set.
- Install new files in appropriate locations.
- Modify existing configuration files.
- Make software available to user.
- Shell configuration (
$PATH, etc.) - GUI configuration (menu, icons, etc.)
- Shell configuration (
What’s the problem?
- What prerequisites does your software have?
- What prereqs do your prereq packages have?
- How do you handle conflicts?
- What if two programs install/modify same file?
- How do you handle upgrades?
- What if user has customized configuration?
- What if ownerships/permissions have changed?
- What if user needs old and new versions?
- What if a package becomes obsolete?
- How do you uninstall software?
Package Manager Features
Any package manager must have:
- Build management (build from source)
- Dependency tracking (package A requires package B)
- Querying (What’s installed?)
- Reversibility (uninstall)
- Verification (Has this package been tampered with?)
- Version control (gcc 4.8 vs. gcc 4.9)
UNIX Package Management Systems
- Debian:
dpkgandapt(advanced package tool)- Ubuntu: same as above, same packages, too
- Solaris:
pkg-addpackaging system - Gentoo:
portagewithemergecommand - Slackware:
installpkgmanages.tgzfiles - RedHat:
rpm(redhat package manager) packaging system.up2date: RHEL interface to RPMurpmi: Mandriva interface to RPMyast: SuSE interface to RPMyum: Fedora interface to RPM
Package
A package, in general, is a encapsulation of a program or programs. It contains:
- executable files
- required data files
- icons
- man pages
- dependency information
- install/update/remove procedures
- description, pointer to developers, etc.
- checksums/hashes
More than one file
Some packages contain many programs. The Debian coreutils package
contains 232 files, including these programs:
deb
Debian (and hence Ubuntu (and hence Xubuntu)) uses *.deb files
to hold packages.
dpkg
On Ubuntu, the most primitive package manager is Debian’s dpkg.
I rarely use it directly.
Wrappers
There are many programs that provide a better interface than dpkg:
apt: command-line wrapper arounddpkgapt-get: roughly the sameaptitude: roughly the samesynaptic: graphical interface to install & remove packagessoftware-center: a very friendly interface to look for new packages, like the Google Play Storeupdate-manager: graphical interface that looks for updates, like Windows Update. Often run fromcron.
Using apt
- Install
- Uninstall
- Upgrade
- Query
- Verify
Installing a Package
- Check the package and the files it wants to install.
- Perform preinstallation tasks.
- Uncompress the files and copy them in the proper locations
- Perform post-processing tasks
- Update the database
Install Example
% sudo apt install zoo Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: zoo 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 74.5 kB of archives. After this operation, 169 kB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu/ vivid/universe zoo amd64 2.10-27 [74.5 kB] Fetched 74.5 kB in 0s (225 kB/s) Selecting previously unselected package zoo. (Reading database ... 225219 files and directories currently installed.) Preparing to unpack .../archives/zoo_2.10-27_amd64.deb ... Unpacking zoo (2.10-27) ... Processing triggers for man-db (2.7.0.2-5) ... Setting up zoo (2.10-27) ...
Upgrading a Package
- Uninstall + install, retaining configuration files.
- Will install a package if no older version.
- Will remove all older versions.
Uninstalling a Package
Remove a package, leave configuration files behind.
% sudo apt remove zoo Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: zoo 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. After this operation, 169 kB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 225225 files and directories currently installed.) Removing zoo (2.10-27) ... Processing triggers for man-db (2.7.0.2-5) ...
Uninstalling a Package
Completely removes package from system, including configuration files.
% sudo apt purge zoo Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: zoo* 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. After this operation, 169 kB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 225225 files and directories currently installed.) Removing zoo (2.10-27) ... Processing triggers for man-db (2.7.0.2-5) ...
Dependencies
For example, a number of packages depend upon the cups package.
Removing cups will remove several other packages:
% sudo apt remove cups Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: bluez-cups cups hplip printer-driver-gutenprint printer-driver-hpcups printer-driver-postscript-hp printer-driver-splix 0 upgraded, 0 newly installed, 7 to remove and 0 not upgraded. After this operation, 5,688 kB disk space will be freed. Do you want to continue? [Y/n] n Abort.
Dependency Resolution
- Higher level tools handle dependencies
- Automatic resolution + downloading.
- Find dependencies in package headers.
- Download dependencies, check their headers.
- Repeat.
- Install after all packages are downloaded.
Just Testing
Verify that all installed files match the md5sum.
% sudo dpkg --verify ??5?????? c /etc/sudoers ??5?????? c /etc/default/rcS ??5?????? /usr/bin/xdg-open
Querying the Database
- List installed packages:
dpkg --get-selections - Installed vim packages:
dpkg --get-selections 'vim*' - Installed packages by size:
dpkg-query -Wf '${Installed-Size} ${Package}\n' | sort -n - What package provides date:
dpkg -S /bin/date - What files are in the coreutils package:
dpkg -L coreutils - Tell me about the gcc package:
apt-cache show gcc
Maintenance
Do this every week or so:
% sudo apt update
% sudo apt dist-upgrade
% sudo apt autoremove
upgrade vs. dist-upgrade
apt upgrade
Updates all packages currently on the system. Won’t remove old packages, or install new packages.
apt dist-upgrade
Like upgrade, but also intelligently handles changing dependencies
with new versions of packages; has a “smart” conflict resolution
system, and it will attempt to upgrade the most important packages at
the expense of less important ones if necessary. It may therefore
remove some packages.
