2

I am absolutely new to Ubuntu. I just migrated to Ubuntu 13.10 from Windows.

While using Windows, it is a common practice to download a software, save the downloaded files in a different partition and then use the executable .exe installer to install the software in the computer.

I have been installing apps in Ubuntu using

sudo apt-get install <package-name>

In this process I am unable to store a copy of the software before installing. Is there a process for doing that? Ubuntu doesn't even ask me for the path where to download the software to. Neither am I asked for a path where the OS wants to install the software.

I am unable to understand the process that is going on.

Richard
  • 8,502
  • 11
  • 47
  • 72
ubuntu_noob
  • 289
  • 1
  • 3
  • 16

3 Answers3

3

Linux software is organized in packages, and apt is the software that manages those packages. A software package may depend on many other software packages in order to run. For example, if you install the package for Wine, apt will report that wine depends on several other packages, which in turn depend on other packages that do certain things for Wine, like fonts, filesystem utilities, filetype support, etc.

Organizing software this way has many advantages.

  • There is no need to install a piece of software twice.
  • It is incredibly easy to remove and install packages because it is all automated.
  • Removing software is always non-invasive.
  • Upgrading software is a breeze.
  • There is no need to keep track of a bunch of downloaded executable installer files.

In Windows, you would have one big folder for a program holding all the software binaries, icons, configuration files, and the whole blob for a specific program. In Linux, you have a dedicated folder for all the icons the system uses (/usr/share/icons), all the binaries (/bin), all the firmware files (/lib/firmware), and the rest. The package file for a piece of software keeps track of all of its files across the system. Things are a lot easier to find this way.

When you install a package, this is what happens: Say you invoke the command sudo apt-get install libreoffice:

  1. The package lists on your computer (in /var/lib/apt/lists) are checked for a package named libreoffice. The lists provide information about all of the different installable packages, which are stored on http://archive.ubuntu.com/. The website is not meant to be browsed by users (see below), instead it's intended to be used by apt. The package's dependencies are examined (in libreoffice's case the list is extensive). If dependencies need to be installed, they are added to the list of packages to be installed, in the correct order.
  2. The packages are all downloaded from http://archive.ubuntu.com/. If you have selected a different mirror to get more speed, they are downloaded from there.
  3. The package files themselves are ar achives which in turn contain archives for program data, and information on where the data goes with more detailed information about the package. The packages are decompressed individually and then set up according to what is detailed in the package's control information in the archive. Any specific scripts are then run and configuration files are changed.
  4. Meanwhile, apt keeps track of the status of the packages: whether they are installed, partially installed, or not installed.

If you want to know what is going on "behind the scenes", you can check the files that a package installs across the system on http://packages.ubuntu.com/. You can also download .deb package files from there, if you need to, but you wouldn't typically want to. You can also use apt to download and see the details of packages.

  • To download a package file and its dependencies: sudo apt-get download <package>
  • To see the details of a package: sudo apt-cache showpkg <package>
  • To see what packages you have downloaded (this directory is normally write-protected and not accessible by normal users): ls /var/cache/apt/archives
  • To clear the cache and save disk space: sudo apt-get clean

To conclude, in Linux, it is not necessary to know as the user where all the package's files are kept and what exactly is being done when you install one, unless you are doing advanced operations that explicitly require that knowledge. You have the powerful Software Center to see what programs you have installed and you can use that to install and remove them.

Richard
  • 8,502
  • 11
  • 47
  • 72
  • Thanks everyone, especially searchfgold6789 for your reply. I am now starting to get some idea of the process. Are all deb files executables? I was trying to install GNU Octave, so I went to terminal and

    apt-cache search GNU\ Octave

    the system returned a lot of results, and amongst them some were deb files, some were doc files...etc etc. Now I'm not clear which of the files, I should point my "apt-get install" function to to install the software. So, I went and at the terminal I input sudo apt-get install GNU\ Octave the system replied "unable to locate package GNU Octave" Please explain.

    – ubuntu_noob Jan 15 '14 at 18:53
  • Moreover if .deb files are supposed to be the executables, then when I do an ls -al \var\cache\apt\archives why is it that the permission fields of the .deb files are marked as -rw-r--? – ubuntu_noob Jan 15 '14 at 19:28
  • I have added more info to my answer for you to peruse. – Richard Jan 16 '14 at 01:49
  • As for how to search for and install packages, see the Ubuntu Documentation: https://help.ubuntu.com/stable/ubuntu-help/addremove-install.html – Richard Jan 16 '14 at 01:51
  • .deb files are packages. They include the binaries, manuals, libraries, etc. for a specific module. .deb files are not executables. They are archives. – spyderdyne May 19 '16 at 17:04
1

Ubuntu is designed so that packages installed via apt-get are put in just the right places, so things just work without your having to worry about where things get downloaded, or what directory to install to, or things like that. sudo apt-get install <packagename> downloads a copy of the package to /var/cache/apt/archives, so you can look there for previously installed packages. Alternatively, you can run apt-get download <packagename> to download a .deb package file to the current directory, without installing it (it can be installed later via sudo dpkg -i filename.deb). However, for most users it's easiest just to use the standard sudo apt-get install ... command and not have to worry about backups or accidentally not installing something you downloaded earlier.

MattDMo
  • 2,125
  • 1
  • 13
  • 18
0

Navigate to /var/cache/apt/archives. When you type sudo apt-get install program-name it downloads the program and it's dependencies to that location. Just copy the files from there to a backup location. If you want to re-install them or install them on another computer just paste them back in, disconnect from the internet, and type the regular install command, sudo apt-get install program-name. Alternatively you could also setup a local repository on your computer.

mango
  • 1
  • 1