{"id":733,"date":"2010-02-07T12:51:20","date_gmt":"2010-02-07T17:51:20","guid":{"rendered":"http:\/\/sahd.lamafam.org\/?p=733"},"modified":"2010-02-07T12:55:50","modified_gmt":"2010-02-07T17:55:50","slug":"apt-mirror-update","status":"publish","type":"post","link":"https:\/\/sahd.lamafam.org\/?p=733","title":{"rendered":"apt-mirror Update"},"content":{"rendered":"<p>The download took all night.  It ended a little after 7 this morning, which pegs   it at about 14 hours to download 65GB.  My internet connection is a 10Mbit cable   line, so there&#8217;s a bench mark of sorts.<\/p>\n<p>When I embarked on this little project, my goal was to come up with a way to   force apt-cacher-ng to update all of its cache on a schedule.  For the native   machine\/architecture all that is required is to schedule an <code>apt-get update<\/code>   which can be done by enabling it in the apt config files.  But I couldn&#8217;t figure out   how to force the same thing for a foreign architecture (ie- for another computer   running i386 based stuff) so the files would already exist on the network.<\/p>\n<p>The more I thought about it, I realized there wasn&#8217;t any bandwidth savings to be   had because, though both machines run <code>debian\/testing<\/code>, they both required   different sets of package files because of the different architectures.   Therefore, anything I was doing was going to be for creating a more convenient   update process by having the files already present on the local network.  The   <code>apt-mirror<\/code> package isn&#8217;t ideal since it downloads an entire repository for a   debian branch rather than caching and updating just the packages I need.   However, it&#8217;s better than a full-blown mirror and, once it&#8217;s initially setup,   the downloading is merely a matter of updating the local repository.  In the   end, it seemed like the best compromise.<\/p>\n<p><!--more--><\/p>\n<p>For documentation purposes, here&#8217;s the <code>mirror.list<\/code> config file:<\/p>\n<pre><code>deb http:\/\/ftp.us.debian.org\/debian\/ testing main contrib non-free\ndeb-src http:\/\/ftp.us.debian.org\/debian\/ testing main contrib non-free\ndeb http:\/\/security.us.debian.org\/ testing\/updates main\ndeb-src http:\/\/security.us.debian.org\/ testing\/updates main\ndeb http:\/\/deb.opera.com\/opera\/ testing non-free\ndeb-amd64 http:\/\/ftp.us.debian.org\/debian\/ testing main contrib non-free\ndeb-amd64 http:\/\/security.us.debian.org\/ testing\/updates main\ndeb-amd64 http:\/\/deb.opera.com\/opera\/ testing non-free\n<\/code><\/pre>\n<p>The <code>deb-amd64<\/code> is how the different architectures to mirror are specified.   That sort of nugget isn&#8217;t documented or explained at all.  I found help from   <a href=\"http:\/\/blog.loftninjas.org\/2008\/01\/10\/apt-mirror-with-mutliple-architectures-on-debian-etch\/\">this guy<\/a>   and also spent a little time looking at the source code to verify.  For good   measure, <a href=\"http:\/\/www.howtoforge.com\/local_debian_ubuntu_mirror\">here&#8217;s another<\/a>   pretty good explanation.<\/p>\n<p>With the config file squared away, here&#8217;s the magic command to run (as root):<\/p>\n<pre><code>su apt-mirror -c apt-mirror\n<\/code><\/pre>\n<p>I didn&#8217;t make any other changes to <code>mirror.list<\/code> so the directory tree is built   under <code>\/var\/spool\/apt-mirror\/mirror<\/code>.  When the command completed, I got a   bunch of, apparently, harmless error messages.  It&#8217;ll also specify if there is   any cleanup to do and lists the command to run to achieve it.<\/p>\n<p>From here, I had to modify my <code>sources.list<\/code> to point at <code>localhost<\/code> instead of   the url locations.  For instance, the line <code>deb http:\/\/ftp.us.debian.org\/debian\/ testing main contrib non-free<\/code> became <code>deb http:\/\/localhost\/debian\/ testing main contrib non-free<\/code>.  I already had <code>apache<\/code> running so I just had to add a   symbolic link from my document root to the directory tree.  Like so:<\/p>\n<pre><code>ln -s \/var\/spool\/apt-mirror\/mirror\/ftp.us.debian.org\/debian\/ \/var\/www\/debian\n<\/code><\/pre>\n<p>I used the same technique for the opera and security repositories.<\/p>\n<p>From here, I tested it out and aptitude found everything to its liking.  So my   server is good to go.  I&#8217;ll just have to point my EEE&#8217;s <code>sources.list<\/code> at the server   for the next step.  Hopefully no issues there.<\/p>\n<p>The last config step I took was to setup a cron job that runs apt-mirror daily.   Fortunately, that was taken care of during the install and I just had to enable   it in the <code>\/etc\/cron.d\/apt-mirror<\/code> file.  I changed the time to something in the   early morning when the system is unlikely to be in use.  I also adjusted my   cron.daily job appropriately to minimize the opportunity for conflicts.<\/p>\n<p>Now, the real test will be using it over an extended period of time.  I&#8217;ll also   remove apt-cacher-ng since I don&#8217;t need it anymore.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The download took all night. It ended a little after 7 this morning, which pegs it at about 14 hours to download 65GB. My internet connection is a 10Mbit cable line, so there&#8217;s a bench mark of sorts. When I embarked on this little project, my goal was to come up with a way to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[45,10],"class_list":["post-733","post","type-post","status-publish","format-standard","hentry","category-computers","tag-apt","tag-debian"],"_links":{"self":[{"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=\/wp\/v2\/posts\/733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=733"}],"version-history":[{"count":3,"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=\/wp\/v2\/posts\/733\/revisions"}],"predecessor-version":[{"id":736,"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=\/wp\/v2\/posts\/733\/revisions\/736"}],"wp:attachment":[{"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}