MilesWeb
Leading Web Hosting Provider in India Since 2012.
Award-winning Web Hosting Company
Everything that you need to build, host and manage a website is available at just 99/mo

How to create your own Debian repository

Share on Facebook0Share on Google+0Tweet about this on TwitterShare on LinkedIn0

The repositories are invaluable in any Linux system, especially on those servers where we want to have the latest security updates. The most common thing is that there is no impediment to using these, but what is normal does not imply that it has to happen always, either due to security policies or if the repository is down or that the computer simply does not have access to the Internet. The absence of this resource can be fatal in many cases, so it is good to always have a resource that helps us to avoid such obstacle.

A resource that while in domestic is not very practical, but it is perfectly applicable in business environments or in environments where there are servers. It is better to have these repositories stored in a team so that they can be easily accessed by the rest of the equipment that is within the same network; that is, to have these repositories locally. In this case, we would see a case applied to Debian, but with similar systems such as Ubuntu you should not experience any problems.

The absence of this resource can be fatal in many cases, so it is good to always have a resource that helps us to avoid such obstacle. A resource that while in domestic is not very practical, but it is perfectly applicable in business environments or in environments where there are servers.

It is better to have these repositories stored in a team so that they can be easily accessed by the rest of the equipment that is within the same network; that is, to have these repositories locally. In this case, we would see a case applied to Debian, but with similar systems such as Ubuntu you should not experience any problems.

With its operation, the only “catch” you may have is the fact that you need to have plenty of free space on the hard drive, but removing that detail, can be a really useful solution.

To create this repository, we will need to have two tools installed; one, well known by many, apache2, while the other is much less known, is apt-mirror, so the first thing we will do is, we will be installing the repositories on the system from the official sources.

apt-get install apache2 apt-mirror

Installation is automatic, although installation does not automatically have local repositories. The first thing you need to do is get down all the information, packages and other data repositories that we want locally, although, for it, the first thing you should do is to set the apt-mirror configuration file, which would be in /etc/apt/mirror.list.

The file would consist of three sections: Configuration, repositories to be obtained, repositories to be cleaned. The most important part would be the configuration, since it is the one that determines where to store the repositories, the architecture in which we want the repositories to be downloaded, etc. A real configuration file based on a Debian 8 with AMD64 architecture would be the next:

With this setup, we could unburden the “standard” Debian repositories 8 (mswb) in the directory/var/spool/apt-mirror, within which we have three folders: The mirror folder, the skel folder, and var folder.

With the changes saved, you only would have to run the command:

apt-mirror

This command will create the mirror folders, skel and var are created in the directory/var/spool/apt-mirror and all information repositories are downloaded here. And in saying all would be ALL. In other words, we would be downloading the necessary information so that our team can become a repository.

The size of the downloaded information would vary depending upon the amount of repositories we want to download, but for example, in my particular case, the discharge would be 47 GB. A download that will take a LOT of time. We could also choose fewer repositories in order to be smaller, but at a conceptual level, this would be the process. Imagine that we have downloaded all the content. This would be downloaded, but this would not mean that it was accessible by other computers; Hence the need to have apache2 installed. Right now the /var/spool/apt-mirror/mirror directory would have to have the following structure inside it:

debian repository diagram

We want to be able to access web repositories, as we would with a real repository, but on a local network. So we would have to make that content be accessed from the /var/www folder; move the contents to that folder would be cumbersome and also any future upgrades would be lowered again in the directory/var/spool/apt-mirror, which as clean and practical would be to make a symbolic link to /var /www directories Desired; it would be only in this case the Debian directory which the symbolic link we would do the following:

ln -s /var/spool/apt-mirror/mirror/ftp.debian.org/debian/ /var/www/debian. Now, to access the repositories of this machine, assume that it has the IP 192.168.1.101 to access repositories on the local network here, we would put these lines in the file /etc/apt/sources.list

With this, we could access some repositories that are on the local network without needing to access the Internet.

I hope you have found it useful.

Pravin Ganore

A Journalist Specializing in Blogging, Social Networking and Community Management. As a constant learner, Pravin is always aiming towards new ideas and greater knowledge. When he is not doing research, reading, or writing for blogs, you can find him hanging around social media sites.

One thought on “How to create your own Debian repository

  • January 17, 2017 at 12:00 pm
    Permalink

    Informative Article!!
    It will help me to know about Debian Repository.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *