Update A Specific Package With apt-get

Mattias Geniar, Tuesday, February 10, 2009 - last modified: Sunday, February 19, 2012

Probably default knowledge to most, but I didn't find it right way. Turns out the "install" parameter, is also the "upgrade" control for a specific package.

If you're trying to update a specific package, do this:

apt-get install <package>

If the package's already installed, the latest version will be installed on top of it. Using "install" as the upgrade parameter -- who comes up with these things. :-)

Here's a useful overview of all apt-get options: apt-get package management cheat sheet.


Hi! My name is Mattias Geniar. I'm a Support Manager at Nucleus Hosting in Belgium, a general web geek, public speaker and podcaster. If you're interested in keeping up with me, have a look at my podcast and weekly newsletter below. For more updates, follow me on Twitter as @mattiasgeniar.

I respect your privacy and you won't get spam. Ever.
Just a weekly newsletter about Linux and open source.

SysCast podcast

In the SysCast podcast I talk about Linux & open source projects, interview sysadmins or developers and discuss web-related technologies. A show by and for geeks!

cron.weekly newsletter

A weekly newsletter - delivered every Sunday - for Linux sysadmins and open source users. It helps keeps you informed about open source projects, Linux guides & tutorials and the latest news.

Share this post

Did you like this post? Will you help me share it on social media? Thanks!

Comments

Wim Deblauwe Thursday, April 7, 2011 at 14:10

Thanks for this, just what I was looking for!

Reply


Ben Friday, April 6, 2012 at 21:16

There are problems with this approach. In most situations, this will work, but there will be times when this approach removes packages that are dependent on the package that is being installed (and never re-installs them). For details, see: https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/969426

You are not alone; this same advice is offered here, too: http://www.ubuntugeek.com/ubuntu-package-management-from-command-line-using-apt-advanced-packaging-tool.html .

I don’t have a better solution to offer, as ‘apt-get upgrade’ does not allow packages to be upgraded selectively (at least according to the published documentation), but I want to warn others who are using this approach in critical production environments.

It is worth noting that Ubuntu’s Update Manager provides for selective package upgrades, but I have no idea how it achieves this marvelous feat.

Reply


    Onilton Tuesday, December 18, 2012 at 13:03

    @Ben

    apt-get install –only-upgrade

    Seem to do the trick ;)

    Reply


Leave a Reply

Your email address will not be published. Required fields are marked *