3

Here is the problem:

I have copied a repository from a friend but, the repository was not complete. Also is out of date. So,

  1. How can I update this repo?
  2. How can I download just the packages that are missing?

I was reading about apt-mirror, and I think I could mount(bind) the folder where the old/incomplete repo is to the folder used by apt-mirror to put the downloaded files/packages, but ... I don'k know is this will break completely the old repo.

There are a correct way to do this?

andrew.46
  • 38,003
  • 27
  • 156
  • 232

3 Answers3

1

Use rsync as explained here- The great thing about rsync is it will grab EVERY file that is in those archives that don't match what you already have and you haven't specifically excluded. The problem is that because it does not discriminate for you, you will have to exclude what you don't want yourself. I recommend allocating a terabyte of storage to be safe as the more versions come available, the more space you will need. You will also need a high speed data connection due to the likely large quantity of data that will need to be transferred. I don't know how much of it you already have in your incomplete repository. If it's mostly complete that will reduce transfer time significantly.

You might wish to consider why your friend provided you with a partial repository. Perhaps the full mirror requires more storage than your friend (or you?) have available. This could have been done rather easily with use of the rsync --exclude switch as covered here. Due to the large and ever increasing storage needs you may wish to consider whether a full mirror is what you truly want. For instance you may want to exclude certain releases, architectures or sections if you have no use for them (precise is currently still in support but if you don't use it, you don't need it).

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
  • as you say rsync doesn't discriminate , so your copy could include historical versions , could follow links to another host or find other non repo content on that hosts. Something else to consider is that rsync might not be as polite (by defalult) in its use of bandwidth from the source whereas apt-mirror will be. – Amias Oct 05 '16 at 10:58
  • @Amias Everything I've read about apt-mirror indicates that it suffers the same limitations as rsync and does not appear to be any more discriminant that rsync. Can you elaborate on the benefits of apt-mirror over rsync ? – Elder Geek Oct 05 '16 at 14:03
1

you are right apt-mirror is the right tool to use for this job

there is a guide here https://www.packtpub.com/books/content/create-local-ubuntu-repository-using-apt-mirror-and-apt-cacher

You should be able to just point apt-mirror at your existing copy and it will continue and fetch the rest.

The config file for apt-mirror should be /etc/apt/mirror.list

You need to adjust either the 'set base_path' or 'set mirror_path' to point at the directory where you incomplete mirror lives.

If you set base_path you will need to ensure the other config variables that use it as a base will still make sense.

If you set mirror_path you can just point it at the folder without altering other aspects of the config.

Once you have set the config run apt-mirror to complete the mirror

Amias
  • 5,246
0

1.There's a directory, /etc/apt/sources.list.dthat contains individual entries for each PPA you've added with add-apt-repository. Those are the files you need to back up.

2.Many people find it easier to back up and restore a single file rather than dealing with a directory of files . If you are like this, and you do not care about having each PPA stored in its own file inside of/etc/apt/sources.list.d/, you can use the following command to store all of your added repositories in a single file called sources.listlocated in your home directory.

 cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list > ~/sources.list

You could then move this file to/etc/apt/sources.list and do

  sudo apt-get update 

to re-add the repositories. If you are planning to use this backup on another computer, make sure that the version of Ubuntu on the machine matches the versions in the sources.list file, otherwise, you might have some problems.

Another way of backing up repositories is:

3.Use y-ppa-manager or you could use apt-clone to do that.

enter image description here

minigeek
  • 1,071