You can also hold a package, so it won't get auto-removed while running sudo apt-get autoremove
command.
sudo apt-mark hold <package-name>
To unhold the holded package,
sudo apt-mark unhold <package-name>
Example:
$ sudo apt-get -s autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
apache2-bin apache2-data libapr1 libaprutil1 libaprutil1-dbd-sqlite3
libaprutil1-ldap
0 upgraded, 0 newly installed, 6 to remove and 13 not upgraded.
Remv apache2-bin [2.4.7-1ubuntu4]
Remv apache2-data [2.4.7-1ubuntu4]
Remv libaprutil1-ldap [1.5.3-1]
Remv libaprutil1-dbd-sqlite3 [1.5.3-1]
Remv libaprutil1 [1.5.3-1]
Remv libapr1 [1.5.0-1]
$ sudo apt-mark hold apache2-bin
apache2-bin set on hold.
$ sudo apt-get -s autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
apache2-data
0 upgraded, 0 newly installed, 1 to remove and 13 not upgraded.
Remv apache2-data [2.4.7-1ubuntu4]