<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  
  
  <channel>
    <title>chrisjrob: apt-get</title>
    <link>https://chrisjrob.com</link>
    <atom:link href="https://chrisjrob.com/tag/apt-get/feed/index.xml" rel="self" type="application/rss+xml" />
    <description>GNU Linux, Perl and FLOSS</description>
    <language>en-gb</language>
    <pubDate>Fri, 13 Feb 2026 17:22:31 +0000</pubDate>
    <lastBuildDate>Fri, 13 Feb 2026 17:22:31 +0000</lastBuildDate>
    
    <item>
      <title>Howto | Configure apt-get</title>
      <link>https://chrisjrob.com/2009/03/21/configure-apt-get/</link>
      <pubDate>Sat, 21 Mar 2009 05:55:33 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2009/03/21/configure-apt-get</guid>
      <description>
       <![CDATA[
         
           <img src="https://chrisjrob.com/assets/debian_logo.png" align="right" alt="Featured Image">
         
         <h2 id="remove-cdrom-installation">Remove CDROM installation</h2>

<p>Firstly comment out the CDROM installation from <code class="language-plaintext highlighter-rouge">/etc/apt/sources.list</code>.  This seems to be done automatically from Lenny.</p>

<p>Next change any references to “stable” are replaced with the name of the current stable release, currently “Lenny”.  If we don’t do this, then when the next release “Squeeze” goes “stable”, suddenly your system will be upgraded next time you do an apt-get upgrade.</p>

<!--more-->

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ apt-get update
</code></pre></div></div>

<h2 id="proxy-server">Proxy Server</h2>

<p>If it didn’t work, then you may need to configure apt with your proxy server.</p>

<h3 id="option-1---edit-aptconf">Option 1 - Edit apt.conf</h3>

<p>The usual method is to add the following line to <code class="language-plaintext highlighter-rouge">/etc/apt/apt.conf</code>:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ nano /etc/apt/apt.conf
Apt.conf:
Acquire::http::Proxy "http://admin:password@proxy:port/"
</code></pre></div></div>

<p>Obviously it is not generally a good idea to have a username and password in plain text form in this way.</p>

<h3 id="option-2---environment-variable">Option 2 - Environment Variable</h3>

<p>It is also possible to add the proxy server to the environment variables:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ export http_proxy="http://admin:password@proxy:port/"
$ export ftp_proxy="http://admin:password@proxy:port/"
</code></pre></div></div>

<p>Obviously this will be lost when you close the current console.  Again it is not a good idea to enter usernames and passwords as command line arguments, so you should clear your bash_history.</p>

<h3 id="option-3---update-proxy-server">Option 3 - Update Proxy Server</h3>

<p>Ideally you need to change your proxy server to allow traffic without the need to specify a username and password.</p>

<h2 id="add-backports">Add Backports</h2>

<p>In many cases you will require newer packages than are afforded by stable alone, and for that purpose you need Debian Backports.  To add backports, visit:</p>

<ul>
  <li>http://www.backports.org/dokuwiki/doku.php?id=instructions</li>
</ul>

<p>And follow the instructions on that page to add the repository to your sources, and add the security keyring.</p>

<h2 id="pinning">Pinning</h2>

<p>If you have multiple sources in your sources.list, then in general the latest package will be selected by default.  You can change this behaviour by creating a file <code class="language-plaintext highlighter-rouge">/etc/apt/preferences</code>.  This is called “pinning”.</p>

<p>Save as <code class="language-plaintext highlighter-rouge">/etc/apt/preferences</code>…</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Package: *
Pin: release o=Debian,a=stable
Pin-Priority: 900

Package: *
Pin: origin www.backports.org
Pin-Priority: 600

Package: *
Pin: release o=Debian,a=testing
Pin-Priority: 400

Package: *
Pin: release o=Debian,a=unstable
Pin-Priority: 300

Package: *
Pin: release o=Debian
Pin-Priority: -1
</code></pre></div></div>

<p>For a fuller description of pinning see the following page:</p>

<ul>
  <li>http://wiki.debian.org/AptPinning</li>
</ul>

<h2 id="saving-and-restoring-package-selections">Saving and restoring package selections</h2>

<p>To save your package selections:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ dpkg --get-selections &gt;filename
</code></pre></div></div>

<p><strong>Remember to save your sources.list and preferences.</strong></p>

<p>To restore your package selections:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ dpkg --set-selections &lt; filename
$ apt-get upgrade-dselect
</code></pre></div></div>


       ]]>
      </description>
    </item>
    
  </channel> 
</rss>
