So sometimes you really don’t want apt to accidentally update a package like Jenkins on your Jenkins server but you would like all the other packages around it to be updated.
Note: This has only been tested on Ubuntu 16.04.
This can be done by running the following command:
$ sudo apt-mark hold <package-name>
To unlock a package run the following command:
$ sudo apt-mark unhold <package-name>
References
https://askubuntu.com/questions/18654/how-to-prevent-updating-of-a-specific-package