I need to install multiple deb files of same software from apt cache in another ubuntu installation.

For example, I have all deb files of vlc in same folder(/var/cache/apt/archives). I need to install vlc with all dependencies satisfied. I cannot install it using dpkg -i vlc* because of dependencies.

Is there a solution to this. I have many software packgaes in my cache which I dont want to download again. Please help..


Indeed you have many solutions:

  • Copy all .deb files from /var/cache/apt/archives to the new pc to the directory /var/cache/apt/archives, or just copy the .deb of vlc dependencies only instead of copying all those debs. you can know the dependencies of vlc by command apt-cache rdepends vlc. Now once you have those debs in the /var/cache/apt/archives of the second system then you can run sudo apt-get update then sudo apt-get install vlc.

BUT this only works if the two systems have same OS version and same package version with same updates.more info

  • Another solution which is better is to make your own repository so you can install any application you want without fearing of dependencies hell when offline installation. take a look: https://askubuntu.com/a/648969/150504
| improve this answer | |

Answering your question:

copy ALL of the debs from /var/cache/apt/archives to the new machine's /var/cache/apt/archives, then simply sudo apt-get update ; sudo apt-get install vlc as normal - it will pick up the .debs in the archive and install without downloading.

Going a step further: install apt-cacher-ng instead

On the first machine, do sudo apt-get install apt-cacher-ng. Then do sudo nano /etc/apt/apt.conf and insert the string Acquire::http::Proxy ""; - this tells the machine to use the apt-cacher-ng instance on itself when it updates. Now, import your existing cached debs - sudo cp -a /var/cache/apt/archives/* /var/cache/apt-cacher-ng/_import/, then open your browser to http://localhost:3142/acng-report.html, scroll down, and click Start Import. Once that's done, do a quick sudo apt-get update - and, whew! You've now got apt-cacher-ng running on your host machine, and every time your host machine downloads updates, it will cache them for both itself and any other machine on your network.

Finally, on your second machine, sudo nano /etc/apt/apt.conf and insert the string Acquire::http::Proxy "http://first.machine.ip.address:3142/"; where first.machine.ip.address is the IP address of the machine you installed apt-cacher-ng on in the paragraph above - now, when you download updates on either machine, it will update the apt-cacher-ng on the first machine, and you won't have to download them again. Very, very slick and easy once it's set up.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.