Sunteți pe pagina 1din 1

apt Configuration to Use Local Linux Repository (Ubuntu Mirror)

Have you ever been in a situation trying to update your ubuntu or trying to install some package from
the ubuntu repository and it takes a lot of time, of course due to bad internet connection. From now on
it wont take that much time, You can update and install packages with speed more than 5MB/s. We
have a local repository for Ubuntu, and yes it works for Ubuntu derived distros like Linux Mint,
Elementary OS, Kali Linux etc (the derived distros should be derived from Ubuntu 14.x or 16.x as local
repository supports only LTS 14 and 16). You can configure your package manager (apt) to use the
local repository:

1. Firstly to be safe, copy the sources.list file (stores information about the repositories the package
manager i.e. apt uses), execute the following command to copy it to your home directory.
cp /etc/apt/sources.list ~/

2. Now open /etc/apt/sources.list file with root access.


sudo gedit /etc/apt/sources.list

3. Now you will find something like


deb http://in.archive.ubuntu.com/ubuntu/ xenial multiverse

4. To use the local repository replace http://in.archive.ubuntu.com/ubuntu/ with


http://172.16.3.168:8090/repos/Ubuntu/ .

5. Ubuntu has categorized its packages into four - main, multiverse, universe, and restricted of
which we are (as of now) not providing support for universe packages. So, if you encounter a line
which is of the format deb mirror_url distro_version_name universe, dont replace mirror_url
with http://172.16.3.168:8090/repos/Ubuntu/ .
Examples:
deb http://in.archive.ubuntu.com/ubuntu/ xenial universe
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates universe
deb http://in.archive.ubuntu.com/ubuntu/ xenial-security universe
Leave it as it is.

6. In some cases you may find more than one categories including universe, like
deb http://in.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
For this case change it to .
deb http://in.archive.ubuntu.com/ubuntu/ xenial-backports universe
deb http://172.16.3.168:8090/repos/Ubuntu/ xenial-backports main restricted multiverse
This way apt downloads universe packages from the official repository, and rest of the packages from
local repository.

7. Now save this file, quit gedit, and enter the following command.
sudo apt-get update

Thats it :)

PS: IN CASE YOU MESS YOUR /etc/apt/sources.list WHILE EDITING, YOU CAN ALWAYS
COPY YOUR BACKED UP FILE FROM HOME FOLDER, using
sudo cp ~/sources.list /etc/apt/sources.list

S-ar putea să vă placă și