install specific version of debian package with apt

Let’s say you have multiple version of a package that are available and you want to install a specific one.
We will use ‘mysql-server-5.0’ package for our example:

remy@r12925:~$ apt-cache policy mysql-server-5.0
mysql-server-5.0:
Installed: (none)
Candidate: 5.0.32-7etch12
Version table:
5.0.32-7etch12 0
500 http://security.debian.org etch/updates/main Packages
5.0.32-7etch8 0
500 ftp://mir1.ovh.net etch/main Packages

5.0.32-7etch5 0
100 /var/lib/dpkg/status

You want to install bolded version of mysql-server-5.0 package.
Nothing easier!!
Simply run apt with following syntax:

apt-get install <package-name>=<version>

In our case, I would run “sudo apt-get install mysql-server-5.0=5.0.32-7etch8”

sources

2 Comments: Trackback URL | Comments RSS

  1. Steve Kroon Says:

    What do you do if the version you want doesn’t show up in the apt-cache policy command?

  2. remy Says:

    you need to update /etc/apt/sources.list accordingly or to do it through gui interface, go to System / Administration / Software sources in ubuntu

Post a Comment

Your email is never published nor shared. You're allow to say what you want...


Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/remydamo/websites/qc4blog/www/wp-content/plugins/sweetcaptcha-revolutionary-free-captcha-service/library/sweetcaptcha.php on line 81

Warning: fsockopen() [function.fsockopen]: unable to connect to www.sweetcaptcha.com:80 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /home/remydamo/websites/qc4blog/www/wp-content/plugins/sweetcaptcha-revolutionary-free-captcha-service/library/sweetcaptcha.php on line 81