Installing a package manually using apt-get

11,134

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.

Share:
11,134

Related videos on Youtube

AhmedWas
Author by

AhmedWas

Updated on September 18, 2022

Comments

  • AhmedWas
    AhmedWas over 1 year

    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.

    • Alen Milakovic
      Alen Milakovic about 8 years
      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.
    • Rahul
      Rahul about 8 years
      Could you please post content of /etc/apt/sources.list file ?
    • AhmedWas
      AhmedWas about 8 years
      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
    • fkraiem
      fkraiem about 8 years
      Why not install with dpkg -i?
    • Alen Milakovic
      Alen Milakovic about 8 years
      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?
    • Alen Milakovic
      Alen Milakovic about 8 years
      @fkraiem That would only work if there are no additional dependencies which need to be installed.
    • fkraiem
      fkraiem about 8 years
      @FaheemMitha Dependencies can be installed manually beforehand.
    • Alen Milakovic
      Alen Milakovic about 8 years
      @fkraiem Certainly, if you know what they are. I think this is what apt-offline is designed to automate.
    • fkraiem
      fkraiem about 8 years
      @FaheemMitha dpkg tells you what they are when you try to install the package.
    • fkraiem
      fkraiem about 8 years
      @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.
    • Alen Milakovic
      Alen Milakovic about 8 years
      @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?