How to install a package greater than or equal to a particular version

A script requires a ruby version greater than or equal to 1.9. How do I translate that to apt command? Tried below, does not work:

 % sudo apt-get install "ruby ( >= 1.9.1 )"
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package ruby ( >


 % sudo apt-get install "ruby>=1.9.1"      
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package ruby>

apt does not support specifying version ranges to install a package. You can only either specify the exact version you want it to take, or you omit the version to let it decide automatically.

To find out what versions of a package are available for you, the output of

apt policy PACKAGENAME

will be helpful, e.g. for ruby on 16.04:

ruby:
  Installed: (none)
  Candidate: 1:2.3.0+1
  Version table:
     1:2.3.0+1 500
        500 http://ftp.uni-stuttgart.de/ubuntu xenial/main amd64 Packages
        500 http://ftp.uni-stuttgart.de/ubuntu xenial/main i386 Packages

The version above corresponds to Ruby 2.3 btw.

So in this example, you could install either ruby to let the system automatically pick the only available version, or you could specify it explicitly as ruby=1:2.3.0+1.

The command to install the desired package will be one of

sudo apt install PACKAGENAME
sudo apt install PACKAGENAME=VERSION

In Ubuntu 18.04 and above, apt does support version ranges.

For example, this will install to the latest version of Docker above version 19.03:

apt install --upgrade docker-ce>=19.03

In theory, I think this same mechanism could be used to install "The latest Docker version greater then19.03, but less than Docker version 20", like the following, but it doesn't work for me:

apt install --upgrade docker-ce>=5:19.03\ \<5:20