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

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?

3

1 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.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like