Updating drupal

Here's what I need to to to update drupal (minor updates, e.g. from 7.18 to 7.19) on my Ubuntu server. I have installed drupal from the drupal source itself and not from the Ubuntu repository (because the Ubuntu repository is usually quite old and not updated as frequently). Actually the update is quite painless; I am sure somebody automated that already somewhere...
cd /var/www
wget http://ftp.drupal.org/files/projects/drupal-7.19.tar.gz
tar -xvzf drupal-7.19.tar.gz
chown -R jeltsch:www-data drupal-7.19
rm drupal-7.19.tar.gz
cp -a drupal-7.18/sites/ drupal-7.19/

The above cp command makes a copy of the complete site, which can take a long time and use lots of disk space. Instead, you can delete the "sites" subdirectory in the new drupal folder and make a link to the old "sites" subdirectory:

cd drupal-7.19
rm -rf sites
ln -s ../drupal-sites/ sites

Here you should log into your site and put it into maintenance mode!
mysqldump -u root -p --databases drupal7_jeltsch_org drupal7_claudia_jeltsch_org drupal7_lammertlab_org > drupal7_all.sql
rm drupal7
ln -s drupal-7.19/ drupal7

Here you should click the link to the update script. After the updates were successfully performed you can put your site online again.
Drupal 9
Updating Drupal 9 is most easily done using composer:
composer update "drupal/core-*" --with-all-dependencies
Also the modules can be updated. However, in my case the update was not always targeting the module that was actually in use but a module that was lower in the priority list in some other directory. For minor version updates:
composer update drupal/modulename --with-dependencies
For major version updates:
composer require drupal/modulename:^2.0
After this, don't forget to visit https://yoursite.com/update.php!