backup Mediawiki

2019-07-10  本文已影响0人  陈灿贻

Problem

How to move mediawiki from ubuntu to wsl?

Solution

Notation

Old mediawiki is in Server 1. We'd like to back up it, then scp to Server 2, finally restore from it in Server 2.

backup database in Service 1

$wgReadOnly = 'Dumping Database, Access will be restored shortly';

this can be removed as soon as the dump is completed.

mysqldump --default-character-set=binary -u root -p -h localhost --opt wikidb > wikidb-backup.sql

For more, See Mysqldump_from_the_command_line, and Back up in schedule

backup website in Service 1
tar czpvf mediawiki-1.23.13-backup.tar.gz /var/www/html

Restore in Service 2

Import the database backup

On the server on which you are restoring MediaWiki, ensure you have

mkdir mediawiki_backup && cd mediawiki_backup/
cp /mnt/c/Users/chencanyi/Videos/wikidb-backup.sql ~/mediawiki_backup/ # or you can use scp
mysqladmin -u wikiuser -p drop wikidb
mysqladmin -u wikiuser -p create wikidb
mysql -u wikiuser -p wikidb < wikidb-backup.sql
php /var/www/html/maintenance/update.php

Import the MediaWiki files

Assuming you are in Service 1.

scp ubuntu@Service1:~/mediawiki_backup/mediawiki-1.23.13-backup.tar.gz ~/mediawiki_backup/
cd ~/mediawiki_backup/
tar -xvzf mediawiki-1.23.13-backup.tar.gz
rm -fR [wikifolder]/
mv ./var/www/html [wikifolder]
sudo service apache2 restart
sudo service mysql restart

Check the configuration file

Something more

cd /var/www/html
vi LocalSettings.php
# Something like 
## Database settings
$wgDBtype = "mysql";
$wgDBserver = "localhost";
$wgDBname = "wikidb";
$wgDBuser = "root";
$wgDBpassword = "***";

References

  1. https://m.mediawiki.org/wiki/Special:MyLanguage/Manual:Moving_a_wiki
  2. https://blog.lilydjwg.me/2011/5/28/story-of-migrating-mediawiki.27048.html
  3. Manual:Restoring a wiki from backup
  4. Manual:Backing up a wiki
  5. https://blog.csdn.net/setoy/article/details/6562287
上一篇 下一篇

猜你喜欢

热点阅读