Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

There is a utility called y-ppa-manager https://launchpad.net/y-ppa-manager which helps to manage your ppa repositories in ubuntu. One of its best features is to backup your repository list. Is there any command line or graphical tool to backup your repositories without installing any ppa tool?

share|improve this question

3 Answers 3

up vote 3 down vote accepted
tar czf apt-sources.tar.gz /etc/apt/sources.list*
share|improve this answer
    
simple as it could be, thanks, and also thanks @calmpitbull for his answer –  zurdo Jan 31 '12 at 2:20
    
What about all the gpg keys, can they be backed up too? Or does ubuntu fetch them after re-install? –  marto Mar 26 '12 at 14:48
    
@marto, they are part of the base install. You wouldn't be able to fetch anything without them. –  psusi Mar 26 '12 at 14:49
    
why back up the official list then? Isn't this post about added 3rd party ppa's? –  marto Mar 26 '12 at 14:58
1  
@marto, ahh, yes, PPAs have their own keys. I'm not sure about how to back those up. –  psusi Mar 26 '12 at 18:17

You can do it like this:

  1. Open Terminal
  2. cd /etc/apt
  3. gksudo gedit sources.list
  4. Copy and paste it to wherever you like.

or

  1. Open Terminal
  2. sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
share|improve this answer
    
does it also backup the repositories from sources.list.d folder? –  zurdo Jan 30 '12 at 22:22

There is a folder called sources.list.d and a file called sources.list both need to be backed up, found in /etc/apt

I just navigated there using Nautilus and dragged them to my desktop.

To restore I opened Nautilus as admin: in terminal GKSU Nautilus and drag back in to the same folder.

Then in terminal: sudo apt-get update

There may be a better way, but I am not big on terminal commands.

1. Open Terminal
2. sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
3. sudo cp /etc/apt/sources.list.d /etc/apt/sources.list.d.backup

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.