{"id":6,"date":"2011-01-28T22:15:15","date_gmt":"2011-01-28T21:15:15","guid":{"rendered":"http:\/\/wp.locallost.net\/?p=6"},"modified":"2011-02-08T17:09:41","modified_gmt":"2011-02-08T16:09:41","slug":"home","status":"publish","type":"post","link":"https:\/\/locallost.net\/?p=6","title":{"rendered":"Pre-fetch packages for Debian dist-upgrade"},"content":{"rendered":"<p style=\"text-align: left;\">Recently, I had to upgrade a Debian 4 (Etch) to Debian 5 (Lenny) at a client facility connected to Internet with a \u00ab\u00a0slow\u00a0\u00bb 2Mbps SDSL link.<\/p>\n<p>The problem is that downloading the packages while doing the upgrade on-site, during working hours, would take a significant time, and I had to minimize the downtime.<\/p>\n<p><!--more--><\/p>\n<p>One solution would be to burn the 30 CDs, or 5 DVDs, from Debian, and upgrade the server from this pile of waffle.<\/p>\n<p>Finally, after googling for apt and offline upgrades, I found a solution that would fit quite perfectly my needs.<\/p>\n<p>The solution is to compute the set of packages required for the upgrade and pre-download them. Then, when on the client facility, I would just run `aptitude dist-upgrade&rsquo; and it would update from a local repository of theses pre-downloaded packages.<\/p>\n<p>Here are the commands I used :<\/p>\n<p>&#8211; Configure `\/etc\/apt\/sources.list&rsquo; to point to the Lenny repositories, then update the apt database :<\/p>\n<pre># aptitude clean\r\n# aptitude update<\/pre>\n<p>&#8211; Compute the set of package required for the upgrade :<\/p>\n<pre># mkdir upgrade-mirror &amp;&amp; cd upgrade-mirror\r\n# apt-get -qq --print-uris &gt; pkg.list<\/pre>\n<p>&#8211; Download the packages to the `upgrade-mirror&rsquo; subdir :<\/p>\n<pre># cat ..\/pkg.list |\u00a0(cd upgrade-mirror &amp;&amp; while read URI; do wget \"$URI\"; done)\r\n# dpkg-scanpackages upgrade-mirror \/dev\/null |\u00a0gzip &gt; upgrade-mirror\/Packages.gz<\/pre>\n<p>As I also needed PHP 5.3 from Zend Server, I also mirrored the Zend Server repo.<\/p>\n<p>I left the download running during the night.<\/p>\n<p>The download for the Lenny packages took about an hour (228MB of packages), plus another unknown time for the 415MB of the Zend Server mirror.<\/p>\n<p>Then, in the morning, I arrived at the client facility, and started my upgrade using theses local\/mirror repositories.<\/p>\n<p>&#8211; Set `\/etc\/apt\/sources.list&rsquo; to point to the `upgrade-mirror&rsquo; local repo, and to the classic `dist-upgrade&rsquo;.<\/p>\n<p>&#8211; Set `\/etc\/apt\/sources.list&rsquo; to the official Lenny repo, and do a final `dist-upgrade&rsquo; to see if there is anything left to upgrade.<\/p>\n<p>In one hour I had the base system upgraded with full support for PHP 5.3, and I had plenty of time left for upgrading the client application.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I had to upgrade a Debian 4 (Etch) to Debian 5 (Lenny) at a client facility connected to Internet with a \u00ab\u00a0slow\u00a0\u00bb 2Mbps SDSL link. The problem is that downloading the packages while doing the upgrade on-site, during working &hellip; <a href=\"https:\/\/locallost.net\/?p=6\">Continuer la lecture <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[],"class_list":["post-6","post","type-post","status-publish","format-standard","hentry","category-code"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/s2Bei9-home","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/locallost.net\/index.php?rest_route=\/wp\/v2\/posts\/6","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/locallost.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/locallost.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/locallost.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/locallost.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6"}],"version-history":[{"count":37,"href":"https:\/\/locallost.net\/index.php?rest_route=\/wp\/v2\/posts\/6\/revisions"}],"predecessor-version":[{"id":190,"href":"https:\/\/locallost.net\/index.php?rest_route=\/wp\/v2\/posts\/6\/revisions\/190"}],"wp:attachment":[{"href":"https:\/\/locallost.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/locallost.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/locallost.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}