How to install a package without marking it as manually installed?

How can I install a debian package but make apt consider it automatically installed? I.e. if I later run apt-get autoremove, this package would be uninstalled.


Solution 1:

The best way I've found is to run:

apt-get install mypackage myotherpackage
apt-mark auto mypackage myotherpackage

If you have aptitude installed, you can also do:

aptitude -o Aptitude::Delete-Unused=false install mypackage+M myotherpackage+M