Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an debian lenny box up and running with apache2 2.11.6 (this was testing stream some month agotesting some)

Now on testing stream is 2.12.1 I want to upgrade my apache2, but not the other software on this machine. So I think:

apt-get upgrade

.. is not an option.

How can I upgrade only single packages?

share|improve this question
up vote 2 down vote accepted
sudo apt-get install apache2
share|improve this answer
This will try to upgrade to latest version – l0c0b0x Aug 25 '09 at 23:04
Are you sure? I think it will remove my testing version and install the stable (2.10.9)? – Peter Parker Aug 25 '09 at 23:06
Only if your version is older than what's there. If you need a newer version, you'll need to build it, or find existing packages built for Lenny. – womble Aug 25 '09 at 23:15
Run the command and see what packages will be removed, installed and upgraded... that way you can be sure your package won't be touched. If it is, then there's some more magic you'll need to do. If your package doesn't show here, I think it would be safe to hit "Y" to go ahead and upgrade Apache2. – l0c0b0x Aug 25 '09 at 23:16
You are right, however now there is no php as module anymore, however this is another problem.. thanx for helping! – Peter Parker Aug 25 '09 at 23:28
  1. add a line for testing to your /etc/apt/sources.list.

    e.g. if you have the following sources.list already

    deb http://your.favourite.mirror/debian/ stable main non-free contrib

    then yank and paste it and change the copy to

    deb http://your.favourite.mirror/debian/ testing main non-free contrib
  2. edit or create /etc/apt/preferences to assign Pinning priorities, like so

    Package: *
    Pin: release a=testing
    Pin-Priority: 100
    Package: *
    Pin: release a=stable
    Pin-Priority: 500
  3. run "apt-get update"

  4. install apache2 from testing (along with all required dependancies) with:

    apt-get -t testing install apache2

from now on, when you run apt-get upgrade or apt-get install it will install packages from stable by default but you can override that at any time with "-t testing" to install specific packages (or even a full upgrade) from testing.

you can do the same thing with "unstable" too. just add it with a lower priority than testing.

personally, i would use unstable instead of testing. in my experience, testing is often more broken than unstable because there are often very long delays in getting crucial updates to migrate from unstable to testing - all it takes is one new (or duplicate) bug to be reported or a slightly new revision to be uploaded to unstable, and the automatic migration of a package from unstable to testing will be delayed for another week or two or more...which is more than enough time for yet another bug report or updated package to be uploaded to unstable to reset the delay all over again.

share|improve this answer
man dpkg

but what about dependencies ?

share|improve this answer
I have installed a lot of other stuff.. I just want to upgrade apache2 (and its dependencies, but not (eg) mysql, perl, python ...etc..) – Peter Parker Aug 25 '09 at 22:57

According to this page apt will try to resolve dependencies from testing if you use this format:

apt-get -t testing install package

But, if you use this other format, it will resolve dependencies from stable:

apt-get install package/testing
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.