On Ubuntu and Debian Linux, you can use the “apt-mark” command to hold back packages, which means that the package will not be upgraded when you run the “apt-get upgrade” command. Here’s an example of how you can hold back a package:
- First, use the command “apt-mark showhold” to view the list of packages that are currently held back.
- To hold a package, use the command “sudo apt-mark hold package_name” replacing “package_name” with the name of the package you want to hold.
- For example, if you want to hold back the package “nginx”, you would use the command “sudo apt-mark hold nginx”.
- You can check if the package is on hold by running the command “apt-mark showhold” again
- To unhold the package, use the command “sudo apt-mark unhold package_name”
- It’s important to note that the “apt-mark hold” command only works for packages that were installed using the apt package manager and only works for packages that are already installed.
- Additionally, you can use the option “apt-get –no-upgrade package_name” this will prevent the package from being updated on the next “apt-get upgrade” command.
- Also, you can use the option “apt-get install package_name=version” to install a specific version of a package, this will prevent the package from being updated to a new version.
It’s important to note that, Holding back a package can cause security vulnerabilities and software bugs, so it’s recommended to hold back a package only if it’s really necessary and you know the consequences.