TransWikia.com

How to install some .deb packages from cache with apt?

Ask Ubuntu Asked by Archisman Panigrahi on January 5, 2021

I want to install texlive-full in my Ubuntu 20.04. It is a rather large download, and I have a metered internet connection.

I installed it in another computer running Xubuntu 20.04, and copied the packages from its var/cache/apt.

I can do sudo dpkg -i *.deb, but it will install all the dependencies explicitly (I don’t want to have the dependencies explicitly installed), and it may also install other unwanted packages (because I copied all .deb packages from var/cache/apt).

How can I use apt to install texlive-full, so that it uses these .deb packages for dependencies instead of downloading them?

One Answer

To create a personal repository

Install dpkg-dev, type in a terminal

 sudo apt-get update
 sudo apt-get install dpkg-dev

Create the Script to update your packages directory

It's a simple three liner:

 #! /bin/bash
 cd /var/cache/apt
 dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz

Cut and paste the above into gedit, and save it as update-debs in /bin.

Next, make the script executable:

 sudo chmod u+x /bin/update-debs

How the script works:

dpkg-scanpackages looks at all the packages in /var/cache/apt, and the output is compressed and written to a file Packages.gz, that apt-get update can read

Edited: =========================================================

Create a Ubuntu configuration file for the repository

sudo touch /etc/apt/sources.list.d/mysources.list

Edit the empty file and add this line:

sudo nano /etc/apt/sources.list.d/mysources.list

And add this line:

deb [trusted=yes] file:/var/cache/apt ./

And you're done.

Whenever you put a new deb in the /var/cache/apt directory, run

sudo update-debs
sudo apt-get update

Now your local packages can be manipulated with Synaptic, aptitude and the apt commands: apt-get, apt-cache, etc.

Correct answer by kyodake on January 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP