16

This answer explains .msi and setup.exe files for installing an application on Windows.

Are there equivalents to .msi and to setup.exe files in Debian or Ubuntu? Do .deb package files correspond to .msi or setup.exe or something else?

Michael Homer
  • 74,824
  • 17
  • 212
  • 233
Tim
  • 98,580
  • 191
  • 570
  • 977
  • 9
    I don't know why you're asking this, so I'll say this as a general comment for anyone who comes across this question. While there are ways to install software "manually", the way preferred by most Linux distributions (and strongly recommended) is to install software through the package manager. This way you automatically get security updates and there's some level of testing done to ensure compatibility with the distribution. If you need the latest and greatest version of software not available in main repos, use a community repo (eg a PPA in Ubuntu), but always use the package manager. – Muzer Apr 25 '17 at 09:37
  • There are no `.setup` files on Windows, do you mean `setup.exe` which is a typical name for an installer? – gronostaj Apr 25 '17 at 09:44
  • See [the `apt-get` man page](http://manpages.ubuntu.com/manpages/yakkety/man8/apt.8.html) and the docs linked from there. There is no equivalent on Windows even for `apt-get install`, let alone essentially any of the other things it can do. – jthill Apr 25 '17 at 12:12
  • 5
    @jthill, that's untrue. It's not as fully-fleshed or as popular as `apt-get`, but recent (Win7 and up) versions of Powershell have `OneGet` through which you can install `Chocolatey` (an equivalent to `Homebrew` on Mac). They might be less popular than their 'nix equivalents, but to say that *there is no equivalent on Windows* is blatantly incorrect. – flith Apr 25 '17 at 13:00
  • @flith I could have said " in Windows's .msi's and setup.exe's", not "on Windows", but since OP had explicitly asked to compare apt specifically to those I still think the reference was, or should have been, clear. – jthill Apr 25 '17 at 13:26
  • @jthill: I'm pretty sure I have seen a project somewhere to port `dpkg`/APT to Windows. – Jörg W Mittag Apr 25 '17 at 14:05
  • 2
    @Tim: this question cannot be answered sensibly without you specifying what *precisely* you mean by "equivalent". What *specific* properties of `.msi` files and installers are you interested in? What are the *precise* criteria to determine whether something is "equivalent" or not? For example: installers are just programs like any other program. There is absolutely nothing special about a program named `setup.exe`. Since `setup.exe` is just a program like any other program, and Debian most certainly *does* have a concept of "program", do you consider that equivalent? If not, why not? – Jörg W Mittag Apr 25 '17 at 14:09
  • @Toby Please make sure the links you "simplify" to *actually work*. – Michael Homer Apr 25 '17 at 22:26

3 Answers3

29

Probably closer to an MSI installer than a setup.exe, a .deb package includes a tree of files to copy into the filesystem, as well as a collection of pre- and post-installation hooks to run (among other things). The hooks can effectively do anything on the system, including something I don't think I've ever seen on Windows: adding users for a system service. One thing they can't do is install another .deb package — the database is locked during installation, so this can only be achieved through dependencies. Installing a .deb package then produces entries in a central database of installed packages for ease of maintenance.

The ttf-mscorefonts package is interesting in that the package itself contains only a script to download and install the fonts. This script is executed in one of these hooks.

Closer to setup.exe might be downloading a progam's source code from the project's homepage, then running ./configure && make && sudo make install, or whatever other method the authors decided to use. Since this method does not add the package to the database of installed programs, removing it later can be much more difficult.

Another difference is that a .deb specifies its dependencies, so proper installation can be guaranteed. As far as I know, in the Windows world an MSI cannot cause the installation of another MSI, so setup.exe is typically used for this kind of dependency tracking. Several comments note that MSIs can name dependencies, but since there is no central database of MSIs like there is for .deb packages, missing a dependency will just cause a failure to install.

Thus, a .deb is sort of in between an MSI installer and a setup.exe. The package can do whatever it wants during its pre- and post-installation hooks, can name and usually find its own dependencies, and leaves a record of its installation in a central location for ease of maintenance.

Fox
  • 8,013
  • 1
  • 26
  • 44
  • 3
    In Windows, `setup.exe`-style installers also integrate into the tracked installer system (with uninstallers etc.). With both MSI and `.exe` installers, dependencies are handled by embedding the dependency in the installer (*e.g.* the VC redistributable installer or the DirectX installer) and by installing dependency DLLs alongside the executable (or as system assemblies). So `setup.exe` is also similar to `.deb`. The equivalent to building from source is building from source on Windows too ;-). – Stephen Kitt Apr 25 '17 at 07:35
  • I *do* not one thing that makes MSIs closer to Debian packages than setup executables: an MSI can’t install another MSI, just like a Debian package can’t install another package (except *via* its dependencies). – Stephen Kitt Apr 25 '17 at 07:57
  • @StephenKitt: `setup.exe`-style installers are in no way "tracked" by the OS unless they run MSIs underneath (and then the MSIs are the ones tracked). The fact that they have an uninstall registry key has no bearing on this. That's like saying every file is tracked because it's listed in the file system. – user541686 Apr 25 '17 at 07:57
  • @Mehrdad I stand corrected, thanks. I get the impression MSIs embedded in `.exe` installers are quite common, aren’t they? – Stephen Kitt Apr 25 '17 at 08:01
  • @StephenKitt: Yeah, for no good reason. I regularly just keep the extracted MSI and delete the EXE and don't have any problem. – user541686 Apr 25 '17 at 08:57
  • @StephenKitt: I think EXEs used to exist because I remember back in the Windows XP (edit: and Vista?) days Windows Installer itself needed installing/upgrading, so programs bundled that in. I don't know why programs still do but it's probably just a relic of that, though in some cases I think they have their own decompressors which are better than can be compressed in MSIs? – user541686 Apr 25 '17 at 09:15
  • 2
    MSI can and often (in bigger products) do have dependencies, though, given that there's no central repository of .MSI, usually what happens when you miss a dependency is that they refuse to install. – Matteo Italia Apr 25 '17 at 11:36
  • The "check for DLL's and other dependencies" in an .msi is not as rigorous as apt. You can still end up with a "side by side" mess. Also running apt-get install after a dependency failure can suck in dependencies if available and complete the install. This is commonly done when scripting builds with dpkg -i (very commonly for Webmin dependencies which are numerous). – mckenzm Apr 26 '17 at 05:25
  • .deb file are more like the "online installers" that many programs use now days. These go off and fetch files over The Internet based on a manifest in the .exe or .msi. If your answer included a hint at them I think it would be more comprehensive but it is already very good imo. – TafT Apr 26 '17 at 08:00
  • 1
    "something I don't think I've ever seen on Windows: adding users for a system service". I'm fairly certain that the SQL Server, IIS and Visual Studio installers do this. But it might be less obvious as the Windows users model is a bit more refined that the default Unix/Linux model (either you're root or you're not).. – MSalters Apr 26 '17 at 08:25
  • @TafT the vast majority of `.deb` packages are self-contained and *don’t* download files from the Internet. – Stephen Kitt Apr 26 '17 at 14:23
  • @StephenKitt you mean most of them have no package requirements? In this case the `.deb` file has the manifest and `apt` is doing the downloading. The `.exe` or `.msi` file is a combined thing that has the manifest and does the downloading. That is what I was trying to hint at. Debian packages do not usually contain everything so you can install it off a USB stick with no internet access, basic `.msi` files do. – TafT Apr 26 '17 at 16:38
15

Single-file binary installers I have seen on Linux were .sh files which contained a shell script concatenated with a binary blob, like this:

#!/bin/bash
tmpdir=$(mktemp -d /tmp/installer.XXX)
tail -n +6 "$0" | tar -xJf - -C "$tmpdir" || exit 1
sudo "$tmpdir/setup.sh"
rm -rf "$tmpdir"
exit
[binary content follows]

This is essentially equivalent to a setup.exe which also self-extracts to a temp folder and runs the real installer from there.

Dmitry Grigoryev
  • 7,123
  • 2
  • 23
  • 62
6

Taken from: https://askubuntu.com/questions/13415/what-are-run-files/13416#13416

A .run file is normally a custom made program which needs to be executed in order to install a program. these are not supported generally as they don't track where files go and don't normally provide an uninstall method. there is no way to be sure what the script will do to your system so they're considered unsafe.

They are close to the windows exe file and as such come with the same issues.

Zumo de Vidrio
  • 1,703
  • 1
  • 13
  • 28