Monday, March 25, 2013

Remove local Ubuntu repositories

Ubuntu package manager suggests local repositories for those who live outside of United States in order to have low latency. For instance, I live in Colombia so the main repository where updates are checked is in a repository located in Colombia. Good in theory but not so good in practice because, in my particular case, that repository causes that the "apt-get update" command  execution be aborted. 
In order to change your default repositories go to "Software Sources" and select either "United State Servers" or "Main Servers". 

Installing Ubuntu packages [offline mode]

When repetitive deployment tasks are run, to download the required packages just once and installing them on different deployments is an excellent option for saving time.

When the following command is executed:
sudo apt-get -d -o=dir::cache=/tmp install {some-package-name}
It downloads the required package with its corresponding dependencies. 

Later when the downloaded package needs to be installed, the following command should be executed:
sudo apt-get -o=dir::cache=/tmp install {some-package-name}
It installs the required package using the files located at /tmp directory. 

Note these commands differ only by the presence/absence of the "-d" flag.