6

In Ubuntu, the most convenient way to get a system up to date is to call apt-get update followed by apt-get upgrade. However, on a system that is part of a production environment, it is common practice to test the updates first on an offline system and then apply the very same updates that have been tested on the production system. I wonder if this is possible with apt-get upgrade - is there a way to specify the upgrade in more detail, e.g. by specifying a date until when the upgrade is to be performed?

steffi_b
  • 63
  • 1
  • 4

3 Answers3

5

Once you have tested the upgrades, you can manually upgrade only those specific packages you have tested on the production server with:

apt-get install somepackage=someversion
psusi
  • 3,347
  • 1
  • 17
  • 9
0

If you want to specify a date when the upgrade is to be performed, you should cron it.

If you're going to do a wholesale upgrade, then put this in your crontab with the desired date:

/usr/sbin/apt-get update --yes

If you want to only do specific updates, then I suggest using the format from @psusi above and put each package into the list again with the --yes flag.

The --yes flag simply answers yes to any questions that come up so the install won't hang waiting for someone to press a key. Of course, auto-yessing your upgrades is only sane once you've fully tested them on dev.

jdw
  • 3,855
  • 2
  • 17
  • 21
  • Since you only want the upgrade to be done once, `at` would be a more appropriate choice than `cron`. – psusi Sep 26 '11 at 17:34
  • I don't get from the question that he only wants the upgrade to be done once, but assuming that is so, then I agree at is a better choice. – jdw Sep 26 '11 at 23:03
  • The command in question is to upgrade package X ( after it has been tested ), so I presume that once that package has been upgraded, you don't need to run that command again. Also I just noticed that the command you listed is wrong. `apt-get update` just updates the package cache, to actually upgrade a specific package ( to which --yes would be applicable ) you want `apt-get install`. – psusi Sep 27 '11 at 01:02
  • The cron job would be the solution if the update itself is to be scheduled, but I needed a solution to specify updates to make sure that the production system gets the same updates as the test system. So the answer from psusi was what I needed, but thanks for the other valuable infos as well. – steffi_b Sep 28 '11 at 07:51
0

This is only a start, but you can at least see what is about to be changed...

 apt-get --simulate upgrade

So on the dev/qa system you run that and save the output; it has the full package names and their versions. Then do your actual upgrade. Then on the production systems you can use the --simulate. You'd then at least know if the upgrade will be the same as you did on the dev/qa.

You're still stuck having to manually do the upgrade package by package, if by the time you get around to doing a prod machine, there's actually something newer.