2

I'm trying to install a deb package offline using apt-get command. From what I understand, I can download a package manually from the internet. Put it in the local repository folder (which is usually /var/cache/apt/archives). Then update the repository using apt-get update. And finally apt-get install myPackage

I tried these steps, but I keep getting the error Unable to locate package uex_15.1.0.8_amd64. What am I missing? or should I use apt-offline? If so, how?

BTW, the package uex_15.1.0.8_amd64 is the package to install UltraEdit.

Anthon
  • 78,313
  • 42
  • 165
  • 222
AhmedWas
  • 237
  • 1
  • 2
  • 9
  • Your approach doesn't work. `apt` doesn't know the deb file is in the cache if you do it that way. Please give a specific example of what you are trying to do. And yes, I think you can use `apt-offline`, assuming you have `apt` configured correctly. – Faheem Mitha Apr 21 '16 at 08:42
  • Could you please post content of `/etc/apt/sources.list` file ? – Rahul Apr 21 '16 at 08:44
  • What do you mean by a specific example? I specified everything in the question. But again the steps in more details. 1- Download the file 2- Save the file to `/var/cache/apt/archives` 3- run `sudo apt-get update` 4- run `sudo apt-get install uex_15.1.0.8_amd64` – AhmedWas Apr 21 '16 at 08:46
  • 1
    Why not install with `dpkg -i`? – fkraiem Apr 21 '16 at 08:48
  • What package are you trying to install? `uex` isn't in Debian. Are you trying to use a third-party repository? What is the output of `apt-cache policy`? – Faheem Mitha Apr 21 '16 at 08:49
  • @fkraiem That would only work if there are no additional dependencies which need to be installed. – Faheem Mitha Apr 21 '16 at 08:50
  • 1
    @FaheemMitha Dependencies can be installed manually beforehand. – fkraiem Apr 21 '16 at 08:51
  • @fkraiem Certainly, if you know what they are. I think this is what `apt-offline` is designed to automate. – Faheem Mitha Apr 21 '16 at 08:52
  • @FaheemMitha `dpkg` tells you what they are when you try to install the package. – fkraiem Apr 21 '16 at 08:53
  • @FaheemMitha It seems that `apt-offline` is mostly designed to manage a system which is completely offline, especially regarding upgrades, not really for installing a single package. – fkraiem Apr 21 '16 at 08:55
  • @fkraiem Yes, `apt-offline` is. But it isn't clear from the poster's question whether his system is offline or not. If it isn't, why doesn't he just use `apt` directly? – Faheem Mitha Apr 21 '16 at 09:09

1 Answers1

3

You can do this in two separate steps:

  1. Install the package with dpkg.

    sudo dpkg -i packagename.deb
    
  2. That created missing dependencies. apt-get can fix missing dependencies automatically.

    sudo apt-get -f install
    

    That should also automatically finish configuring the original package. (So you will not likely need to run sudo dpkg --configure -a yourself.)

Why apt-get Won't Do This

apt-get checks your configured software sources (repositories) and automatically downloads and installs packages. Except in the case where a configured repository is inaccessible, this does not enable an apt-get install command to succeed that would not otherwise succeed. If the package isn't in one of your repositories, apt-get will not know to install it even if the .deb file happens to be in /var/cache/apt/archives.

Rahul
  • 13,309
  • 3
  • 43
  • 54