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?

Tim
  • 32,861
  • 27
  • 118
  • 178

1 Answers1

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

Ian
  • 675
  • Good answer :) Explaining how to then install these .deb file from command line or GUI would make it even better! – Tim Apr 25 '15 at 15:29
  • @Ian Lantzy please give me an example.. :) – Roy Emmarson Apr 25 '15 at 15:32
  • Alright give me a minute let me take some screenshots... – Ian Apr 25 '15 at 15:36
  • 1
    @IanLantzy Lovely to see a new user with a good answer! +1, and more if I could! – Tim Apr 25 '15 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 '15 at 16:08
  • @IanLantzy Thanks for helping me out. I really appreciate it. I just can't upvote you as my reputation is not high. I would request you to upvote my question so that in future I can appreciate anyone for helping me or for making an useful question/answer to anyone. – Roy Emmarson Apr 26 '15 at 14:18