Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The default directory of sources.list is /etc/apt and when we call apt-get update system store package information in /var/lib/apt and synaptic or package manager read information from there. suppose i have some packages already downloaded in hard disk. so if read package info (sources.list) from desktop and add package information in another directory then i can use synaptic or apt to safely install packages and then restore again sources.list directory.

Procedure will be like this :

  1. Have packages in desktop with sources.list information of packages directory (anywhere)
  2. change default directory to desktop
  3. synaptic or apt will read from desktop and save information in another place
  4. install packages
  5. restore back previous directory information
share|improve this question
up vote 2 down vote accepted

With a command line like the following

sudo apt-get -o Dir::Etc=/path/to/other/dir update
share|improve this answer
thanks enzotib. This is one of the answer of my question. Do you know how to change update's output (/var/lib/apt) directory? – shantanu Jul 24 '11 at 19:38
@shantanu: It should be -o Dir::State=/other/var/lib/apt/, as you can see in the output of apt-config dump – enzotib Jul 24 '11 at 20:30

Why exactly do you want to do this? Often, it's also possible to download individual packages from a repository and install them separately, and if they are a lot of packages, you might not want to do it as it might break your system (the fact that you want to remove the sources again hints at this).

What you might do for now is to first backup your sources.list file, then edit the file, install the packages, and then restore the backup.

However, I would strongly advise you to use the Software Sources application to add additional repositories. Then, when you want to disable those sources, you can just uncheck them, without losing track of where you installed applications from.

share|improve this answer
thanks for reply. Actually i want to separate packages in folder or new packages with dependency. But now question is how to install package more safely? if i read package information from local disk using dpkgscanpackaes and apt-get update then it is safe. If there are any dependency error then system will automatically detect and prevent to install.sources.list is not a big problem but apt-get update dir (/var/lib/apt) is a problem. if i just add my new rep and delete others then my previous packages information will be lost. if uncheck then less updated pck will not to be installed. – shantanu Jul 24 '11 at 19:47
@Vincent this doesn't really answer the question. Maybe you can shorten it so that I can convert it into a comment – Stefano Palazzo Jul 24 '11 at 19:55
@Stefano Often, when someone asks a question, it's not the actual question that he's asking. For example, someone wants to do A, but supposes that to solve A, B would help. When he then gets stuck on B, he might ask for help on that, whereas B might be the completely wrong thing to do when A is the actual goal. That's why I was trying to find out what A was, and answer that, as I think that would be more helpful than letting someone do B and then ruining his computer. – Vincent Jul 24 '11 at 23:01

Your Answer


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.