Ubuntu APT


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

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

lsb_release -a can check current ubuntu version

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

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.
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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s