It is often recommended to install updates before installing other packages, we can create a Cron job that will run these commands on a daily basis.
List existing Cron jobs
Create a new Cron job
Now add this line to the
crontab which will run daily at midnight
0 0 * * * sudo apt update && sudo apt --yes upgrade