Example: https://packages.ubuntu.com/bionic/php7.2
php
package depends on one of:
libapache2-mod-php7.2
php7.2-fpm
php7.2-cgi
Running sudo apt install php
always installs the first of these dependencies, unless one of the others has been installed already. Even running sudo apt install php php-cli
installs the first dependency.
How can I select e.g. php-cgi
in one go ?
So instead of
sudo apt install php-cgi && sudo apt install php
I want something like
sudo apt install --select-dependency php-cgi php
Please note that
php
is just an example, I'm looking for a general answer.
You can provide multiple arguments to
apt install
to dictate which packages you want to install in one go - this is so automated installation scripts and such as well as users can install all the defined packages in a single go rather than trying to do it one by one by one.The general syntax is this:
How the various packages behave with this will vary based on the package and its dependencies.
But in the case of
php
its its own hell to install because in SOME casesapt
is stupid when resolving the dependencies, so if you needphp-cli
just install it and only it:Same behavior for
php-fpm
too orphp-cgi
- just install it, it'll pull in the common dependencies it needs.