Ubuntu: How does one automate apt-get commands such as update and upgrade? [duplicate]


This question already has an answer here:

As an administrator to many Ubuntu servers that run on AWS - sometimes I cannot keep track of what servers need package updates and when. Is there a way to automate this process in a sense where running sudo apt-get update and sudo apt-get upgrade is just done automatically?

EDIT: This is in question to running Ubuntu 16.04 LTS servers.


Disclaimer: I am not a Linux expert, merely someone trying to gain a level of expertise. I use ucaresystem-core in the terminal. It's automatic in the sense that it automates the sequence of commands that would otherwise be required. I suggest you visit https://www.ostechnix.com/ucaresystem-core-basic-maintenance-tool-ubuntu/. However, for full automation it seems that you might need to transition to the use of snaps.


You didn't say what version of Ubuntu you are running but since you are managing servers that are ostensibly in a production environment, I'll assume it's 16.04 LTS or something similarly stable. If so, the Software updater should take care of making sure that everything is patched to the latest stable version.

You can of course (as root) cron

apt-get update and

apt-get upgrade  


but there is a small downside using that approach as discussed on other threads on this site. Primarily, the issue is that packages available through the software updater have gone through an additional step of limited user testing that you don't get by using apt-get.

And of course some updates, notably kernel updates, that require a reboot to take effect. In a production environment you'll probably want to schedule any reboot for a maintenance window.

There is also a risk that an unattended upgrade could go wrong so I've always found value in watching the messages as package upgrades are performed to ensure that everything went smoothly.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »