What should actually be done to install packages on a computer which has no Internet access?
Download those packages in a system with internet access, setting up a local cache, etc. seems the way to go.
Now with Debian Wheezy, I can find the .deb on packages.debian.org just fine, but problems start when those packages need newer versions of already installed packages. I cannot find an equivalent to launchpad.net for Debian...
Now, here there is a problem. Firstly, you are using a Debian based distro packages to be installed in another Debian based distro. This would make anyone cry in regret.
When installing software, specifically package, in your system you should make sure they comes from the same source. When you start mixing sources, problems like the one you experience arises and give you headaches.
apt-cache showpkg
shows detailed information about potentially installable packages. It does indicate whether the package is installed, kind of, but not in a very readable way:
Versions:
2:3.6.6-6+deb7u5 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_Packages)
If the package was installed, you'd see (/var/lib/dpkg/status)
at the end of the line. However, this isn't fully reliable, because you'd also see this indication if the package was known to your system but not fully installed, e.g. if it was in the “package uninstalled but configuration files left over” state.
A more useful apt-cache
subcommand is apt-cache policy
. It clearly shows the installed version (if any) and the available version(s). For example, here's output from a machine which has samba
installed but not samba-dev
:
samba:
Installed: 2:4.1.17+dfsg-2
Candidate: 2:4.1.17+dfsg-2
Version table:
*** 2:4.1.17+dfsg-2 0
500 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages
100 /var/lib/dpkg/status
samba-dev:
Installed: (none)
Candidate: 2:4.1.17+dfsg-2
Version table:
2:4.1.17+dfsg-2 0
500 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages
Alternatively, you can use the dpkg
command to get information about your current system. APT is the software that manages the download of packages, dependency analysis, etc. Dpkg is the low-level software that carries out the actual installation of a package file.
dpkg -l samba
This shows a line beginning with i
if the package is installed, and a line beginning with u
or p
or nothing at all if the package is not installed.
$ dpkg -l samba samba-dev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii samba 2:4.1.17+dfs amd64 SMB/CIFS file, print, and login s
dpkg-query: no packages found matching samba-dev
(dpkg-query
is the dpkg
subcommand that returns information about the package database.)
Note that if you just want to ensure that a package is installed, you can simply run
apt-get install samba
This won't do anything if the latest version of the package that's available in your distribution is already installed. It will install the package if it isn't installed yet, and it will upgrade it if you have an older version.
Best Answer
You can do this locally by installing
apt-file
:(depending on the version of Debian you're using, you may not need the
apt-file update
step).