3

I'm trying to get a comprehensive understanding of what common terms actually mean on the back end of things. Does "installing" a program simply mean that it gets out into a certain directory, usually /bin or /opt, and has its name added to PATH in your .profile file?

I was always under the impression that installing a program meant that there would be tons of files and modifications to existing files scattered around the OS in various places. Is that ever true?

If so, how does one un-install something like that? I like to keep my OS clean and organized, so it is good if I can simply remove the binary from /bin, but I wouldn't know how to clean up an install if it does leave tons of changes around the OS.

How does it work?

Andrew
  • 147
  • 6
  • 2
  • @dobey I think this is asking for more than just where to find the location of files during installation. Correct me if I'm wrong, OP, but I think that they're asking for an explanation of how programs are installed and what happens during that process. – TheOdd Nov 07 '16 at 17:45
  • 2
    I've marked this as a duplicate, and it's also too broad as you're asking many questions here. I think the suggested duplicate answers most of it though. As for just removing files, you should use the packaging system (apt) to remove the package which installed the binary, and not just delete random files. – dobey Nov 07 '16 at 17:45

1 Answers1

3

Baseline

"Installing" a program is a broad term. The actual definition is

Place or fix (equipment or machinery) in position ready for use.

So basically, just having something in the right position and setup to be able to function and be used properly. This is the definition of the term that I'll be using throughout this answer.

Process

APT (Advanced Packaging Tool)

The actual "under-the-hood" process of apt-get is explained very well by muru in this post. This basically covers what the command does and what it accesses. I'm linking to his answer because I don't want to duplicate the same answer on a different question, I just want to reference it.

Basic installation concept

Theoretically, just moving the executable file to the bin folder and having your bash environment point to that folder as its PATH, as well as moving any additional files to another directory (usually /var/) and referenced by the executable should be fine to "install" something. But, the things that are downloaded and moved by a package varies greatly between different packages as I mention later in this answer. So, this process isn't especially useful unless you're installing either your own package that you know where to put the files (even then, you should probably package it into a .deb file for autonomy) or a very basic package.

Extra Files

APT (Advanced Packaging Tool)

This varies heavily for each package installed. This mostly deals with dependencies as these are the things that you aren't explicitly telling Ubuntu to install, but it needs to in order to properly install the package you specified. If you want to remove these files then, in theory, you would have to manually go through each dependency installed and remove them. But, there are two ways to deal with these files without doing that. apt-get comes with two useful commands,

  • apt-get remove --purge [package]
  • apt-get autoremove

The first command tells Ubuntu to remove all configuration/extra files along with the core files of a specific package. However, this does not remove the dependencies that were installed with the package. To do that, we have to use our second command.

The second command tells Ubuntu to remove all orphaned packages. An orphaned package is a package that was installed as a dependency, but is no longer needed by any other packages. Doing both of these commands will remove all files that were initially downloaded/installed from the original installation.

There may be other minor things that are specific to the package installed that need to be manually reverted such as additional configuration files or default application associations, but those should be easy to reverse.

Basic removal concept

As stated in the Basic installation concept section above, you really just have to move all required files to the correct paths referenced by your bash and system environment. To rid the system of these files, just reverse the process by going back to whatever directory they were placed in and remove them from there. This usually doesn't apply to most packages installed, but it is the basic concept.

TheOdd
  • 3,012