{"id":13875,"date":"2019-04-06T12:51:46","date_gmt":"2019-04-06T12:51:46","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=13875"},"modified":"2019-04-06T12:51:46","modified_gmt":"2019-04-06T12:51:46","slug":"setup-local-repositories-with-apt-mirror-in-ubuntu-and-debian-systems","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/06\/setup-local-repositories-with-apt-mirror-in-ubuntu-and-debian-systems\/","title":{"rendered":"Setup Local Repositories with \u2018apt-mirror\u2019 in Ubuntu and Debian Systems"},"content":{"rendered":"<p>When today traffic and casual internet speeds is measured in teens of Giga over an eye blink even for ordinary Internet clients, what\u2019s the purpose of setting a local repository cache on LAN\u2019s you may ask?<\/p>\n<div id=\"attachment_6949\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repositories-in-Ubuntu.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-6949\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repositories-in-Ubuntu.jpg\" alt=\"Setup Local Repositories in Ubuntu\" width=\"600\" height=\"338\" aria-describedby=\"caption-attachment-6949\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6949\" class=\"wp-caption-text\">Setup Local Repositories in Ubuntu<\/p>\n<\/div>\n<p>One of the reasons is to reduce Internet bandwidth and high speed on pulling packages from local cache. But, also, another major reason should be privacy. Let\u2019s imagine that clients from your organization are Internet restricted, but their Linux boxes need to regular system updates on software and security or just need new software packages. To go further picture, a server that runs on a private network, contains and serves secret sensitive information only for a restricted network segment, and should never be exposed to public Internet.<\/p>\n<p>This are just a few reasons why you should build a local repository mirror on your LAN, delegate an edge server for this job and configure internal clients to pull out software form its cache mirror.<\/p>\n<p>Ubuntu provides\u00a0<b>apt-mirror<\/b>\u00a0package to synchronize local cache with official Ubuntu repositories, mirror that can be configured through a\u00a0<b>HTTP<\/b>\u00a0or\u00a0<b>FTP<\/b>\u00a0server to share its software packages with local system clients.<\/p>\n<p>For a complete mirror cache your server needs at least\u00a0<b>120G<\/b>\u00a0free space reserved for local repositories.<\/p>\n<h4>Requirements<\/h4>\n<ol>\n<li>Min 120G free space<\/li>\n<li>Proftpd server installed and configured in anonymous mode.<\/li>\n<\/ol>\n<h3>Step 1: Configure Server<\/h3>\n<p><strong>1.<\/strong>\u00a0The first thing you may want to do is to identify the closest and fastest Ubuntu mirrors near you\u2019re location by visiting\u00a0<a href=\"https:\/\/launchpad.net\/ubuntu\/+archivemirrors\" target=\"_blank\" rel=\"noopener\">Ubuntu Archive Mirror<\/a>\u00a0page and select your\u00a0<b>country<\/b>.<\/p>\n<div id=\"attachment_6932\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6932\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-01-620x293.png\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-01-620x293.png 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-01.png 929w\" alt=\"Ubuntu Archive Mirror \" width=\"620\" height=\"293\" aria-describedby=\"caption-attachment-6932\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6932\" class=\"wp-caption-text\">Ubuntu Archive Mirror<\/p>\n<\/div>\n<p>If your country provides more mirrors you should identify mirror address and do some tests based on\u00a0<b>ping<\/b>\u00a0or\u00a0<b>traceroute<\/b>\u00a0results.<\/p>\n<div id=\"attachment_6934\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6934\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-02-620x336.png\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-02-620x336.png 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-02.png 753w\" alt=\"Select Mirror Location\" width=\"620\" height=\"336\" aria-describedby=\"caption-attachment-6934\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6934\" class=\"wp-caption-text\">Select Mirror Location<\/p>\n<\/div>\n<p><strong>2.<\/strong>\u00a0The next step is to install required software for setting up local mirror repository. Install\u00a0<b>apt-mirror<\/b>\u00a0and\u00a0<b>proftpd<\/b>\u00a0packages and configure proftpd as standalone system daemon.<\/p>\n<pre>$ sudo apt-get install apt-mirror proftpd-basic<\/pre>\n<div id=\"attachment_6935\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-03.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6935\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-03-620x320.jpg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-03-620x320.jpg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-03-1024x528.jpg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-03.jpg 1067w\" alt=\"Install apt-mirror Proftpd\" width=\"620\" height=\"320\" aria-describedby=\"caption-attachment-6935\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6935\" class=\"wp-caption-text\">Install apt-mirror Proftpd<\/p>\n<\/div>\n<div id=\"attachment_6936\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-04.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6936\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-04-620x282.jpg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-04-620x282.jpg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-04-1024x467.jpg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-04.jpg 1067w\" alt=\"ProFTPD Configuration\" width=\"620\" height=\"282\" aria-describedby=\"caption-attachment-6936\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6936\" class=\"wp-caption-text\">ProFTPD Configuration<\/p>\n<\/div>\n<p><strong>3.<\/strong>\u00a0Now it\u2019s time to configure\u00a0<b>apt-mirror<\/b>\u00a0server. Open and edit\u00a0<b>\/etc\/apt\/mirror.list<\/b>\u00a0file by adding your nearest locations (<b>Step 1<\/b>) \u2013 optional, if default mirrors are fast enough or you\u2019re not in a hurry \u2013 and choose your system path where packages should be downloaded. By default\u00a0<b>apt-mirror<\/b>\u00a0uses\u00a0<b>\/var\/spool\/apt-mirror<\/b>\u00a0location for local cache but on this tutorial we are going to use change system path and point\u00a0<b>set base_path<\/b>\u00a0directive to\u00a0<b>\/opt\/apt-mirror<\/b>\u00a0location.<\/p>\n<pre>$ sudo nano \/etc\/apt\/mirror.list<\/pre>\n<div id=\"attachment_6937\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-05.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6937\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-05-600x450.jpg\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-05-600x450.jpg 600w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-05-1024x767.jpg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-05.jpg 1067w\" alt=\"Configure apt-mirror Server.\" width=\"600\" height=\"450\" aria-describedby=\"caption-attachment-6937\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6937\" class=\"wp-caption-text\">Configure apt-mirror Server.<\/p>\n<\/div>\n<p>Also you can uncomment or add other source list before clean directive \u2013 including\u00a0<b>Debian<\/b>\u00a0sources \u2013 depending on what\u00a0<b>Ubuntu<\/b>\u00a0versions your clients use. You can add sources from\u00a0<b>12.04<\/b>, if you like but be aware that adding more sources requires more free space.<\/p>\n<p>For\u00a0<b>Debian<\/b>\u00a0source lists visit\u00a0<a href=\"https:\/\/wiki.debian.org\/SourcesList\" target=\"_blank\" rel=\"noopener\">Debian Wiki<\/a>\u00a0or\u00a0<a href=\"http:\/\/debgen.simplylinux.ch\/\" target=\"_blank\" rel=\"noopener\">Debian Sources<\/a>\u00a0List Generator.<\/p>\n<p><strong>4.<\/strong>\u00a0All you need to do now is, just create path directory and run\u00a0<b>apt-mirror<\/b>\u00a0command to synchronize official\u00a0<b>Ubuntu<\/b>\u00a0repositories with our local mirror.<\/p>\n<pre>$ sudo mkdir -p \/opt\/apt-mirror\r\n$ sudo apt-mirror<\/pre>\n<div id=\"attachment_6938\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-06.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6938\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-06-620x318.jpg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-06-620x318.jpg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-06-1024x525.jpg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-06.jpg 1067w\" alt=\"Create apt-mirror Paths\" width=\"620\" height=\"318\" aria-describedby=\"caption-attachment-6938\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6938\" class=\"wp-caption-text\">Create apt-mirror Paths<\/p>\n<\/div>\n<p>As you can see\u00a0<b>apt-mirror<\/b>\u00a0proceeds with indexing and downloading archives presenting total number of downloaded packages and their size. As we can imagine\u00a0<b>110-120 GB<\/b>\u00a0is large enough to take some time to download.<\/p>\n<p>You can run\u00a0<a href=\"https:\/\/www.tecmint.com\/15-basic-ls-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">ls command<\/a>\u00a0to view directory content.<\/p>\n<div id=\"attachment_6939\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-07.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6939\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-07-620x225.png\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-07-620x225.png 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-07.png 879w\" alt=\"Verify apt-mirror Paths\" width=\"620\" height=\"225\" aria-describedby=\"caption-attachment-6939\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6939\" class=\"wp-caption-text\">Verify apt-mirror Paths<\/p>\n<\/div>\n<p>Once the initial download is completed, future downloads will be small.<\/p>\n<p><strong>5.<\/strong>\u00a0While\u00a0<b>apt-mirror<\/b>\u00a0downloads packages, you can configure your\u00a0<b>Proftpd<\/b>\u00a0server. The first thing you need to do is, to create anonymous configuration file for proftpd by running the following command.<\/p>\n<pre>$ sudo nano \/etc\/proftpd\/conf.d\/anonymous.conf<\/pre>\n<p>Then add the following content to\u00a0<b>anonymous.conf<\/b>\u00a0file and restart proftd service.<\/p>\n<pre>&lt;Anonymous ~ftp&gt;\r\n   User                    ftp\r\n   Group                nogroup\r\n   UserAlias         anonymous ftp\r\n   RequireValidShell        off\r\n#   MaxClients                   10\r\n   &lt;Directory *&gt;\r\n     &lt;Limit WRITE&gt;\r\n       DenyAll\r\n     &lt;\/Limit&gt;\r\n   &lt;\/Directory&gt;\r\n &lt;\/Anonymous&gt;<\/pre>\n<div id=\"attachment_6940\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-08.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6940\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-08-600x450.png\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-08-600x450.png 600w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-08.png 800w\" alt=\"Configure ProFTPD\" width=\"600\" height=\"450\" aria-describedby=\"caption-attachment-6940\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6940\" class=\"wp-caption-text\">Configure ProFTPD<\/p>\n<\/div>\n<p><strong>6.<\/strong>\u00a0Next step is to link\u00a0<b>apt-mirror<\/b>\u00a0path to proftpd path by running a bind mount by issuing the command.<\/p>\n<pre>$ sudo mount --bind \/opt\/apt-mirror\/mirror\/archive.ubuntu.com\/  \/srv\/ftp\/<\/pre>\n<div id=\"attachment_6941\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-09.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6941\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-09-620x146.jpg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-09-620x146.jpg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-09-1024x241.jpg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-09.jpg 1067w\" alt=\"Mount apt-mirror to ProFTP Path\" width=\"620\" height=\"146\" aria-describedby=\"caption-attachment-6941\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6941\" class=\"wp-caption-text\">Mount apt-mirror to ProFTP Path<\/p>\n<\/div>\n<p>To verify it run\u00a0<b>mount<\/b>\u00a0command with no parameter or option.<\/p>\n<pre>$ mount<\/pre>\n<div id=\"attachment_6942\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-10.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6942\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-10-620x223.jpg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-10-620x223.jpg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-10-1024x368.jpg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-10.jpg 1067w\" alt=\"Verify Paths\" width=\"620\" height=\"223\" aria-describedby=\"caption-attachment-6942\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6942\" class=\"wp-caption-text\">Verify Paths<\/p>\n<\/div>\n<p><strong>7.<\/strong>\u00a0Last step is to make sure that\u00a0<b>Proftpd<\/b>\u00a0server is automatically started after system\u00a0<b>reboot<\/b>\u00a0and\u00a0<b>mirror-cache<\/b>directory is also automatically mounted on ftp server path. To automatically enable proftpd run the following command.<\/p>\n<pre>$ sudo update-rc.d proftpd enable<\/pre>\n<p>To automatically mount\u00a0<b>apt-mirror<\/b>\u00a0cache on proftpd open and edit\u00a0<b>\/etc\/rc.local<\/b>\u00a0file.<\/p>\n<pre>$ sudo nano \/etc\/rc.local<\/pre>\n<p>Add the following line before\u00a0<b>exit 0<\/b>\u00a0directive. Also use\u00a0<b>5<\/b>\u00a0seconds delay before attempting to mount.<\/p>\n<pre>sleep 5\r\nsudo mount --bind  \/opt\/apt-mirror\/mirror\/archive.ubuntu.com\/ \/srv\/ftp\/<\/pre>\n<div id=\"attachment_6943\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-11.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6943\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-11-600x450.png\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-11-600x450.png 600w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-11.png 800w\" alt=\"Auto Mount Apt Mirrors\" width=\"600\" height=\"450\" aria-describedby=\"caption-attachment-6943\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6943\" class=\"wp-caption-text\">Auto Mount Apt Mirrors<\/p>\n<\/div>\n<p>If you pull packages from\u00a0<b>Debian<\/b>\u00a0repositories run the following commands and make sure appropriate settings for above\u00a0<b>rc.local<\/b>\u00a0file are enabled.<\/p>\n<pre>$ sudo mkdir \/srv\/ftp\/debian\r\n$ sudo mount --bind \/opt\/apt-mirror\/mirror\/ftp.us.debian.org\/debian\/ \/srv\/ftp\/debian\/<\/pre>\n<div id=\"attachment_6944\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-12.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6944\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-12-620x181.png\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-12-620x181.png 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-12.png 873w\" alt=\"Debian Repository Setup\" width=\"620\" height=\"181\" aria-describedby=\"caption-attachment-6944\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6944\" class=\"wp-caption-text\">Debian Repository Setup<\/p>\n<\/div>\n<p><strong>8.<\/strong>\u00a0For a daily\u00a0<b>apt-mirror<\/b>\u00a0synchronization you can also create a system schedule job to run at\u00a0<a>2 AM<\/a>\u00a0every day. Run\u00a0<a href=\"https:\/\/www.tecmint.com\/11-cron-scheduling-task-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">crontab command<\/a>, select your preferred editor then add the following line syntax.<\/p>\n<pre>$ sudo crontab \u2013e<\/pre>\n<div id=\"attachment_6945\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-13.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6945\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-13-620x174.jpg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-13-620x174.jpg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-13-1024x287.jpg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-13.jpg 1067w\" alt=\"Daily apt-mirror Synchronization\" width=\"620\" height=\"174\" aria-describedby=\"caption-attachment-6945\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6945\" class=\"wp-caption-text\">Daily apt-mirror Synchronization<\/p>\n<\/div>\n<p>On last line add the following line.<\/p>\n<pre>0  2  *  *  *  \/usr\/bin\/apt-mirror &gt;&gt; \/opt\/apt-mirror\/mirror\/archive.ubuntu.com\/ubuntu\/apt-mirror.log<\/pre>\n<div id=\"attachment_6946\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-14.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6946\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-14-600x450.png\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-14-600x450.png 600w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-14.png 800w\" alt=\"Add Cron Entry for Synchronization\" width=\"600\" height=\"450\" aria-describedby=\"caption-attachment-6946\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6946\" class=\"wp-caption-text\">Add Cron Entry for Synchronization<\/p>\n<\/div>\n<p>Now every day at\u00a0<b>2 AM<\/b>\u00a0your system repository cache will synchronize with\u00a0<b>Ubuntu<\/b>\u00a0official mirrors and create a log file.<\/p>\n<h3>Step 2: Configure clients<\/h3>\n<p><strong>9.<\/strong>\u00a0To configure local\u00a0<b>Ubuntu<\/b>\u00a0clients, edit\u00a0<b>\/etc\/apt\/source.list<\/b>\u00a0on client computers to point to the IP address or hostname of\u00a0<b>apt-mirror<\/b>\u00a0server \u2013 replace http protocol with ftp, then update system.<\/p>\n<pre>deb ftp:\/\/192.168.1.13\/ubuntu trusty universe\r\ndeb ftp:\/\/192.168.1.13\/ubuntu trusty main restricted\r\ndeb ftp:\/\/192.168.1.13\/ubuntu trusty-updates main restricted\r\n<b>## Ad so on\u2026.<\/b><\/pre>\n<div id=\"attachment_6947\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-15.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6947\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-15-620x376.jpg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-15-620x376.jpg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-15-1024x621.jpg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-15.jpg 1128w\" alt=\"Configure Clients\" width=\"620\" height=\"376\" aria-describedby=\"caption-attachment-6947\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6947\" class=\"wp-caption-text\">Configure Clients<\/p>\n<\/div>\n<p><strong>10.<\/strong>\u00a0To view repositories you can actually open a browser and point to your server IP address of domain name using FTP protocol.<\/p>\n<div id=\"attachment_6948\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-16.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-6948\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-16-620x304.jpg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-16-620x304.jpg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-16-1024x502.jpg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Setup-Local-Repository-16.jpg 1116w\" alt=\"View Local Repositories \" width=\"620\" height=\"304\" aria-describedby=\"caption-attachment-6948\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-6948\" class=\"wp-caption-text\">View Local Repositories<\/p>\n<\/div>\n<p>The same system applies also to\u00a0<b>Debian<\/b>\u00a0clients and servers, the only change needed are\u00a0<b>debian mirror<\/b>\u00a0and\u00a0<b>sources list<\/b>.<\/p>\n<p>Also if you install a fresh\u00a0<b>Ubuntu<\/b>\u00a0or\u00a0<b>Debian<\/b>\u00a0system, provide your local mirror manually whit ftp protocol when installer asks which repository to use.<\/p>\n<p>The great thing about having your own local mirror repositories is that you\u2019re always on current and your local clients don\u2019t have to connect to Internet to install updates or software.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/setup-local-repositories-in-ubuntu\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When today traffic and casual internet speeds is measured in teens of Giga over an eye blink even for ordinary Internet clients, what\u2019s the purpose of setting a local repository cache on LAN\u2019s you may ask? Setup Local Repositories in Ubuntu One of the reasons is to reduce Internet bandwidth and high speed on pulling &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/06\/setup-local-repositories-with-apt-mirror-in-ubuntu-and-debian-systems\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Setup Local Repositories with \u2018apt-mirror\u2019 in Ubuntu and Debian Systems&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13875","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13875","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=13875"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13875\/revisions"}],"predecessor-version":[{"id":13876,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13875\/revisions\/13876"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=13875"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=13875"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=13875"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}