Few TIPs for Ubuntu APT:

  1. apt dist-upgrade will upgrade and remove packages, while apt upgrade will only upgrade.

  2. apt purge will remove any installed file including config, while apt remove will only remove installed package.

  3. lsb_release -a can check current ubuntu version

  4. apt-cache policy <package> can check available package version and source:

    $ sudo apt-cache policy python-django
    
    python-django:
    Installed: (none)
    Candidate: 1.7.6-1ubuntu2.3~cloud0
    Version table:
    1.7.6-1ubuntu2.3~cloud0 0
    500 http://ubuntu-cloud.archive.canonical.com/ubuntu/ trusty-updates/kilo/main amd64 Packages
    1.6.11-0ubuntu1 0
    500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
    1.6.1-2ubuntu0.16 0
    500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
    1.6.1-2 0
    500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
    
  5. To change priority to use 1.6.11 as candidate, need to create file underĀ /etc/apt/preferences.d with name like pin-600:

    Package: python-django
    Pin: origin us.archive.ubuntu.com
    Pin-Priority: 600
    

than when policy looks at the list, it will see 1.6.11 has higher priority and use it as candidate to install.

```bash
python-django:
Installed: (none)
Candidate: 1.6.11-0ubuntu1
Package pin: 1.6.11-0ubuntu1
Version table:
1.7.6-1ubuntu2.3~cloud0 600
500 http://ubuntu-cloud.archive.canonical.com/ubuntu/ trusty-updates/kilo/main amd64 Packages
1.6.11-0ubuntu1 600
500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
1.6.1-2ubuntu0.16 600
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
1.6.1-2 600
500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
```
  1. To make a particular version higher than other version for docker-ce
    Package: docker-ce
    Pin: version 17.03.1*
    Pin-Priority: 600