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
Installed: (none)
Candidate: 5.0.32-7etch12
Version table:
5.0.32-7etch12 0
500 etch/updates/main Packages
5.0.32-7etch8 0
500 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”


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