How to exclude a package from apt-get autoremove?
Use apt-mark
$ man apt-mark
...
manual
manual is used to mark a package as being manually installed, which will
prevent the package from being automatically removed if no other packages
depend on it.
So
sudo apt-mark manual <package-name>
Now autoremove
won't remove it.
To undo
sudo apt-mark auto <package-name>
Now autoremove
will remove the package if it is not a dependency of any other package.
A few more Google attempts brought up a solution:
It is either possible to just install explicitly:
sudo apt-get install <package>
or marking as manually installed via
sudo apt-mark manual <package>
apt
won't re-install, the output will just look like:
$ sudo apt-get install tmux
Reading package lists... Done
Building dependency tree
Reading state information... Done
tmux is already the newest version.
tmux set to manually installed.