MediaWiki - Moving and upgrading MediaWiki
I need to transfer my MediaWiki from Machine A to Machine B. So, why not upgrading it since I am still using V1.25.1 of MediaWiki. Upgrading it to V1.32.1 (latest as of May 2019) would be nice.
Below are the guide with the assumption that XAMPP is used as the backbone. Note: MediaWiki V1.32 supports only up to PHP 7.2.x. So, please make sure you have download the correct version of XAMPP.
1) Start up MediaWiki at Machine A . And next, we need to backup MediaWiki from Machine A. At Machine A, launch XAMPP control panel
Then launch Shell
At the Shell, perform a database backup with
mysqldump -u your_wikidb_user -p your_wikidb_dbname > backup.sql
It will dump the database content to backup.sql file.
Note: If you forget about your username, password and/or dbname of MediaWiki datastore, you could try your luck at htdoc/"MediaWiki_Dir"/LocalSettings.php
LocalSettings.php contains the setting of MediaWiki. For database specific information, look for wgDBname, wgDBuser, wgDBpassword.
2) Assuming that you had created a database backup, next step is to backup the file system of the MediaWiki with the following command
tar -zcvf your_mediawiki.tar.gz /path/to/your_mediawiki
The idea is to tar up the entire MediaWiki directory under htdocs.
3) Transfer for the database backup and MediaWiki file system backup to Machine B.
4) Downloaded the latest version of XAMPP from https://www.apachefriends.org/download.html to Machine B. At the time of writing, it is V7.3.5
5) Install XAMPP at Machine B. It is a Windows installer and trivial.
A side note, you need to make sure the Apache server (both HTTP and HTTPS) and MySQL hostname and port for XAMPP correctly.
6) Start MySQL server from XAMPP control panel
7) Launch Shell from XAMPP control panel
8) In the Shell, launch mysql command prompt with
mysql -u root
XAMPP default MySQL administrator is root and it does not have a password
9) Run the following SQL to setup database for MediaWiki
#Create empty database and user
CREATE DATABASE 'your_wikidb_dbname';
CREATE USER 'your_wikidb_user'@'localhost' IDENTIFIED BY 'your_wikidb_user_pwd';
#Grant user access
USE 'your_wikidb_dbname';
GRANT ALL PRIVILEGES ON your_wikidb_dbname.* TO 'your_wikidb_user'@'localhost' WITH GRANT OPTION;
#Exit the command prompt
exit
10) Next, import your database backup to newly created database at Machine B with command
mysql -u your_wikidb_user -p your_wikidb_dbname < backup.sql
11) Download the V1.32.1 of MediaWiki
12) Untar the MediaWiki download and rename the unpackaged folder as your_mediawiki. Put your_mediawiki into XAMPP htdocs directory. For me, it is c:/xampp/htdocs/your_mediawiki
13) Next, untar the MediaWiki filesystem backup from Machine A at some temporary location at Machine B with
tar -xvf your_mediawiki.tar.gz
14) You need to copy the following from the backup into the XAMPP htdoc location
12) Then, you need to verify the setting at LocalSettings.php. For me, I setup Machine B with the same configuration as Machine A, but yet, I still need to update wgServer parameter to fix the servername. You could also use this time to rename database user and other configuration.
13) Update the database schema. Navigate to maintenance folder and run
php update.php
14) Start up Apache server and you should be able to access the wiki
Below are the guide with the assumption that XAMPP is used as the backbone. Note: MediaWiki V1.32 supports only up to PHP 7.2.x. So, please make sure you have download the correct version of XAMPP.
1) Start up MediaWiki at Machine A . And next, we need to backup MediaWiki from Machine A. At Machine A, launch XAMPP control panel
Then launch Shell
At the Shell, perform a database backup with
mysqldump -u your_wikidb_user -p your_wikidb_dbname > backup.sql
It will dump the database content to backup.sql file.
Note: If you forget about your username, password and/or dbname of MediaWiki datastore, you could try your luck at htdoc/"MediaWiki_Dir"/LocalSettings.php
LocalSettings.php contains the setting of MediaWiki. For database specific information, look for wgDBname, wgDBuser, wgDBpassword.
2) Assuming that you had created a database backup, next step is to backup the file system of the MediaWiki with the following command
tar -zcvf your_mediawiki.tar.gz /path/to/your_mediawiki
The idea is to tar up the entire MediaWiki directory under htdocs.
3) Transfer for the database backup and MediaWiki file system backup to Machine B.
4) Downloaded the latest version of XAMPP from https://www.apachefriends.org/download.html to Machine B. At the time of writing, it is V7.3.5
5) Install XAMPP at Machine B. It is a Windows installer and trivial.
A side note, you need to make sure the Apache server (both HTTP and HTTPS) and MySQL hostname and port for XAMPP correctly.
6) Start MySQL server from XAMPP control panel
7) Launch Shell from XAMPP control panel
8) In the Shell, launch mysql command prompt with
mysql -u root
XAMPP default MySQL administrator is root and it does not have a password
9) Run the following SQL to setup database for MediaWiki
#Create empty database and user
CREATE DATABASE 'your_wikidb_dbname';
CREATE USER 'your_wikidb_user'@'localhost' IDENTIFIED BY 'your_wikidb_user_pwd';
#Grant user access
USE 'your_wikidb_dbname';
GRANT ALL PRIVILEGES ON your_wikidb_dbname.* TO 'your_wikidb_user'@'localhost' WITH GRANT OPTION;
#Exit the command prompt
exit
10) Next, import your database backup to newly created database at Machine B with command
mysql -u your_wikidb_user -p your_wikidb_dbname < backup.sql
11) Download the V1.32.1 of MediaWiki
12) Untar the MediaWiki download and rename the unpackaged folder as your_mediawiki. Put your_mediawiki into XAMPP htdocs directory. For me, it is c:/xampp/htdocs/your_mediawiki
13) Next, untar the MediaWiki filesystem backup from Machine A at some temporary location at Machine B with
tar -xvf your_mediawiki.tar.gz
14) You need to copy the following from the backup into the XAMPP htdoc location
- LocalSettings.php
- The images directory
- extensions if any
- The skins directory
- Custom log in resources/assets
12) Then, you need to verify the setting at LocalSettings.php. For me, I setup Machine B with the same configuration as Machine A, but yet, I still need to update wgServer parameter to fix the servername. You could also use this time to rename database user and other configuration.
13) Update the database schema. Navigate to maintenance folder and run
php update.php
14) Start up Apache server and you should be able to access the wiki
Comments
Post a Comment