How to upgrade a single package using apt-get?

You just need to do apt-get install --only-upgrade <packagename>. This will upgrade only that single package, and only if it is installed.

If you wish to install the package if it doesn't exist, or upgrade it if it does, you may leave out --only-upgrade.


In order to update a single package using the CLI:

sudo apt-get install --only-upgrade <packagename>

e.g., sudo apt-get install --only-upgrade ack

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Skipping **ack**, it is not installed and only upgrades are requested.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

There are two possible ways I can think of:

  1. sudo apt-get install nameofpackage

    This will upgrade the package even if is already installed:

    ~$ sudo apt-get install emesene
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages will be upgraded:
      emesene
    1 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
    Need to get 1,486 kB of archives.
    After this operation, 696 kB disk space will be freed.
    Get:1 http://il.archive.ubuntu.com/ubuntu/ natty-updates/universe emesene all 2.11.4+dfsg-0ubuntu1 [1,486 kB]
    
  2. UsingSynaptic Package Manager: Right click→Mark for upgrade:

    enter image description here

    Note: Sometimes it may asks for additional packages or dependencies, it is normal.

Tags:

Upgrade

Apt