How can I create the smallest possible mirror of the archive?

Using apt-mirror Install apt-mirror you can get it down to only 7.5 GiB.

You can comment out the source, updates, security, universe and multiverse repositories in its config file, /etc/apt/mirror.list This leaves you only with the contents of main. As main contains everything that is shipped on the different CD images, it should be enough to get you installed. It might not be the smallest solution, but it's probably the simplest.


This answer provides to way of doing what you are asking. https://askubuntu.com/a/154580/1110324

local repository method.

There is a lot more easier method than using AptOnCD. Though I have included AptOnCD method as the question talked about that. Copy all .deb files into the target computer

You need to copy all .deb files you download from /var/cache/apt/archives folder to a suitable folder in your target Internetless computer. I recommend you to copy all the files in a folder named debs which itself resides in a folder named LocalRepo. Meaning, .deb files are in LocalRepo/debs folder. You can put the LocalRepo folder wherever you wish. Let say, for example, I have put it in my home directory i.e. /home/anwar.

So, the folder structure is like below:

-/
 -/home
   -/anwar
    -/LocalRepo
     -/debs

where debs folder contains all the deb files you downloaded.

Generate packages index file

Open a terminal and go to the folder just above the Debs folder. In this example, it is /home/anwar/LocalRepo.

Run this command: while you are in LocalRepo folder. apt-ftparchive packages . > Packages It will create a Packages file in the LocalRepo directory.

Add your local repository in the repository source list

Open /etc/apt/sources.list file with root privilege sudo gedit /etc/apt/sources.list.

At the top of sources.list file, put a line like this.

`deb file:/home/anwar/LocalRepo /`

replace /home/anwar/LocalRepo with actual directory name where you put the LocalRepo folder.

Save the file, and exit gedit.

Update package indexes to be able to install from Local repo

Run sudo apt-get update in a terminal, It will create a repository source list about available repositories. So, your newly created Local Repository will be recognized.

Install packages from local repository.

Then run `sudo apt-get install package-name`
(replacing package-name with actual package) to install your desired repository.

Note: You will always be warned about being your repository is not "Authenticated" one. In this case you can ignore such warning, since you created repository from packages of "Authenticated" sources, meaning Official Ubuntu Package archive.

You can override this warning by putting --allow-unauthenticated switch in the command. such as

sudo apt-get install --allow-unauthenticated package-name

Creating a trusted repository instead:

If you want to create a trusted local repository, You should read this. It is very simple and very good one about the topic

Edit: I found that when sharing the repro using the steps above, I needed to pass -o Acquire::AllowInsecureRepositories=true the the apt commands to get it to work.