1

Sometimes I want to install a program when offline. But apt-get downloads as you install.

Is there a way to install a program, like you would install a .exe, on Ubuntu?

5
  • 1
    Yes you can. Instead of a .exe file it is a .deb file.
    – Tim
    Apr 25, 2015 at 15:22
  • @Tim please explain how to do? I am a newbie as mentioned in the original question... Apr 25, 2015 at 15:25
  • @karel askubuntu.com/questions/40779/… may be better
    – Tim
    Apr 25, 2015 at 15:26
  • @Tim I think you missed the target.
    – karel
    Apr 25, 2015 at 15:28
  • @karel he wants ubuntu's exe equivalent?
    – Tim
    Apr 25, 2015 at 15:29

1 Answer 1

2

You can use:

apt-get install -d

To download software and dependencies without installing them. The .deb files (pretty much equivalent to Windows .exe installers), are then downloaded to /var/cache/apt/archives/

Unless you've issued apt-get clean pretty much anything you've ever installed via apt-get should have the .deb files stored there.

Also you can install the .deb files via dpgk -i but you have to remember to install the dependencies (and their dependencies and so on), first. Or you should also just be able to double click a .deb file in your file browser and Software Center should take care of it for you.

For example: I want to install gedit (which is included with Ubuntu normally so it won't download tons of dependency .deb files). But I have a system that, for whatever reason, doesn't have gedit and has no internet connect.

So first, on a computer connected to the internet, I run apt-get install --reinstall -d gedit (because if you try running apt-get install -d gedit on a system with gedit already installed to the latest version it just tells you it is already installed), which then goes through the normal process of downloading the package (in this case there are no dependencies), and then stops.

Running apt-get install --reinstall -d gedit

Then I locate the file under /var/cache/apt/archives/ ...

/var/cache/apt/archives/

... and move it to the computer which needs gedit installed and install it, in this case using the Software Center.

Installing with Software Center

Or I could install it using cd /var/cache/apt/archives and dpkg -i gedit_3.10.4-0ubuntu4_amd64.deb

6
  • Good answer :) Explaining how to then install these .deb file from command line or GUI would make it even better!
    – Tim
    Apr 25, 2015 at 15:29
  • @Ian Lantzy please give me an example.. :) Apr 25, 2015 at 15:32
  • Alright give me a minute let me take some screenshots...
    – Ian
    Apr 25, 2015 at 15:36
  • 1
    @IanLantzy Lovely to see a new user with a good answer! +1, and more if I could!
    – Tim
    Apr 25, 2015 at 16:06
  • 2
    @MikeFriedman there are an infinite number of potential examples that could be used. For instance, I could use nginx and nginx-common and nginx-core or similar as examples if my system needed an offline method to install the NGINX web server. Essentially, it's impossible to create 'one example' that would work everywhere. The tricky part is because of dependencies - a lot of 'regularly used' Desktop programs have a lot of dependencies that you would also have to download.
    – Thomas Ward
    Apr 25, 2015 at 16:08

Not the answer you're looking for? Browse other questions tagged .