Restoring mediawiki to another server: Difference between revisions

From Bradnor
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
Line 84: Line 84:
::::<tt>$ su
::::<tt>$ su
::::$ gunzip < /rpbackups/rsync/RP1/var/lib/automsqlbackup/daily/bradnor/bradnor_2019-11-04_06h25m.Monday.sql.gz | mysql bradnor</tt>
::::$ gunzip < /rpbackups/rsync/RP1/var/lib/automsqlbackup/daily/bradnor/bradnor_2019-11-04_06h25m.Monday.sql.gz | mysql bradnor</tt>
:::or, better when using ssh - nohup runs process even if ssh session ends
::::<tt>$ sudo cat <path to backup> > <unpacked file>
:::::e.g. sudo cat bradnor_2019-11-04_06h25m.Monday.sql.gz > bradnor.sql
::::$ sudo nohup mysql <database name> -e "source <unpacked file>" &
:::::e.g. sudo nohup mysql bradnor -e "source bradnor.sql" &
:restore files
:restore files
::restore  the <tt>mediawiki/images</tt> directory and set ownership to user <tt>www-data</tt>
::restore  the <tt>mediawiki/images</tt> directory and set ownership to user <tt>www-data</tt>

Latest revision as of 15:19, 17 April 2025

⇐ Notes

Install mediawiki
  1. Install mysql (or MariaDB)
  2. Install mediawiki
    1. Follow security instructions about ACLs and file ownership [https://www.mediawiki.org/wiki/Manual:Security]
  3. Set up TLS (using Certbot) [https://certbot.eff.org/lets-encrypt/debianbuster-apache]
    1. ssh into server
    2. Install certbot software $ sudo apt-get install certbot python-certbot-apache
    3. Allow script to install and configure apache $ sudo certbot --apache
    4. Test automatic renewal with $ sudo certbot renew --dry-run
  4. Set dynamic DNS
    1. Download the DUC and save the extracted files to: /usr/local/src from [https://my.noip.com/#!/dynamic-dns/duc]
    2. $ sudo cd /usr/local/src/noip-2.1.9.1
    3. $ make
    4. $ make install
    5. Create the configuration file (may have been done by previous step: $ /usr/local/bin/noip2 -C You will be prompted to enter your username and password for No-IP, and for the hostnames you wish to update.
    6. Launch the DUC: $ /usr/local/bin/noip2
    7. Enable at start up (e.g. script in /etc/initd)


Configure mediawiki
Ensure same extensions etc are installed (see Version on Special pages)
Product Version
MediaWiki 1.31.4
PHP 7.3.11-1~deb10u1 (apache2handler)
MariaDB 10.0.28-MariaDB-2+b1
ICU 63.1
Extension Version Licence
Special pages
UserMerge 1.10.1 (86f0e02)19:29, 3 January 2019 GPL-2.0-or-later
Editors
CodeEditor GPL-2.0-or-later AND BSD-3-Clause
WikiEditor 0.5.1 GPL-2.0-or-later
Parser hooks
PDFEmbed 2.0.2 LGPL-3.0-only
Media handlers
PDF Handler GPL-2.0-or-later
for CodeEditor and WikiEditor
these extensions are installed by default and only need enabling and configuring in LocalSettings.php
for PDFHandler, though installed by default, also needs supporting software to install.
sudo apt-get install imagemagick
sudo apt-get install pdf-utils
Can check install by
which gs convert pdfinfo pdftotext
for UserMerge and PDFEmbed
ensure extensions are installed in /var/lib/mediawiki/extensions
LocalSettings.php
note that the LocalSettings.php file may refer to other files that also need transferring
Some parts may have been move to a more secure place, e.g. db and smtp settings
wiki logo file needs to be copied
Restore mediawiki
restore database
Note: the backup has database name hardcoded and so needs editing if database to be restored to different name
run as root
$ gunzip < <path to backup>/<backup e.g. my_wiki_week.18.2016-05-07_15h32m.sql.gz> | mysql my_wiki
or, e.g.
$ su
$ gunzip < /rpbackups/rsync/RP1/var/lib/automsqlbackup/daily/bradnor/bradnor_2019-11-04_06h25m.Monday.sql.gz | mysql bradnor
or, better when using ssh - nohup runs process even if ssh session ends
$ sudo cat <path to backup> > <unpacked file>
e.g. sudo cat bradnor_2019-11-04_06h25m.Monday.sql.gz > bradnor.sql
$ sudo nohup mysql <database name> -e "source <unpacked file>" &
e.g. sudo nohup mysql bradnor -e "source bradnor.sql" &
restore files
restore the mediawiki/images directory and set ownership to user www-data
$ sudo rsync -aHv /rpbackups/rsync/RP1/var/lib/mediawiki-1.36.2/images /var/lib/mediawiki
$ sudo chown -R www-data:www-data /var/lib/mediawiki/images
$ sudo chmod -R go-w /var/lib/mediawiki