<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The HyRax Macrocosm &#187; Repository</title>
	<atom:link href="http://www.serenux.com/tag/repository/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.serenux.com</link>
	<description>Life, the Universe and Ubuntu.</description>
	<lastBuildDate>Mon, 21 Jun 2010 10:45:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>HowTo: Migrate an Apt-Mirror-generated Ubuntu archive to another mirror source or merge a foreign Apt-Mirror archive into yours</title>
		<link>http://www.serenux.com/2009/12/howto-migrate-an-apt-mirror-generated-ubuntu-archive-to-another-mirror-source-or-merge-a-foreign-apt-mirror-archive-into-yours/</link>
		<comments>http://www.serenux.com/2009/12/howto-migrate-an-apt-mirror-generated-ubuntu-archive-to-another-mirror-source-or-merge-a-foreign-apt-mirror-archive-into-yours/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 11:39:11 +0000</pubDate>
		<dc:creator>HyRax</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Applications]]></category>
		<category><![CDATA[Apt]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[Storage]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.serenux.com/?p=651</guid>
		<description><![CDATA[So, you&#8217;ve gone and created your very own local Ubuntu mirror using Apt-Mirror, and you&#8217;ve come across a situation similar to: You&#8217;ve decided to change where you update your Apt-Mirror archive from (eg: you&#8217;ve changed ISP&#8217;s or feel that another source is more reliable than your current one to update from) You&#8217;re adding another large [...]]]></description>
			<content:encoded><![CDATA[<p>So, you&#8217;ve gone and <a title="HowTo: Create your own local Ubuntu mirror" href="http://www.serenux.com/2008/10/howto-setup-your-own-local-ubuntu-repository-mirror/" target="_blank">created your very own local Ubuntu mirror using Apt-Mirror</a>, and you&#8217;ve come across a situation similar to:</p>
<ul>
<li>You&#8217;ve decided to change where you update your Apt-Mirror archive from (eg: you&#8217;ve changed ISP&#8217;s or feel that another source is more reliable than your current one to update from)</li>
<li>You&#8217;re adding another large repository to your Apt-Mirror archive (such as the next version of Ubuntu) and don&#8217;t have the quota to download it, so you&#8217;re getting a friend to download it for you from their free server using Apt-Mirror (eg: iiNet and Internode customers can access their respective Ubuntu mirrors for free), so you need to be able to merge it with your own Apt-Mirror archive and have it update from your preferred source afterwards.</li>
</ul>
<p>So how do you do this? Read on.</p>
<p><span id="more-651"></span><span style="color: #0000ff;"><em><strong>Migrating your Apt-Mirror archive to update from a new source<br />
</strong></em></span></p>
<p>This one is really easy. Let&#8217;s say you are updating your Ubuntu mirror from Internode, but now want to get your updates from iiNet. To make this happen you need to change the following files:</p>
<ul>
<li>Your <em>/etc/apt/mirror.list</em> file needs to be updated to point to the new source, and</li>
<li>the Apt-Mirror&#8217;s record of downloaded files needs to be updated so that it doesn&#8217;t waste time trying to re-download the entire mirror again not realising that it&#8217;s already got 99% of all the files already, because Apt-Mirror tracks the files it has downloaded by the source URL and filename, not just the filenames themselves.</li>
</ul>
<p>So let&#8217;s go through this.</p>
<ol>
<li>Open a terminal load your <em>/etc/apt/mirror.list</em> file into your favourite text editor. In this case I will use the Nano text editor:
<pre><span style="color: #000080;">$ sudo nano /etc/apt/mirror.list</span></pre>
</li>
<li>In your <em>mirror.list</em> file, The lines for updating Ubuntu 32 and 64-bit versions plus source code from Internode can look similar to this:
<pre><span style="color: #000080;"># Ubuntu 9.10 Karmic Koala 32-bit
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-updates main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-backports main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-security main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-proposed main restricted universe multiverse

</span><span style="color: #000080;"># Ubuntu 9.10 Karmic Koala 64-bit
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-updates main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-backports main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-security main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-proposed main restricted universe multiverse

# Ubuntu 9.10 Karmic Koala Source
deb-src http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic main restricted universe multiverse
deb-src http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-updates main restricted universe multiverse
deb-src http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-backports main restricted universe multiverse
deb-src http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-security main restricted universe multiverse
deb-src http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-proposed main restricted universe multiverse</span></pre>
</li>
<li>We need to change the Internode URL to the iiNet URL, so bring up Nano&#8217;s search and replace function by pressing CTRL+Backslash (&#8220;\&#8221;).<br />
.</li>
<li>Now type in the text to replace, in this case:
<pre><span style="color: #000080;">http://mirror.internode.on.net/pub/ubuntu/ubuntu</span></pre>
</li>
<li>Press Enter and you&#8217;ll be prompted for the text to replace this with. In this case it&#8217;s:
<pre><span style="color: #000080;">http://ftp.iinet.net.au/pub/ubuntu/</span></pre>
</li>
<li>Press Enter and Nano will find the first occurrence of the Internode text string and highlight it for you. If the selection is correct, press &#8220;A&#8221; on the keyboard to automatically replace &#8220;all&#8221; occurrences.<br />
.</li>
<li>Once the update is done, manually go back and visually verify that all the entries were changed correctly.<br />
.</li>
<li>When you&#8217;re happy, save your changes by pressing CTRL+X, then &#8220;Y&#8221; and then Enter.<br />
.</li>
<li>Now we need to update the Apt-Mirror record of downloaded files. First, let&#8217;s take a backup of the index in case you stuff up. Type in:
<pre><span style="color: #000080;">$ sudo cp /var/spool/apt-mirror/var/ALL /var/spool/apt-mirror/var/ALL_Backup</span></pre>
<p><em>NOTE: the filename &#8220;ALL&#8221; must be in uppercase</em><br />
.</li>
<li>Now let&#8217;s bring up the original file into the Nano text editor.
<pre><span style="color: #000080;">$ sudo nano /var/spool/apt-mirror/var/ALL</span></pre>
</li>
<li>Depending how large your index file is, there may be a brief delay while Nano opens it up. Once it appears, do the same search and replace as you did in steps 3-6 again. <em>Note: If the editor comes up blank, then you have not opened up the index file &#8211; check your path spelling in Step 9 and try again.</em><br />
.</li>
<li>Save your changes by pressing CTRL+X, then &#8220;Y&#8221; and then Enter.<br />
.</li>
<li>Finally, we need to modify the Apt-Mirror&#8217;s cache of downloaded files so that its directory structure matches that of the new source. In the case of iiNet, you&#8217;ll notice it&#8217;s URL has one less <em>ubuntu</em> word in it compared to Internode&#8217;s URL, so we&#8217;ll need to move some directories to eliminate the extra <em>ubuntu</em> directory. At the terminal, move the <em>dists</em> and <em>pool</em> directories of the mirrored files one directory back using the commands:
<pre><span style="color: #000080;">$ sudo mv /var/spool/apt-mirror/mirror/mirror.internode.on.net/pub/ubuntu/ubuntu/dists /var/spool/apt-mirror/mirror/mirror.internode.on.net/pub/ubuntu
$ sudo mv /var/spool/apt-mirror/mirror/mirror.internode.on.net/pub/ubuntu/ubuntu/pool /var/spool/apt-mirror/mirror/mirror.internode.on.net/pub/ubuntu</span></pre>
</li>
<li>Now rename the <em>mirror.internode.on.net</em> directory to become the name of the iiNet server:
<pre><span style="color: #000080;">$ sudo mv /var/spool/apt-mirror/mirror/mirror.internode.on.net /var/spool/apt-mirror/mirror/ftp.iinet.net.au</span></pre>
</li>
<li>The directory structure now matches iiNet&#8217;s server and your <em>ALL</em> file is up to date, so now we can test your changes by launching Apt-Mirror. Launch it manually with:
<pre><span style="color: #000080;">$ apt-mirror</span></pre>
</li>
<li>Watch the output. First Apt-Mirror will download all the repository indexes from the new location and will compare the files presented in those indexes to your local index of downloaded files (the modified <em>ALL</em> file). It will skip all files already listed as being present and will only download new files not listed in your local mirror. You should find Apt-Mirror advises only a small subset of data to download, perhaps only a few megabytes or no more than a gigabyte or two since your last update under the old setup. If you see that Apt-Mirror wants to download some 30GB or more, then you have made an error in changing the URL in the ALL index file or you incorrectly renamed the mirror directories. Press CTRL+C to stop Apt-Mirror, and go check your configuration from Step 10.
<pre><span style="color: #000080;">$ apt-mirror
Downloading 1080 index files using 5 threads...
Begin time: Wed Dec  9 15:59:23 2009
[5]... [4]... [3]... [2]... [1]... [0]...
End time: Wed Dec  9 16:00:45 2009

Proceed indexes: [SSSSSSSSSSPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP]

1.7 GiB will be downloaded into archive.
Downloading 998 archive files using 5 threads...
Begin time: Wed Dec  9 16:02:31 2009
[5]... [4]... [3]... [2]... [1]... [0]...
End time: Wed Dec  9 16:54:15 2009

207.4 MiB in 256 files and 1 directories can be freed.
Run /var/spool/apt-mirror/var/clean.sh for this purpose.
$</span></pre>
</li>
<li>You&#8217;re done! Pat yourself on the back. <img src='http://www.serenux.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ol>
<p><span style="color: #0000ff;"><em><strong>Inserting a foreign Apt-Mirror archive into your own archive<br />
</strong></em></span></p>
<p>This one is slightly more involved, but is not difficult. In the case of a full Ubuntu Mirror, let&#8217;s say you were adding an Ubuntu Karmic mirror archive taken from iiNet&#8217;s mirror servers into your own local Apt-Mirror archive that featured only Intrepid and Jaunty, both of which you are updating from Internode&#8217;s mirror servers. There are some obstacles we need to overcome such as:</p>
<ul>
<li>Continuing to perform future updates for the Karmic repository from Internode rather than iiNet.</li>
<li>The foreign iiNet Karmic archive contains lots of files that you already have in your own archive &#8211; files that are common between all releases of Ubuntu. How do you filter those ones out and only copy the new files?</li>
<li>Finally, how do you update the Apt-Mirror index file with the potentially thousands of new entries from the foreign archive? How do you avoid duplicate lines potentially confusing Apt-Mirror?</li>
</ul>
<p>Follow these steps:</p>
<ol>
<li>First ensure that you have the full copy of the foreign Apt-Mirror archive supplied on a suitable storage medium. Aside from the mirror directory itself (usually under <em>/var/spool/apt-mirror/mirror</em>), you must have a copy of its <em>/var/spool/apt-mirror/var/ALL</em> file. It does not matter if the foreign mirror is not completely up to date, as Apt-Mirror will catch up with what is missing when you run the next update.<br />
.</li>
<li>Let&#8217;s prepare your local Apt-Mirror installation for grabbing Ubuntu Karmic from our preferred source first. We need to load up the <em>/etc/apt/mirror.list</em> file into your favourite text editor and add the entries relevant to our new repository that we are mirroring. I will use the Nano text editor for this, but you can use any text editor you like:
<pre><span style="color: #000080;">$ sudo nano /etc/apt/mirror.list</span></pre>
</li>
<li>Now we add the entries relevant to Ubuntu Karmic for Apt-Mirror to use. In this case, I am going to update Ubuntu Karmic from Internode and I will be grabbing both the 32-bit and 64-bit versions plus the source code (reflecting what is already included in the foreign archive on my storage medium, or Apt-Mirror will be doing a LOT of downloading the next time you run it), so I need to add the following entries:
<pre><span style="color: #000080;"># Ubuntu 9.10 Karmic Koala 32-bit
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-updates main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-backports main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-security main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-proposed main restricted universe multiverse

# Ubuntu 9.10 Karmic Koala 64-bit
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-updates main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-backports main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-security main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-proposed main restricted universe multiverse

# Ubuntu 9.10 Karmic Koala Source
deb-src http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic main restricted universe multiverse
deb-src http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-updates main restricted universe multiverse
deb-src http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-backports main restricted universe multiverse
deb-src http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-security main restricted universe multiverse
deb-src http://mirror.internode.on.net/pub/ubuntu/ubuntu karmic-proposed main restricted universe multiverse</span></pre>
</li>
<li>Save your changes and exit the editor using CTRL+X, then &#8220;Y&#8221; and then Enter.<br />
.</li>
<li>Make a backup copy of the foreign mirror&#8217;s <em>/var/spool/apt-mirror/var/ALL</em> file, so you can revert to it if you make a mistake. Call the copy something like <em>ALL_Backup</em>.<br />
.</li>
<li>Now open the foreign mirror&#8217;s original <em>/var/spool/apt-mirror/var/ALL</em> file into your favourite text editor.<br />
.</li>
<li>Use your text editor&#8217;s search and replace function (in Nano, press CTRL + Backslash &#8220;\&#8221;) to replace the URL of each entry in the foreign mirror&#8217;s <em>ALL</em> file to the URL of the mirror you will be performing your future updates from. In the case of changing iiNet URLs to Internode URLs, you would replace any occurrence of the text string:
<pre><span style="color: #000080;">http://ftp.iinet.net.au/pub/ubuntu</span></pre>
<p>&#8230;with&#8230;</p>
<pre><span style="color: #000080;">http://mirror.internode.on.net/pub/ubuntu/ubuntu</span></pre>
</li>
<li>Once updated, save your changes and close your text editor.<br />
.</li>
<li>Now we need to merge the modified foreign <em>ALL</em> file into the <em>ALL</em> file from your local Apt-Mirror setup. First up, rename the modified foreign <em>ALL</em> file so we don&#8217;t confuse it. For this tutorial, I will assume your foreign mirror is supplied on an external USB hard-drive called &#8220;myhdd&#8221; and is simply a copy of the foreign system&#8217;s <em>/var</em> directory in its entirety. The following will rename the file from <em>ALL</em> to <em>ALL_modified</em> in a terminal:
<pre><span style="color: #000080;">$ mv /media/myhdd/var/spool/apt-mirror/var/ALL /media/myhdd/var/spool/apt-mirror/var/ALL_modified
</span></pre>
</li>
<li>Now concatenate the original <em>ALL</em> file and the modified foreign mirror&#8217;s <em>ALL_modified</em> file into one new file called <em>ALL_new</em> in your local Apt-Mirror&#8217;s <em>var</em> directory. Concatenating alone <span style="text-decoration: underline;">will</span> result in duplicate lines and we need to sort the file so that any duplicate lines in both the local and foreign <em>ALL</em> files are brought together. We can sort the content of the concatenated files and remove duplicate lines in one hit with:
<pre><span style="color: #000080;">$ sudo cat /var/spool/apt-mirror/var/ALL /media/myhdd/var/spool/apt-mirror/var/ALL_modified | sort | uniq &gt; /var/spool/apt-mirror/var/ALL_new
</span></pre>
<p>The <em>cat</em> part of the command simply joins the content of <em>/var/spool/apt-mirror/var/ALL</em> and <em>/media/myhdd/var/spool/apt-mirror/var/ALL_modified</em> into one big file, but before it&#8217;s written to a physical file, the concatenated data is &#8220;piped&#8221; using the pipe symbol &#8220;|&#8221; into the <em>sort</em> command, which sorts the concatenated data into alphabetical order which will group duplicate lines together. But before that resultant output is written anywhere, the sorted data is then piped again into the <em>uniq</em> command which automagically removes all duplicate lines, leaving one unique copy of each line. Finally, we direct the output from <em>uniq</em> using the &#8220;&gt;&#8221; character into our physical destination file at <em>/var/spool/apt-mirror/var/ALL_new</em> at the end. The <em>sudo</em> command at the start is used simply because only the <em>root</em> and the <em>apt-mirror</em> users can actually write to the <em>/var/spool/apt-mirror/var</em> directory.</p>
<p>Alternatively, we can replace the &#8220;<em>| sort | uniq</em>&#8221; part with &#8220;<em>| sort -u</em>&#8221; which does the exact same thing, since the sort command does have it&#8217;s own &#8220;unique&#8221; functionality as well. I&#8217;ll leave it up to you which way you&#8217;d like to go.</li>
<li>Check your new <em>/var/spool/apt-mirror/var/ALL_new</em> file and you will find it now contains all your local and foreign mirror&#8217;s entries in alphabetical order and with no duplicate lines. If you&#8217;d like to see how this worked, re-work Step 10 without the <em>sort</em> and <em>uniq</em> commands or the pipe characters and see how it affects the output file. Try adding just the <em>sort</em> or just the <em>uniq</em> command too.<br />
.</li>
<li>Now rename your local mirror&#8217;s original <em>ALL</em> file because we&#8217;re about to replace it with the new one:
<pre><span style="color: #000080;">$ sudo mv /var/spool/apt-mirror/var/ALL /var/spool/apt-mirror/var/ALL_old</span></pre>
</li>
<li>Now rename the new <em>ALL</em>_new file to take the place of the old one:
<pre><span style="color: #000080;">$ sudo mv /var/spool/apt-mirror/var/ALL_new /var/spool/apt-mirror/var/ALL</span></pre>
</li>
<li>Right, that&#8217;s the index taken care of. We&#8217;re nearly done! Now we only have to merge the foreign mirror&#8217;s actual files into your local mirror. Once again, for the purposes of this tutorial I&#8217;m going to assume you have them stored on an external USB hard-drive called &#8220;myhdd&#8221; and is a copy of the foreign system&#8217;s entire <em>/var</em> directory, so the path to the foreign mirror&#8217;s files will be <em>/media/myhdd/var/spool/apt-mirror/mirror</em> &#8211; got that? Let&#8217;s change to that directory now in a terminal to save us having to type so much:
<pre><span style="color: #000080;">$ cd /media/myhdd/var/spool/apt-mirror/mirror</span></pre>
</li>
<li>Now, the observant of you may have noticed that Apt-Mirror stores its mirrored files using a directory structure that follows the path of the URL the data is obtained from, so in the case of a mirror from iiNet, there is a directory here called <em>ftp.iinet.net.au</em>. You can see it by using the <em>ls</em> command to list the directory contents:
<pre><span style="color: #000080;">$ ls -l
-rw-r--r--  1 apt-mirror apt-mirror   198599 2009-12-09 10:19 access.log
-rw-r--r--  1 apt-mirror apt-mirror   544373 2009-12-01 06:45 access.log.1
-rw-r--r--  1 apt-mirror apt-mirror  1863467 2009-11-03 06:44 access.log.2
-rw-r--r--  1 apt-mirror apt-mirror  1865334 2009-10-01 06:28 access.log.3
-rw-r--r--  1 apt-mirror apt-mirror 18152891 2009-09-01 06:42 access.log.4
-rw-r--r--  1 apt-mirror apt-mirror     6135 2009-12-09 06:46 error.log
-rw-r--r--  1 apt-mirror apt-mirror    33898 2009-12-01 06:45 error.log.1
-rw-r--r--  1 apt-mirror apt-mirror   124512 2009-11-03 06:44 error.log.2
-rw-r--r--  1 apt-mirror apt-mirror   554851 2009-10-01 06:28 error.log.3
-rw-r--r--  1 apt-mirror apt-mirror   831227 2009-09-01 06:42 error.log.4<strong>
drwxr-xr-x  3 apt-mirror apt-mirror     4096 2008-09-11 02:00 ftp.iinet.net.au</strong>
$</span></pre>
</li>
<li>We need to modify the foreign directory names and structure to exactly match that of the URL path your local mirror updates from. Starting with the obvious, we need to rename the <em>ftp.iinet.net.au</em> directory to be <em>mirror.internode.on.net</em> with:
<pre><span style="color: #000080;">$ sudo mv ftp.iinet.net.au mirror.internode.on.net</span></pre>
</li>
<li>Next we need to create an extra subdirectory called &#8220;ubuntu&#8221; because Internode&#8217;s URL path is <em>mirror.internode.on.net/pub/ubuntu/<strong>ubuntu/</strong></em> and iiNet&#8217;s path is <em>ftp.iinet.net.au/pub/ubuntu/</em> only:
<pre><span style="color: #000080;">$ sudo mkdir mirror.internode.on.net/pub/ubuntu/ubuntu</span></pre>
</li>
<li>Now we need to move the &#8220;dists&#8221; and &#8220;pool&#8221; directories under the first &#8220;ubuntu&#8221; directory to be under the second &#8220;ubuntu&#8221; directory:
<pre><span style="color: #000080;">$ sudo mv mirror.internode.on.net/pub/ubuntu/dists mirror.internode.on.net/pub/ubuntu/ubuntu
$ sudo mv mirror.internode.on.net/pub/ubuntu/pool mirror.internode.on.net/pub/ubuntu/ubuntu</span></pre>
</li>
<li>With the directory structure and directory names all amended, we are now ready to merge the foreign mirror&#8217;s files into your local mirror. We will do this using RSync. This tool traditionally is used to make backups and is indeed used to keep the official worldwide Ubuntu mirrors up to date 1:1 with the master archive, but in our case we are using it to add the &#8220;missing&#8221; files in the local mirror with the files from the foreign mirror whilst skipping the files that are already present, which means instead of copying around about 60GB worth of data from the foreign mirror, we&#8217;ll only copy a percentage of that instead, saving us time and drive space:
<pre><span style="color: #000080;">$ sudo rsync -avz --progress /media/myhdd/var/spool/apt-mirror/mirror/mirror.internode.on.net /var/spool/apt-mirror/mirror/</span></pre>
</li>
<li>The &#8220;&#8211;progress&#8221; parameter allows you to see which file is being copied over. You may see a large number of directory names whizz past because those directories don&#8217;t have any files that are different between your current Ubuntu Intrepid and Jaunty mirror and the Karmic mirror you are merging. Unfortunately rsync does not provide an all-over progress. It only provides a progress of the file it is currently working on. This procress can take several hours to complete depending on how much data needs to be copied and the speed of your storage medium containing the foreign mirror (which if on a USB HDD can take a looooong time).<br />
.</li>
<li>Once RSync has finished, it will give a summary of what was copied. If you were to run the rsync command in Step 16 again, you will see it finish rather quickly because there is no data that has changed or is missing anymore.<br />
.</li>
<li>Now we just quickly ensure that all the merged foreign files belong to the Apt-Mirror user with:
<pre><span style="color: #000080;">$ sudo chown apt-mirror:apt-mirror -R /var/spool/apt-mirror</span></pre>
</li>
<li>And now we are ready to try a manual update to see if it all worked. If you now execute the Apt-Mirror application manually, you should now see that it reads in the new repository entries you added into your /etc/apt/mirror.list file in Step 3 and will compare the files presented in those indexes to your local index of downloaded files (the newly modified <em>ALL</em> file). It will skip all files already present and will only download new files not present in your local mirror. You should find Apt-Mirror advises only a small subset of data to download, perhaps only a few megabytes or a gigabyte or two since your last update under the old setup and depending on how old the foreign archive was. If you see that Apt-Mirror wants to download about 30GB or more, then you have made an error in changing the URL in the <em>ALL</em> index file or the renaming of mirror directories. Press CTRL+C to stop Apt-Mirror, and go check your configuration from Step 5.
<pre><span style="color: #000080;">$ apt-mirror
Downloading 1080 index files using 5 threads...
Begin time: Wed Dec  9 15:59:23 2009
[5]... [4]... [3]... [2]... [1]... [0]...
End time: Wed Dec  9 16:00:45 2009

Proceed indexes: [SSSSSSSSSSPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP]

1.7 GiB will be downloaded into archive.
Downloading 998 archive files using 5 threads...
Begin time: Wed Dec  9 16:02:31 2009
[5]... [4]... [3]... [2]... [1]... [0]...
End time: Wed Dec  9 16:54:15 2009

207.4 MiB in 256 files and 1 directories can be freed.
Run /var/spool/apt-mirror/var/clean.sh for this purpose.
$</span></pre>
</li>
<li>If all is good, then pat yourself on the back. You&#8217;ve successfully merged the foreign repository and it will now update from your preferred ISP&#8217;s mirror from now on. <img src='http://www.serenux.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.serenux.com/2009/12/howto-migrate-an-apt-mirror-generated-ubuntu-archive-to-another-mirror-source-or-merge-a-foreign-apt-mirror-archive-into-yours/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTo: Make use of Ubuntu PPA repositories</title>
		<link>http://www.serenux.com/2009/07/howto-make-use-of-ubuntu-ppa-repositories/</link>
		<comments>http://www.serenux.com/2009/07/howto-make-use-of-ubuntu-ppa-repositories/#comments</comments>
		<pubDate>Sat, 04 Jul 2009 04:58:07 +0000</pubDate>
		<dc:creator>HyRax</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Applications]]></category>
		<category><![CDATA[Apt]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Jaunty]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.serenux.com/?p=509</guid>
		<description><![CDATA[What is a PPA repository? A PPA is a Personal Package Archive hosted by the ubuntu.com servers that contains binaries and/or source related to a project. The project can be anything from a new application to a backport of an existing one. A good example is the easy availability of OpenOffice.org 3.0.1 to Intrepid users [...]]]></description>
			<content:encoded><![CDATA[<p>What is a PPA repository?</p>
<p>A PPA is a <em>Personal Package Archive</em> hosted by the ubuntu.com servers that contains binaries and/or source related to a project. The project can be anything from a new application to a backport of an existing one. A good example is the easy availability of <a title="OpenOffice.org 3.0.1 for Intrepid users" href="http://www.serenux.com/?p=397" target="_blank">OpenOffice.org 3.0.1 to Intrepid users</a> before Jaunty came out rather than having to deal with the mess of packages from Sun&#8217;s own website.</p>
<p>PPA&#8217;s can be wholly personal to you or may be open to the public. In particular it is very useful for providing Ubuntu packaged versions of a given application instead of dealing with tarballs or converting RPM packages.</p>
<p>So how does one make use of a pre-defined PPA and are there any things to be wary about? Read on.</p>
<p><span id="more-509"></span>PPA&#8217;s are great for getting the latest versions of a given piece of software instead of waiting for the official Ubuntu repository versions to be updated, though you will of course open yourself to any potential bugs in that software. Classic examples include getting Pidgin&#8217;s 2.5.8 update with the included new authentication method for Yahoo Messenger, or getting the latest version of the Deluge BitTorrent client/daemon.</p>
<p>In this HowTo, we are going to grab the latest version of Deluge to install on an Ubuntu Jaunty 9.04 system using the unofficial Ubuntu PPA, but this guide should apply to just about any version of Ubuntu or other Debian-based distribution.</p>
<p><em>NOTE: Ubuntu has now further simplified the PPA process by introducing a new way of adding PPA repositories and the GPG key in one hit from Ubuntu Karmic 9.10 onwards. While you can still use the process outlined below, please see the note at the end of this article for the simplified way.</em></p>
<ol>
<li>First up, we need to create a sources.list file for the PPA repository we want to add to our system. In the case of Deluge, the PPA is at <a title="Deluge Ubuntu PPA" href="https://launchpad.net/~deluge-team/+archive/ppa" target="_blank">https://launchpad.net/~deluge-team/+archive/ppa</a> so go there first.</li>
<li>Under the &#8220;Install packages&#8221; section is a box with two lines in it:
<pre><span style="color: #000080;">deb http://ppa.launchpad.net/deluge-team/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/deluge-team/ppa/ubuntu jaunty main</span></pre>
</li>
<li>Highlight and copy these two lines to your clipboard.</li>
<li>Now open a terminal and create a new file in your favourite text editor (in this case, GEdit) by typing in:
<pre><span style="color: #000080;">$ sudo gedit /etc/apt/sources.list.d/deluge.list</span></pre>
</li>
<li>This creates a new file under /etc/apt/sources.list.d called deluge.list. You are presented with a blank page. Paste the content of the clipboard down so you have the two lines you copied earlier.</li>
<li>Save and close the file.</li>
<li>Now, in the terminal, type in:
<pre><span style="color: #000080;">$ sudo apt-get update</span></pre>
</li>
<li>When the update completes, you should see a warning error at the end similar to the following:
<pre><span style="color: #000080;">W: GPG error: http://ppa.launchpad.net jaunty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY C5E6A5ED249AD24C
W: You may want to run apt-get update to correct these problems</span></pre>
</li>
<li>What this means is that apt-get has processed all your package lists and found that for the newly added Deluge source list, it does not have a GPG key to authenticate any of the files from it. This doesn&#8217;t stop you from installing Deluge or other files from it, but it does prevent Ubuntu from proving whether or not these files are untampered with, so it will pester you with warnings until you can provide it that GPG public key. Providing it is simple. Make note of the hexadecimal value provided after NO_PUBKEY and then type in the following:
<pre><span style="color: #000080;">$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C5E6A5ED249AD24C
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys C5E6A5ED249AD24C
gpg: requesting key 249AD24C from hkp server keyserver.ubuntu.com
gpg: key 249AD24C: public key "Launchpad PPA for Deluge Team" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
$</span></pre>
</li>
<li>This fetches the GPG public key from the Keyserver at ubuntu.com and adds it to your GPG keyring. Now if you run:
<pre><span style="color: #000080;">$ sudo apt-get update</span></pre>
<p>&#8230;again, you will see no errors output this time, which means you can safely install applications from it now without Apt warning you about being unable to authenticate them.</li>
<li>To prove this, let&#8217;s try and install Deluge now:
<pre><span style="color: #000080;">$ sudo apt-get install deluge</span></pre>
<p>&#8230;and it should install like any other ordinary Ubuntu applications with no fuss, no worries and no error messages.</li>
<li>Pat yourself on the back.</li>
</ol>
<p><span style="text-decoration: underline;"><span style="color: #0000ff;"><em><strong>I get an &#8220;HTTP fetch&#8221; error when I try to import a GPG public key!</strong></em></span></span></p>
<p>If at step 9, you get the following error:</p>
<pre><span style="color: #000080;">$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C5E6A5ED249AD24C
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys C5E6A5ED249AD24C
gpg: requesting key 249AD24C from hkp server keyserver.ubuntu.com
<strong>gpgkeys: HTTP fetch error 7: couldn't connect to host</strong>
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
$</span></pre>
<p>It is because your firewall is blocking access to the Keyserver. Keyservers use port 11371 to communicate, not port 80 which is the normal HTTP port, so open 11371 as an outbound port on your firewall and re-run the command and it will work fine.</p>
<p><span style="color: #0000ff;"><em><span style="text-decoration: underline;"><strong>The simplified way of adding PPA&#8217;s using Ubuntu Karmic 9.10 or later.<br />
</strong></span></em></span></p>
<p>Ubuntu 9.10 introduced a new, simpler way to add PPA&#8217;s to your system. Using the above Deluge example, you now only have to type in:</p>
<pre><span style="color: #000080;">$ sudo add-apt-repository ppa:deluge-team/ppa</span></pre>
<p>&#8230;and that&#8217;s it. This will do the whole sources.list creation and GPG key for you in one hit. That now simply leaves you to update your package lists with:</p>
<pre><span style="color: #000080;">$ sudo apt-get update</span></pre>
<p>&#8230;and then you can install Deluge with:</p>
<pre><span style="color: #000080;">$ sudo apt-get install deluge</span></pre>
<p>As you can see, it&#8217;s a far simpler method. You can, of course, still use the original method if you prefer.</p>
<p><span style="color: #0000ff;"><em><span style="text-decoration: underline;"><strong>Hey these PPA things are cool &#8211; can I create one of my own?</strong></span></em></span></p>
<p>You certainly can. Refer to the <a title="Ubuntu PPA Help Page" href="https://help.launchpad.net/Packaging/PPA" target="_blank">Personal Package Archives for Ubuntu Help Page</a> for everything you need to know, however please do not use a PPA as your own personal off-site backup for personal data. It is intended to help individuals and small groups who develop new software and do not have the resources to host their software for easy distribution by providing them a place where the masses can gain access to their project. To help curb the potential for abuse, PPA&#8217;s are limited to 1GB of storage and you are bound by the <a title="Ubuntu Community Code of Conduct" href="https://help.launchpad.net/BecomingAnUbuntero" target="_blank">Ubuntu Community Code of Conduct</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serenux.com/2009/07/howto-make-use-of-ubuntu-ppa-repositories/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HowTo: Install OpenOffice.org 3.0.1 in Ubuntu Intrepid 8.10 right NOW rather than wait for Ubuntu Jaunty 9.04</title>
		<link>http://www.serenux.com/2009/01/howto-install-openofficeorg-301-in-ubuntu-intrepid-810-right-now-rather-than-wait-for-ubuntu-jaunty-904/</link>
		<comments>http://www.serenux.com/2009/01/howto-install-openofficeorg-301-in-ubuntu-intrepid-810-right-now-rather-than-wait-for-ubuntu-jaunty-904/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 08:45:41 +0000</pubDate>
		<dc:creator>HyRax</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Applications]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Intrepid]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[OpenOffice.org]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.serenux.com/?p=397</guid>
		<description><![CDATA[OpenOffice.org 3.0.x has been out for awhile now, but unfortunately did not get released in time to be included with Ubuntu Intrepid 8.10 back in October 2008, so Intrepid shipped with OpenOffice.org 2.4.1 instead. Bummer. OpenOffice.org 3.0.x will be included in Ubuntu Jaunty 9.04 in April 2009, but as some people have noticed, there are [...]]]></description>
			<content:encoded><![CDATA[<p>OpenOffice.org 3.0.x has been out for awhile now, but unfortunately did not get released in time to be included with Ubuntu Intrepid 8.10 back in October 2008, so Intrepid shipped with OpenOffice.org 2.4.1 instead. Bummer.</p>
<p>OpenOffice.org 3.0.x will be included in Ubuntu Jaunty 9.04 in April 2009, but as some people have noticed, there are some useful features in OpenOffice.org 3.0.x (such as much improved Word doc importing) that can make waiting another four months seem like a bloody long time to upgrade. You want 3.0 <em>now</em>, not in four months!</p>
<p>So for the impatient among you, here&#8217;s the most painless and easiest way to upgrade your OpenOffice.org to 3.0.1 without having to deal with downloading individual packages or TAR archives from the OpenOffice.org website, or manually having to satisfy the extra dependencies that OpenOffice.org 3.0.1 requires.</p>
<p><span id="more-397"></span></p>
<ol>
<li>First up, open a terminal.<br />
.</li>
<li>Now type in:
<pre><span style="color: #000080;">$ sudo gedit /etc/apt/sources.list.d/openoffice.list</span></pre>
<p>&#8230;and your text editor will appear with a blank new file to type into.</li>
<li>Copy &amp; paste or type in the following line into the editor:
<pre><span style="color: #000080;">deb http://ppa.launchpad.net/openoffice-pkgs/ubuntu intrepid main
</span></pre>
<p><span style="color: #000080;"><img class="aligncenter size-full wp-image-401" title="Adding the repository using GEdit" src="http://www.serenux.com/wp-content/uploads/2009/01/geditwindow.jpg" alt="Adding the repository using GEdit" width="571" height="331" /></span></li>
<li>Save your file and close the text editor.<br />
.</li>
<li>Now type in at the terminal:
<pre><span style="color: #000080;">$ sudo apt-get update</span></pre>
</li>
<li>You should observe that a warning message regarding NO_PUBKEY will appear after the update has completed as follows:
<pre><span style="color: #000080;">W: GPG error: http://ppa.launchpad.net intrepid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 60D11217247D1CFF</span></pre>
<p>This is because you don&#8217;t yet have the public key for this OpenOffice.org repository to be able to authenticate anything from it, so we need to add it with the following command at the $ prompt:</p>
<pre><span style="color: #000080;">$ <code>gpg --keyserver keyserver.ubuntu.com --recv</code></span> <span style="color: #000080;">60D11217247D1CFF</span>
<span style="color: #000080;">gpg: requesting key 247D1CFF from hkp server keyserver.ubuntu.com
gpg: key 247D1CFF: public key "Launchpad PPA for OpenOffice.org Scribblers" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
$</span></pre>
<p>Right, that downloaded the key from the Ubuntu keyserver to your PC. Now we need to tell Apt to use that downloaded key to authenticate with. Do do this, type in:</p>
<pre><span style="color: #000080;"><code>$ gpg --export --armor </code></span><span style="color: #000080;">60D11217247D1CFF</span> <span style="color: #000080;"><code>| sudo apt-key add -
</code>OK
$</span></pre>
</li>
<li>If you now run Step 5&#8242;s command again (sudo apt-get update), you will no longer have the NO_PUBKEY warning at the end of it.<br />
.</li>
<li>Anyway, once Apt has finished updating itself with a new list of packages, within a few seconds, your Update Manager will pop up the red arrow in the system tray advising that there are new updates to download.<br />
.<img class="aligncenter size-full wp-image-405" title="Software Updates are Available" src="http://www.serenux.com/wp-content/uploads/2009/01/softwareupdatesavailable.jpg" alt="Software Updates are Available" width="422" height="162" /><br />
.</li>
<li>When you open Update Manager, you will find that they are all upgrades to OpenOffice.org 3.0.x including the extra dependencies required! Sweet!<br />
.<img class="aligncenter size-full wp-image-404" title="OpenOffice.org Updates ready to install" src="http://www.serenux.com/wp-content/uploads/2009/01/openofficeorgupdates.jpg" alt="OpenOffice.org Updates ready to install" width="587" height="661" /><br />
.</li>
<li>Hit the &#8220;Install Updates&#8221; button. If you are presented with a dialog box warning you that some of the packages cannot be authenticated, then you have not got the Public Key from the Ubuntu Keyserver to authenticate the new OpenOffice.org packages. This is because this OpenOffice.org 3.0.1 repository is not official nor permanent and was only setup to satisfy the impatient ones out there (ie: you!). It is not critical that the packages be authenticated, but that is up to you to decide. If you&#8217;d rather not install unauthenticated packages, then just click the Cancel button and stop following these instructions. <strong>If you followed Step 6 properly, then you will <em>not</em> get this warning message because the public key you downloaded in Step 6 will authenticate the packages properly and the download of updates will commence immediately as per Step 11.</strong><br />
.<img class="aligncenter size-full wp-image-403" title="Warning about Not Authenticated Packages" src="http://www.serenux.com/wp-content/uploads/2009/01/notauthenticatedpackages.jpg" alt="Warning about Not Authenticated Packages" width="450" height="550" /><br />
.</li>
<li>Hit the Apply button and allow the system to download and install as normal.<br />
.</li>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-400" title="Downloading Packages" src="http://www.serenux.com/wp-content/uploads/2009/01/downloadingpackages.jpg" alt="Downloading Packages" width="283" height="209" /></p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-402" title="Installing OpenOffice.org" src="http://www.serenux.com/wp-content/uploads/2009/01/installingopenoffice.jpg" alt="Installing OpenOffice.org" width="484" height="243" /></p>
<li>When completed, start up OpenOffice.org as normal and you will see that the splash loader and the Help-&gt;About page show that you now have OpenOffice.org 3.0.1!<br />
.<img class="aligncenter size-full wp-image-399" title="About OpenOffice.org" src="http://www.serenux.com/wp-content/uploads/2009/01/aboutopenoffice.jpg" alt="About OpenOffice.org" width="425" height="349" /><br />
.</li>
<li>Pat yourself on the back. You&#8217;re done.</li>
</ol>
<p>How is this possible anyway? Well, seems that demand for OpenOffice.org 3.0.x has been so great that the nice guys at <a title="OpenOffice.org Scribblers Homepage" href="https://launchpad.net/~openoffice-pkgs" target="_blank">OpenOffice.org Scribblers</a> decided to put together a quick little dedicated repository for it on the Launchpad site, so all kudos and credit go to them. The repo only works for Ubuntu Intrepid, so for users of earlier versions of Ubuntu, you will still need to download the .debs and install them manually from the OpenOffice.org website.</p>
<p><em>Credit goes to stmok from Overclockers Australia for advising of the public key solution used in Step 6 &#8211; thanks!<br />
</em></p>
<div class='wp_likes' id='wp_likes_post-397'><a class='like' href="javascript:wp_likes.like(397);" title='' ><img src="http://www.serenux.com/wp-content/plugins/wp-likes/images/like.gif" alt='' border='0'/>Like</a><span class='text'></span>
<div class='unlike'><a href="javascript:wp_likes.unlike(397);">Unlike</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.serenux.com/2009/01/howto-install-openofficeorg-301-in-ubuntu-intrepid-810-right-now-rather-than-wait-for-ubuntu-jaunty-904/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>HowTo: Setup your own local Ubuntu repository mirror.</title>
		<link>http://www.serenux.com/2008/10/howto-setup-your-own-local-ubuntu-repository-mirror/</link>
		<comments>http://www.serenux.com/2008/10/howto-setup-your-own-local-ubuntu-repository-mirror/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 12:28:23 +0000</pubDate>
		<dc:creator>HyRax</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Hardy]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Intrepid]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.serenux.com/?p=80</guid>
		<description><![CDATA[While Ubuntu&#8217;s updates are nowhere near as bad as dealing with Windows updates, it can still be annoying to do a fresh install of Ubuntu and then have to download 300MB&#8217;s worth of updates, especially if you have a slow connection, or perhaps you&#8217;re in a remote location and don&#8217;t have an Internet connection. How [...]]]></description>
			<content:encoded><![CDATA[<p>While Ubuntu&#8217;s updates are nowhere near as bad as dealing with Windows updates, it can still be annoying to do a fresh install of Ubuntu and then have to download 300MB&#8217;s worth of updates, especially if you have a slow connection, or perhaps you&#8217;re in a remote location and don&#8217;t have an Internet connection. How do you update machines then??</p>
<p>Why not setup your own personal local Ubuntu Repository? Here&#8217;s how to make one to use either on a personal web server or carry with you on a portable USB (or similar) hard-drive.</p>
<p><span id="more-80"></span></p>
<p>In this example, we&#8217;re going to make a repository using a great little tool called <strong>apt-mirror</strong> and use it to mirror the 32-bit (x86) and 64-bit (AMD64) versions of Ubuntu 8.04.1 Hardy Heron and 8.10 Intrepid Ibex ONLY from an existing source mirror (thus ignoring any other architectures we&#8217;re not interested in). Our source mirror will be the Australian Ubuntu Mirror at Internode, but you can use any mirror you like.</p>
<ol>
<li>On your Ubuntu desktop or server, get into a terminal and type in the following:<span style="color: #000080;"><br />
</span></p>
<pre><span style="color: #000080;">$ sudo apt-get install apt-mirror</span></pre>
</li>
<li>Once installed, edit the config file with:
<pre><span style="color: #000080;">$ sudo nano /etc/apt/mirror.list
</span></pre>
<p><span style="color: #000080;">.</span>..here&#8217;s my config file that I use on my own file server:</p>
<pre><span style="color: #000080;">############# config ###################
</span><span style="color: #000080;"># set base_path    /var/spool/apt-mirror</span><span style="color: #000080;">
#
# if you change the base path you must create the directories below with write privlages
#
# set mirror_path  $base_path/mirror
# set skel_path    $base_path/skel
# set var_path     $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch  &lt;running host architecture&gt;
set nthreads     3
set _tilde 0
############## end config ##############

# Ubuntu 8.04.1 Hardy Heron 32-bit
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu hardy main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu hardy-updates main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu hardy-backports main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu hardy-security main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu hardy-proposed main restricted universe multiverse

# Ubuntu 8.04.1 Hardy Heron 64-bit
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu hardy main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu hardy-updates main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu hardy-backports main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu hardy-security main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu hardy-proposed main restricted universe multiverse

# Ubuntu 8.10 Intrepid Ibex 32-bit
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu intrepid main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu intrepid-updates main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu intrepid-backports main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu intrepid-security main restricted universe multiverse
deb-i386 http://mirror.internode.on.net/pub/ubuntu/ubuntu intrepid-proposed main restricted universe multiverse

# Ubuntu 8.10 Intrepid Ibex 64-bit
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu intrepid main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu intrepid-updates main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu intrepid-backports main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu intrepid-security main restricted universe multiverse
deb-amd64 http://mirror.internode.on.net/pub/ubuntu/ubuntu intrepid-proposed main restricted universe multiverse

# Ubuntu source
#deb-src http://archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse

clean http://mirror.internode.on.net/pub/ubuntu/ubuntu</span></pre>
</li>
<li>The above config sets you up to download both the 32-bit and 64-bit repos for both Hardy and Intrepid only &#8211; nothing else. If you like, you can also add other repos such as Medibuntu, Virtualbox, etc &#8211; anyone who has a standard Apt repository.Note the commented out deb-src lines. I don&#8217;t use source, but if you want it, just uncomment them and point them to Internode.
<p>If you wish to use a different source mirror, simply substitute the URL as appropriate.</li>
<li>Save and exit. You then kick it off with:
<pre><span style="color: #000080;">$ sudo /usr/bin/apt-mirror</span></pre>
<p>&#8230;and go and order several pizzas, because this will take a good while to finish. To update your repo with anything new since last run, just re-run the apt-mirror command. Alternatively, configure cron to execute the command for you. I have mine set to run at 2am every night.</p>
<p>Here&#8217;s my log from this morning&#8217;s run:</p>
<pre><span style="color: #000080;">Downloading 222 index files using 3 threads...
Begin time: Thu Oct 23 02:00:01 2008
[3]... [2]... [1]... [0]...
End time: Thu Oct 23 02:01:27 2008

Proceed indexes: [PPPPPPPPPPPPPPPPPPPPPPPP]

276.4 MiB will be downloaded into archive.
Downloading 111 archive files using 3 threads...
Begin time: Thu Oct 23 02:01:51 2008
[3]... [2]... [1]... [0]...
End time: Thu Oct 23 02:07:16 2008

318.5 MiB in 108 files and 0 directories can be freed.
Run /var/spool/apt-mirror/var/clean.sh for this purpose.</span></pre>
<p>&#8230;which tells me 276.4MB of new files were downloaded and 318.5MB of old files are now redundant and should be deleted. Again, I have a cron job setup to run that advised cleanup script for me.</li>
<li>To view the downloaded files. just go to /var/spool/apt-mirror/mirror and you will see a new directory there called mirror.internode.on.net and within that will be your parent mirror&#8217;s directory structure, in this case, exactly how Internode have their structure setup.<br />
.</li>
<li>Once that&#8217;s all done, just setup a virtual website with Apache to allow you to see the downloaded data via a browser and then on your desktop go:
<pre><span style="color: #000080;">$ sudo nano /etc/apt/sources.list.d/mylocalrepo.list</span></pre>
<p>&#8230;and enter the appropriate URL&#8217;s to your local website (note you can call the custom sources file whatever you want as long as it ends in &#8220;.list&#8221;). If you setup a virtual server called http://localhost and point its root to /var/spool/apt-mirror/mirror/mirror.internode.on.net/ then you would enter the following into your sources.list:</p>
<pre><span style="color: #000080;"># My personal Ubuntu mirror
deb http://localhost/pub/ubuntu/ubuntu hardy main multiverse restricted universe
deb http://localhost/pub/ubuntu/ubuntu hardy-backports main multiverse restricted universe
deb http://localhost/pub/ubuntu/ubuntu hardy-security main multiverse restricted universe
deb http://localhost/pub/ubuntu/ubuntu hardy-updates main multiverse restricted universe</span></pre>
<p>&#8230;OR if you&#8217;re not using a web server, then set it up to use local files instead, eg:</p>
<pre><span style="color: #000080;"># My personal Ubuntu mirror
deb file:/var/spool/apt-mirror/mirror/mirror.internode.on.net/pub/ubuntu/ubuntu hardy main multiverse restricted universe
deb file:/var/spool/apt-mirror/mirror/mirror.internode.on.net/pub/ubuntu/ubuntu hardy-backports main multiverse restricted universe
deb file:/var/spool/apt-mirror/mirror/mirror.internode.on.net/pub/ubuntu/ubuntu hardy-security main multiverse restricted universe
deb file:/var/spool/apt-mirror/mirror/mirror.internode.on.net/pub/ubuntu/ubuntu hardy-updates main multiverse restricted universe</span></pre>
<p>If you&#8217;re using Intrepid, then change all above references to &#8220;hardy&#8221; with &#8220;intrepid&#8221;.</li>
<li>Don&#8217;t forget to then edit /etc/apt/sources.list and comment out all the standard deb lines out. Additionally, if you don&#8217;t want to use a particular section of the repository, such as Backports or Proposed, comment out that line in your custom mylocalrepo.list too by placing a hash at the start of the line.<br />
.</li>
<li>Save and exit and then update your system with your new repo list with:
<pre><span style="color: #000080;">$ sudo apt-get update</span></pre>
<p>&#8230;and all subsequent updates to your system will now come from your local repository. If you&#8217;re using a 32-bit system, it will automatically use the 32-bit data you downloaded, ditto 64-bit.</li>
<li>Pat yourself on the back. Job well done!</li>
</ol>
<div class='wp_likes' id='wp_likes_post-80'><a class='like' href="javascript:wp_likes.like(80);" title='' ><img src="http://www.serenux.com/wp-content/plugins/wp-likes/images/like.gif" alt='' border='0'/>Like</a><span class='text'></span>
<div class='unlike'><a href="javascript:wp_likes.unlike(80);">Unlike</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.serenux.com/2008/10/howto-setup-your-own-local-ubuntu-repository-mirror/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
