Changes
m
→Back up the MediaWiki files: - s/backup/back up/g
{{H:h|system admin toc}}
It's possible to move or duplicate a wiki running the MediaWiki software to another server. This is often needed when moving to a new web host or domain, or both.
==Versions and upgrading==
The instructions on this page should apply more or less evenly to any given version of MediaWiki. Ensure, prior to moving, that any upgrading of the software and database schema is done. You should avoid moving the database from an older version of the software into a newer version; this will not work.
==Overview==
#Back up the database
#Back up the MediaWiki files
#Re-create the database, user and permissions
#Import the database backup
#Import the MediaWiki files
#Check the configuration file
#Test
==Back up the database==
You need to back up the database in which MediaWiki stores its information, including pages, users, system messages, etc. This can be done using the [http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html mySQL backup] or [http://dev.mysql.com/doc/refman/5.0/en/mysqlhotcopy.html mySQL hot backup] tools, or third-party administrative tools such as the popular [http://phpmyadmin.sourceforge.net phpMyAdmin].
Ensure that a complete dump of the entire database is made, including the [[en:database schema|schema]] structure and the data. Consult the documentation for the utilities you are using to find out how this is done. You should end up with a '''.sql''' script file.
See [[Database dump and restore examples]] for some examples on how to dump and restore the database.
==Back up the MediaWiki files==
The easiest method with which to back up the configuration, images, extensions and other customisations to the software is to back up the entire directory in which MediaWiki resides. You will probably want to place these in an [[en:file archiver|archive]] for ease of transferring between servers, e.g. a [[en:Tar (file format)|tar]] or [[en:ZIP (file format)|zip]] archive.
==Re-create the database, user and permissions==
On the destination server, create a new mySQL database and a user, and grant that user permissions on the database. SELECT, INSERT, UPDATE and DELETE permissions should suffice. You may need to consult the [http://dev.mysql.com/doc/ mySQL documentation], your hosting provider's control panel documentation, or the documentation of any other utilities you are using for information on how to do this.
'''Note:''' It doesn't matter if the database doesn't have the same name; indeed, in a commercial hosting environment, where database names are usually prefixed with a hosting account username, a different database name is almost guaranteed. In addition, the username can differ, as can that user's password.
==Import the database backup==
The next step is to import the database backup you made earlier. This will create the tables in the database and populate them with data. Following this point, you will have a duplicate of the database on the other server. Again, according to the means you are using to manage your mySQL databases, the process for this varies. You may need to upload the '''.sql''' script file from earlier to your server via FTP, or this may be done for you by the utilities you are using. Consult the documentation to find out how it's done.
After importing, which takes a variable amount of time, depending upon the number of pages, users, edits, etc. in your wiki, you should have circa 20-25 tables in the new database.
===Possible methods===
Possible methods for performing the import include:
* '''[http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html mysqldump]'''
* [http://www.phpmyadmin.net/home_page/index.php phpMyAdmin] or a similar tool
* The command-line console, '''[http://dev.mysql.com/doc/refman/5.0/en/batch-commands.html mysql]'''
===PhpMyAdmin method===
<!-- to complete -->
==Import the MediaWiki files==
The final "large" step in the moving process is to upload/copy the MediaWiki files to the destination server. If you followed the instructions above, and backed up the entire directory, this will include the images and extensions directories, plus custom skins, etc. and the configuration file.
If you backed up only portions of the directory, e.g. images, extensions, etc. then you will need to first upload/copy a fresh install of the MediaWiki files, then transfer the backed-up directories and files into the correct locations in the new filesystem.
;Notes
*If following the latter process, ensure that your "fresh install" consists of the same version of MediaWiki as the old one did
*Check that the upload directory has the correct permissions set if using uploads; it needs to be writable by the web server
==Check the configuration file==
The final, real task is to tweak the ''LocalSettings.php'' file. Certain entries in this will almost undoubtedly require changing, and you may need to change the database connection information as well.
Check the following configuration options:
{|border="1" cellpadding="4" cellspacing="0"|
|'''$IP'''||Needs to be correct for the paths on the new server
|-
|'''$wgScriptPath'''||Needs to be correct for the path on the new server
|-
|'''$wgDBserver'''||Check the database server name is correct
|-
|'''$wgDBname'''||This might have changed in a shared hosting environment
|-
|'''$wgDBuser'''||This might have changed in a shared hosting environment
|-
|'''$wgDBpassword'''||Check this is correct for the new user
|}
You might also need to check the paths to diff, ImageMagick, etc.
==Test==
At this point, attempt to access the wiki on the new server and use it. Log in as a sysop and a regular user and check that viewing, creating and editing pages still works. You will need to fix any problems reported either by PHP or MediaWiki itself.
It's possible to move or duplicate a wiki running the MediaWiki software to another server. This is often needed when moving to a new web host or domain, or both.
==Versions and upgrading==
The instructions on this page should apply more or less evenly to any given version of MediaWiki. Ensure, prior to moving, that any upgrading of the software and database schema is done. You should avoid moving the database from an older version of the software into a newer version; this will not work.
==Overview==
#Back up the database
#Back up the MediaWiki files
#Re-create the database, user and permissions
#Import the database backup
#Import the MediaWiki files
#Check the configuration file
#Test
==Back up the database==
You need to back up the database in which MediaWiki stores its information, including pages, users, system messages, etc. This can be done using the [http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html mySQL backup] or [http://dev.mysql.com/doc/refman/5.0/en/mysqlhotcopy.html mySQL hot backup] tools, or third-party administrative tools such as the popular [http://phpmyadmin.sourceforge.net phpMyAdmin].
Ensure that a complete dump of the entire database is made, including the [[en:database schema|schema]] structure and the data. Consult the documentation for the utilities you are using to find out how this is done. You should end up with a '''.sql''' script file.
See [[Database dump and restore examples]] for some examples on how to dump and restore the database.
==Back up the MediaWiki files==
The easiest method with which to back up the configuration, images, extensions and other customisations to the software is to back up the entire directory in which MediaWiki resides. You will probably want to place these in an [[en:file archiver|archive]] for ease of transferring between servers, e.g. a [[en:Tar (file format)|tar]] or [[en:ZIP (file format)|zip]] archive.
==Re-create the database, user and permissions==
On the destination server, create a new mySQL database and a user, and grant that user permissions on the database. SELECT, INSERT, UPDATE and DELETE permissions should suffice. You may need to consult the [http://dev.mysql.com/doc/ mySQL documentation], your hosting provider's control panel documentation, or the documentation of any other utilities you are using for information on how to do this.
'''Note:''' It doesn't matter if the database doesn't have the same name; indeed, in a commercial hosting environment, where database names are usually prefixed with a hosting account username, a different database name is almost guaranteed. In addition, the username can differ, as can that user's password.
==Import the database backup==
The next step is to import the database backup you made earlier. This will create the tables in the database and populate them with data. Following this point, you will have a duplicate of the database on the other server. Again, according to the means you are using to manage your mySQL databases, the process for this varies. You may need to upload the '''.sql''' script file from earlier to your server via FTP, or this may be done for you by the utilities you are using. Consult the documentation to find out how it's done.
After importing, which takes a variable amount of time, depending upon the number of pages, users, edits, etc. in your wiki, you should have circa 20-25 tables in the new database.
===Possible methods===
Possible methods for performing the import include:
* '''[http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html mysqldump]'''
* [http://www.phpmyadmin.net/home_page/index.php phpMyAdmin] or a similar tool
* The command-line console, '''[http://dev.mysql.com/doc/refman/5.0/en/batch-commands.html mysql]'''
===PhpMyAdmin method===
<!-- to complete -->
==Import the MediaWiki files==
The final "large" step in the moving process is to upload/copy the MediaWiki files to the destination server. If you followed the instructions above, and backed up the entire directory, this will include the images and extensions directories, plus custom skins, etc. and the configuration file.
If you backed up only portions of the directory, e.g. images, extensions, etc. then you will need to first upload/copy a fresh install of the MediaWiki files, then transfer the backed-up directories and files into the correct locations in the new filesystem.
;Notes
*If following the latter process, ensure that your "fresh install" consists of the same version of MediaWiki as the old one did
*Check that the upload directory has the correct permissions set if using uploads; it needs to be writable by the web server
==Check the configuration file==
The final, real task is to tweak the ''LocalSettings.php'' file. Certain entries in this will almost undoubtedly require changing, and you may need to change the database connection information as well.
Check the following configuration options:
{|border="1" cellpadding="4" cellspacing="0"|
|'''$IP'''||Needs to be correct for the paths on the new server
|-
|'''$wgScriptPath'''||Needs to be correct for the path on the new server
|-
|'''$wgDBserver'''||Check the database server name is correct
|-
|'''$wgDBname'''||This might have changed in a shared hosting environment
|-
|'''$wgDBuser'''||This might have changed in a shared hosting environment
|-
|'''$wgDBpassword'''||Check this is correct for the new user
|}
You might also need to check the paths to diff, ImageMagick, etc.
==Test==
At this point, attempt to access the wiki on the new server and use it. Log in as a sysop and a regular user and check that viewing, creating and editing pages still works. You will need to fix any problems reported either by PHP or MediaWiki itself.