Pinterest Stumbleupon Whatsapp
Advertisement

Modern operating systems provide you with easy methods to set up new applications. These include automated installer packages as well as commands that install many bits of software at once. But what actually happens when you run that installer or issue that command?

Let’s take a look at how software gets installed on three major desktop platforms: Windows, macOS, and Linux.

Methods of Software Installation

There are a few different ways you can get new applications running on your computer. In order of increasing complexity, these include:

  • Software Compilation — Building the application from its source code. For the most technical users only.
  • Software Archives — Unpacking archives such as ZIP files and running the program from wherever you extracted it. This may require some extra tweaking.
  • Installer Packages — Finding an installer file and (double-)clicking to start the installation.
  • Software Managers/Stores — Selecting the app from a nice interface and clicking a big “Install” button. It’s magic!

In this article we’ll examine the Installer Packages, as most Software Managers/Stores ultimately deal with these types of packages behind the scenes anyway. For today’s main desktop platforms — Windows, macOS, and Linux — we’ll look at what makes up one of these packages, and what occurs when you install them.

Microsoft Windows

The Installer packages you’re likely to come across for Windows come in one of two main flavors. Executable files (EXE) can set up your program by doing the heavy lifting of placing files in the right location and performing Windows Registry updates. Windows Installer packages (MSI) add to this by providing standardized services such as uninstalls.

You can inspect the contents of EXEs or MSIs by opening the archive with 7-Zip 7Zip - A Free Program to Unzip Uncommon Archive Formats 7Zip - A Free Program to Unzip Uncommon Archive Formats Read More . If you use it to look at 7-Zip’s own EXE installer, you’ll find a number of different files within:

anatomy software package 7zip contents

While these files have no containing folder within the installer, the developer will have pointed each one at a target directory. Most of them end up in the “default install location” — the same suggestion you typically see for a folder like “C:\Program Files\[program name]” or “C:\Program Files (x86)\[your new app].”

When using a sophisticated tool like InstallShield to create installer packages, app developers can customize the installation. For example, they can designate which versions of Windows it it will install on, set up shortcuts to be created in the Start Menu and/or on the Desktop, or collect user info such as name, address, etc. The sample InstallShield project in the image below shows the screen for setting whether Windows Registry keys should be created or updated.

anatomy software package installshield registry

With InstallShield, the app files and other customizations get wrapped up in a setup.exe file. Opening it with 7-Zip will show that inside is an MSI package that, when run, looks just like the installation we’re all used to. Let’s review what happens during this process.

anatomy software package installshield install

Windows Installation Process

An installer will take the following steps to set your app up for use (the precise order of which may vary depending on the developer’s customizations):

  1. An installer can contain other archives, like the aforementioned MSI or formats like CAB. As a first step the installer will extract these to a temporary location.
  2. Next, it will check to see that any dependencies that have been set are available. If anything’s missing it will download it if possible, or exit the installer with an error if not.
  3. If any dependencies are required, they will be installed first using whatever installer they come with (ever had an install interrupted for .NET Framework? Microsoft .NET Framework: Why You Need It and How to Install It on Windows Microsoft .NET Framework: Why You Need It and How to Install It on Windows You either need to install or update it. But do you know what the .NET Framework is? We show you why you need it and how you can get the latest version. Read More ).
  4. Next, the installer will begin copying the app’s files and placing them in their correct location.
  5. If the developer configured any shortcuts, the installer will create and point them to the actual installation path (remember, you can change this How to Create Windows Desktop Shortcuts the Easy Way How to Create Windows Desktop Shortcuts the Easy Way Smart desktop shortcuts can save you mindless sifting through menus and folders. We show you quick & easy ways to create them. Read More when the installer is run).
  6. Changes to the Windows Registry 3 Tools To Monitor & Examine The Windows Registry 3 Tools To Monitor & Examine The Windows Registry The Windows registry is one of the most poorly understood parts of the Windows operating system. We show you tools that can simplify the registry and help you identify issues. Read More , if any, will be executed.
  7. Lastly, the installer may prompt the user to enter information such as name or web site address.

This process may seem complex compared to the next operating system on the list. Let’s take a look at installing software on macOS.

Apple macOS

Windows installers have a lot going on under the hood. But if you’ve used a Mac you know that installing an application is often as easy as downloading a copy of the app, opening the disk image (DMG), and following some easy prompts How to Install & Remove Mac Software: 5 Easy Methods How to Install & Remove Mac Software: 5 Easy Methods Switched to a Mac and getting to grips with the basics? Wondering how to install software from the command line? Got old Windows apps that you simply must run on your Apple computer? Read More . Sometimes the download even provides you with a “Drag here!” icon.

Let’s dive into the APP bundle as well as its counterpart the PKG installer.

macOS Package Structure

The APP file on the surface is in fact simpler than Windows for two main reasons. Firstly, it’s a standard folder. The only difference is that it ends with a “.APP” suffix. If you download one of these on Windows, you’ll see it displays just as any other file folder would in Explorer. Secondly, APP files demand that absolutely everything the program requires is included. There’s no worry about missing dependencies with these types of installers.

These bundles must contain three things in a folder called “Contents”: 1) an “Info.plist” file that contains application metadata such as name, language, version number, etc.; 2) a “MacOS” directory that holds the main executable; and 3) a “Resources” directory that holds assets the application needs to function (e.g. an application icon). There are other optional folders such as “Frameworks” (bundles of functionality that aren’t specific to the app), “Plug-Ins” (functionality for the app that is not required to run it) and “SharedSupport” (extraneous data like templates).

mac app folders

In contrast, the PKG format is a combination of a Windows-like installer with a Unix-like structure 3 UNIX-Like Operating Systems That Aren't Linux 3 UNIX-Like Operating Systems That Aren't Linux Recently, people started to confuse "UNIX" with "Linux." Linux was influenced by UNIX, but UNIX systems have no relation to Linux. Here are some important UNIX-based systems worth knowing about. Read More . The 7-Zip application will also open a PKG file, which is compressed in xar format. Within is one or more Payload files, which is also an archive. To extract its contents use the following chain of commands (cpio is an archive format as well as a program for manipulating them) in a Mac or Linux Terminal:

cat Payload | gunzip -dc | cpio -i

Once done, you’ll see a familiar Unix-like directory tree.

In the example below, I’ve used document converter, Pandoc. It includes a binary in /usr/local/bin and some documentation in /usr/local/share/man. How do these things actually get in place? We’ll take a look at how each of these actually installs to your Mac.

mac pkg structure

I’ve used the Windows version of 7-Zip to illustrate this, rather than the command-line only Linux version.

macOS APP Installation Process

When you drop that APP file onto your Applications folder, it doesn’t really change all that much. Remember, everything needed to run the program is self-contained. The only difference from a standard drag-and-drop is that the “Info.plist” file gets registered with the system.

mac app copy

This will configure things such as which executable is called when you start the app, which icon is displayed, file types it supports, and more. But otherwise your app (such as the APP package for the Atom Editor shown below) is now ready to use.

mac app installed

macOS PKG Installation Process

Opening a PKG file, on the other hand, launches a “wizard-style” installer. For simple programs this is typically a component installer, which typically goes through the following steps:

  1. Run the preinstall script.
  2. Unpack the “Payload” contents to the machine.
  3. Run the postinstall script.

mac pkg install

Developers can then combine multiple components into a single product archive install. This adds options such as displaying a EULA for the user to accept, collecting info from the user, and selecting the components to install. Meanwhile, the Apple Installer takes care of all the details of installing the necessary components one-by-one in the background.

Speaking of Unix-based installers, we’ll move on to the two leading Linux package formats in the next section.

Ubuntu and Fedora Linux

Ah, DEB versus RPM How to Install Software on Linux: Package Formats Explained How to Install Software on Linux: Package Formats Explained You've switched to Linux, and want to install some software. But package managers differ depending on your distro. So which apps can you download and install? It's all in the acronyms. Read More . One of the great flame wars, bested only by the likes of vi versus emacs or KDE versus GNOME. Yet these formats are more similar than they are different. Let’s take a look.

Linux Package File Structure

To take a look at the inside of a DEB file, you can try a GUI archive manager. Otherwise, use the ar command. The following command entered in the terminal 40+ Most Used Linux Terminal Commands 40+ Most Used Linux Terminal Commands Whether you're just getting started or simply curious about the Linux terminal, here are the most common commands that will carry you through your entire time on Linux. Read More will extract the contents of a Debian package:

ar -x name-of-your-package.deb

Three files will come out of this:

  • control.tar.gz — This in turn contains one primary file, Control, which contains metadata about the package, such as it’s official name, version, and dependencies. It may also contain other files such as scripts to be run during the install process or default config files.
  • data.tar.gz — The files that make up the application itself are in this TAR.GZ archive. Everything, including binaries, documentation, and default configs are in here. In the example package kde-service-menu-encfs_0.5.2_all.deb, it contains files and directories as shown in the below image.
  • debian-binary — This is a file that defines what version of the Debian package format the file is using. For modern distributions this will just contain “2.0” on a single line.

deb main control

In Fedora, you can use the rpm2cpio and cpio commands to extract an RPM package and browse their files:

rpm2cpio name-of-your-package.rpm | cpio -idvm

For the package kde-cli-tools-5.9.4-2.fc26.x86_64.rpm, you’ll see a file tree similar to the DEB package. But it does not provide the metadata, at least not in the binary package. You’ll need to download the source RPM (.SRC.RPM) corresponding to your binary version, then use the same command above on that file. Included in that will be a SPEC file that contains many of the same items as the Control file in a Debian package.

Now that we have an understanding of the structure of Linux packages, let’s explore what happens when you actually install them How to Install Software on Linux: Package Formats Explained How to Install Software on Linux: Package Formats Explained You've switched to Linux, and want to install some software. But package managers differ depending on your distro. So which apps can you download and install? It's all in the acronyms. Read More .

Linux Package Installation

When you install packages of either format, regardless of the front-end, a similar set of steps happens:

  1. The package system examines the package’s contents to determine whether there are missing dependencies. Depending on the tool, it will either warn you, or set to downloading them.
  2. If the packages contain pre-install scripts or commands they run next.
  3. Then the package system actually extracts the package’s files.
  4. With the files in place, post-install scripts run.
  5. Finally, the package is registered with the internal database using its metadata, so it can be uninstalled later.

Knowing How Software Is Installed Is a Good Thing

Because developers of operating systems and the software that runs on them do a great job of making software installation easy, you don’t really need to pay attention to the details. But having some knowledge about that’s happening behind the scenes will give you some peace of mind about what is being installed on your system, as well as helping with troubleshooting.

How many of the above software install methods have you done? Do you prefer DEB or RPM? Or do Mac’s APP bundles represent the pinnacle of ease-of-use? Ever had a nightmare install happen? Let us know in the comments below!

Leave a Reply

Your email address will not be published. Required fields are marked *