Backing up the wiki

Mediawiki Dump Generator
You can easily generate a database dump and file dump using the Mediawiki Client Tools' Mediawiki Dump Generator Python 3 dumpgenerator script, (full instructions are at this link).

The result will include an XML dump with full page history, a dump of all images and files along with associated descriptions and a siteinfo.json file containing information about features, such as the installed extensions and skins.

To dump a private wiki you will have to use a login that has at least read permission on the wiki.

Restoring from backup
See MediaWiki.org for more detailed instructions, (specifically Manual:Importing XML dumps and Manual:importImages.php).

After installing MediaWiki and extensions, in the shell use importDump.php to import the XML, this can take a long time. e.g. from the mediawiki folder

If that works repeat without --dry-run. It won't matter if the XML dump file has the file extension .gz or .bz2 (is compressed).

Due to the bug T206683 it may be necessary to also include  in the command.

Afterwards use ImportImages.php to import the images

Afterwards run  in order to update the content of Special:Recentchanges.