Should I use tasksel, tasks in APT or install regular metapackages?
Tasksel or plain Apt?
In the past I've always used tasksel
to install so-called "tasks". It seems, however, that this has been integrated in APT:
apt-cache dumpavail | grep ^Task
[...] snip
Task: lamp-server
[...]
and that I can install such "tasks" by appending a caret (^
) to it, like this:
sudo apt-get install lamp-server^
Is this equivalent to the following?
sudo tasksel install lamp-server
And which is preferred?
Metapackages
Additionally, how do metapackages come into play here? Some tasks seem not to be a metapackage while others are:
apt-cache show lamp-server
N: Unable to locate package lamp-server
apt-cache show kubuntu-desktop
Package: kubuntu-desktop
[...]
Task: kubuntu-desktop
So, using the last example, what is the difference between the following three possible ways to install?
sudo apt-get install kubuntu-desktop
sudo apt-get install kubuntu-desktop^
sudo tasksel install kubuntu-desktop
In short: There is a difference between tasksel and apt-get installation process of tasks.
Looking at your example:
The apt-get way
sudo apt-get install 'lamp-server^'
will evaluate to do the following:
- Search the cache (package list files) for all "Task:" fields and get all with "lamp-server".
-
Install those packages the standard way:
sudo apt-get install package1 package2...
The tasksel way
sudo tasksel install lamp-server
will look for a task called "lamp-server" in one of its configuration files under /usr/share/tasksel/**/*.desc
:
- Search the configuration files for a "Task:" field named "lamp-server".
- Check if all prerequisites are available ("Key:" field) and remember them if not installed.
- Choose method to select packages ("Packages:" field). If this ist "list" simply install following packages by name.
- Read all following package names and pass it to previously selected method to generate package names.
- Look for
/usr/lib/tasksel/info/lamp-server.preinst
. If it exists execute this script. -
Install packages with apt-get using following command:
debconf-apt-progress -- apt-get -q -y -o APT::Install-Recommends=true -o APT::Get::AutomaticRemove=true install package1 package2 ...
Look for
/usr/lib/tasksel/info/lamp-server.postinst
. If it exists execute this script.
Conclusion
tasksel is more powerful in processing and selecting tasks. It can execute extra scripts before/after installation/removal of tasks. And the biggest benefit: You can modify tasks and create new ones very easily. It is not possible to edit an official package list file without drawbacks (valid signature).
Back to your first question:
In your special case both commands are almost equivalent (supposed you have enabled both APT::Install-Recommends
and APT::Get::AutomaticRemove
). Only difference is the extended package state of mysql-server
and apache2
dependencies (set to "manually installed" with plain apt-get).
And what about metapackages?
If you don't make use of tasksel's features like selecting tasks (especially helpful at installation) and executing extra commands before and after some task blocks then a task is very similar to a metapackage. The difference is: A task is not registered as a package in APT cache.
So if you uninstall one task-dependency other task-deps aren't marked as auto-installed because they were explicitely installed. If you uninstall a metapackage the dependencies are removed with autoremove
because their extended package state is "auto installed" (if not installed manually).
Note: All distributed tasks in Debian install a metapackage named task-TASKNAME
.
Giving your example:
-
sudo apt-get install kubuntu-desktop
- Will install the metapackage
kubuntu-desktop
. Dependencies are "auto installed".
- Will install the metapackage
-
sudo apt-get install kubuntu-desktop^
- Will select all packages tagged with task "kubuntu-desktop". That are all dependencies of metapackage
kubuntu-desktop
. They all are marked as "manually installed".
- Will select all packages tagged with task "kubuntu-desktop". That are all dependencies of metapackage
-
sudo tasksel install kubuntu-desktop
- Make sure X is installed before installing packages of task.
- Will install the metapackage
kubuntu-desktop
. Dependencies are "auto installed".