You do not have Internet? Learn how to take your repositories home

Image taken from Deviantart

When I had a computer at home, I used GNU / Linux without any problem even without having internet to use the repositories.

What I did was take a copy of the packages installed on my work computer and install / update them at home. There are several applications and variants to do this, I will show you some.

aptOnCD

Ideal for users of Ubuntu. With APTOnCD we will take all the packages that we have in the cache APT in a . Iso without any complications. To install it:

$ sudo aptitude install aptoncd

To use it, we simply run the application and do what it tells us step by step. Nothing complicated.

Advantages:

  • You can take your repository in an .iso (or several, depending on the size) Wherever you want you to go You can create iso in CD y DVD.
  • You can unzip the .iso and copy everything inside to a folder, and update from there.
  • APTOnCD detects when you have new packages and adds them discarding the old ones.

Disadvantages:

  • If you do not have CD-RW o DVD-RW you will have a waste of money if you are one of those who likes to update daily, although you can have as an alternative point 2 of the advantages.
  • If you use apt pinning with several branches (Testing, Sid, Experimental), it may give you some errors when installing dependencies.

apt-move:

This alternative is ideal for debian-squeeze. In Debian Testing I had some problems because I did not copy the packages to the destination folder.

To install it:

$ sudo aptitude install apt-move

Configuration:

All options apt-move can be consulted in its manual (man apt-move). Its configuration is in /etc/apt-move.conf and we must modify some things in it, for this we open our favorite editor that file:

$ sudo nano /etc/apt-move.conf

And we must take into account the following lines, which are the only ones that we must modify:

# Establecemos la carpeta donde se creará el mirror que nos llevaremos a casa.
LOCALDIR=/home/usuario/carpeta_mirror

# Ponemos la distribución que usamos para nuestro mirror
DIST=squeeze

# Si lo ponemos en Yes, borrará los paquetes antiguos que se bajan a la caché
DELETE=no

# Si lo ponemos en NO, moverá los paquetes a nuestra carpeta mirror y los elimina de la caché
COPYONLY=yes

This is more than enough in the settings.

Use:

As simple as running:

$ sudo aptitude update && aptitude upgrade && apt-move update

This will copy us, for the folder we have chosen, all the packages from our cache

Advantages:

  • Create the exact structure of a mirror with the packages we have in cache.
  • It groups the Main and Contrib branches only in Main, so when adding the address to the source.list, we only have to put main non-free.
  • If we have apt-pinning, we can download each branch independently.

Disadvantages:

  • So far I have not found any.

Using dpkg-scanpackages

Note: This is something like using APTOnCD

The function of this tool is to create a mini repo that you can easily transport and include in the sources.list, from the downloaded files or those that you include on your own.

The operating mode is as follows: First install dpkg-dev

$ sudo apt-get install dpkg-dev

Copy the files from the apt cache to the folder that you find selected to work, suppose it is called repo and is located in / home / user / repo /.

cp /var/cache/apt/archives/*.deb /home/usuario/repo/

You can also include the .deb what you wish.

Now we go to our folder: repo (in this case).

cd /home/usuario/repo

and we execute:

dpkg-scanpackages repo /dev/null | gzip > repo/Packages.gz

What we are doing here is reading all the packages that are in / home / user / repo / and the file is created packages.gz with this information; Depending on the number of packages, it will be the time to finish the process.

To start working with the new mini-repo created, the next step would be to add it to the sources.list, this is achieved by following these steps:

With our text editor (this case nano):

nano /etc/apt/sources.list

We add the following line:

deb file:/home/usuario repo/

It is important to highlight, to take into account, that after file, the colon (:) and then a single slash (/) are put in it, also that after the last folder, in this case Desktop, there is no slash, it takes a space and then the mini-repo folder (repo) with a slash at the end.

With these steps, we have created a mini-repo ready to transport.