Difference between revisions of "MediaWiki:Migrate from old server to new server"

From ppwiki
Jump to navigation Jump to search
(Created page with "Mediawiki is the same software used in Wikipedia. In this tutorial, we are going to move an existing wiki we have already setup to another server. The wiki we are moving is th...")
 
 
(25 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
=Prerequisites=
 
=Prerequisites=
- 1 data base server : db1006.dfw.labnet
+
- 1 data base server : db1006.dfw.labnet: IP = 10.192.48.7
- 1 Mediawiki server : mw1002.dfw.labnet
+
 
- PHP 7.3,
+
- 1 Mediawiki server : mw1002.dfw.labnet: IP = 10.192.48.8
- 10.1.38-MariaDB  
+
 
- Nginx 1.17  
+
- PHP 7.3
 +
 +
- 10.1.38-MariaDB
 +
 +
- Nginx 1.17
 +
 
- Debain Stretch (9)
 
- Debain Stretch (9)
 +
 +
=Installation=
 +
==Data base server installtion and configuration==
 +
The database server (db1006.dfw.labnet) is running Debian Stretch 9 with MariaDb version 10.1.38. We will not cover the installing of Debian and MariaDB in this tutorial. Once you have your database serve ready, create a databasese for your new Wiki. See Database information below
 +
 +
- Database base name : wikipp
 +
 +
- Database user name: rootwiki
 +
 +
- Privileges:
 +
 +
GRANT USAGE ON *.* TO 'rootwiki'@'mw1002.dfw.labnet'
 +
GRANT ALL PRIVILEGES ON `wikipp`.* TO 'rootwiki'@'mw1002.dfw.labnet'
 +
 +
==Mediawiki server installtion and configuration==
 +
The mediawiki server (mw1002) is running Debian Stretch 9 install:
 +
 +
- PHP 7.3
 +
 +
- Niginx 1.17
 +
 +
- php-luasandbox : this is needed otherwise when you run the update.php script, you will have a lot of errors.
 +
 +
sudo apt-get install php-luasandbox
 +
 +
- create a repertory under /srv named mediawiki
 +
  sudo mkdir /srv/mediawiki
 +
  sudo chown www-data:www-date /srv/mediawiki
 +
  sudo chmod 0755 /srv/mediawiki
 +
 +
===Niginx configuration===
 +
server {
 +
        listen 443 ssl http2;
 +
        listen [::]:443 ssl http2;
 +
        server_name mw1002.dfw.labnet;
 +
        root /srv/mediawiki;
 +
        index index.php;
 +
        ssl_certificate /etc/ssl/certs/wildcard.tx.labnet.crt;
 +
        ssl_certificate_key /etc/ssl/private/wildcard.tx.labnet.key;
 +
        add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload";
 +
        charset utf-8;
 +
        gzip on;
 +
        gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
 +
        location / {
 +
                try_files $uri $uri/ /index.php?$query_string;
 +
        }
 +
        location /api/v0 {
 +
                try_files $uri $uri/ /api_v0.php?$query_string;
 +
        }
 +
        location ~ \.php {
 +
  #            include fastcgi.conf;
 +
                include fastcgi_params;
 +
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
 +
                fastcgi_pass unix:/var/run/php/fpm-www.sock;
 +
                fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
 +
        }
 +
}
 +
 +
 +
I will have to open port 443 on my UFW
 +
sudo ufw allow 443
 +
 +
==Mediawiki installation==
 +
===Download Mediawiki===
 +
Navigate to /tmp and download the lastest Mediawiki version
 +
cd /tmp
 +
wget https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.0.tar.gz
 +
Extract the tar.gz to /srv/mediawiki
 +
tar xvzf mediawiki-1.33.0.tar.gz -C /srv/mediawiki
 +
===Install Mediawiki===
 +
The process of installing Mediawiki is very simple.
 +
 +
Open your web browser and enter your web server IP address, server name or domain name. Since I am in a lab environment, I will use the server IP address.
 +
https://10.192.48.8
 +
 +
==Copy files from old server to new server==
 +
===Old server===
 +
- Database
 +
If you are using MYSQL like me, backup your database using the mysqldump command . if your wiki is hosted with a third party, you can use their portal to backup your database too. Once the database backed up, restore it to your new database for the new wiki.
 +
 +
- Folders to copy.
 +
 +
You need to copy also your:
 +
 +
- images folder
 +
 +
- extention folder
 +
 +
- skin folder
 +
 +
Last you need to copy your LocalSettings.php file as well.
 +
 +
===New server===
 +
Restore the database from your old server
 +
 +
Copy all the folders from old server as well
 +
 +
Replace the LocalSettings.php with the one from your old server.
 +
 +
==New server configuration==
 +
Open the LocalSettings.php file and change the Database information and the IP address to match your new wiki.

Latest revision as of 02:59, 11 April 2020

Mediawiki is the same software used in Wikipedia. In this tutorial, we are going to move an existing wiki we have already setup to another server. The wiki we are moving is the same wiki I am writing this tutorial on (https://papaulgigitech.com). I am going to move this wiki to a local server in a lab environment.

Prerequisites

- 1 data base server : db1006.dfw.labnet: IP = 10.192.48.7

- 1 Mediawiki server : mw1002.dfw.labnet: IP = 10.192.48.8

- PHP 7.3

- 10.1.38-MariaDB

- Nginx 1.17

- Debain Stretch (9)

Installation

Data base server installtion and configuration

The database server (db1006.dfw.labnet) is running Debian Stretch 9 with MariaDb version 10.1.38. We will not cover the installing of Debian and MariaDB in this tutorial. Once you have your database serve ready, create a databasese for your new Wiki. See Database information below

- Database base name : wikipp

- Database user name: rootwiki

- Privileges:

GRANT USAGE ON *.* TO 'rootwiki'@'mw1002.dfw.labnet'
GRANT ALL PRIVILEGES ON `wikipp`.* TO 'rootwiki'@'mw1002.dfw.labnet'

Mediawiki server installtion and configuration

The mediawiki server (mw1002) is running Debian Stretch 9 install:

- PHP 7.3

- Niginx 1.17

- php-luasandbox : this is needed otherwise when you run the update.php script, you will have a lot of errors.

sudo apt-get install php-luasandbox

- create a repertory under /srv named mediawiki

 sudo mkdir /srv/mediawiki
 sudo chown www-data:www-date /srv/mediawiki
 sudo chmod 0755 /srv/mediawiki

Niginx configuration

server {
       listen 443 ssl http2;
       listen [::]:443 ssl http2;
       server_name mw1002.dfw.labnet;
       root /srv/mediawiki;
       index index.php;
       ssl_certificate /etc/ssl/certs/wildcard.tx.labnet.crt;
       ssl_certificate_key /etc/ssl/private/wildcard.tx.labnet.key;
       add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload";
       charset utf-8;
       gzip on;
       gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
       location / {
               try_files $uri $uri/ /index.php?$query_string;
       }
       location /api/v0 {
               try_files $uri $uri/ /api_v0.php?$query_string;
       }
       location ~ \.php {
 #             include fastcgi.conf;
               include fastcgi_params;
               fastcgi_split_path_info ^(.+\.php)(/.+)$;
               fastcgi_pass unix:/var/run/php/fpm-www.sock;
               fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
       }
}


I will have to open port 443 on my UFW

sudo ufw allow 443

Mediawiki installation

Download Mediawiki

Navigate to /tmp and download the lastest Mediawiki version

cd /tmp
wget https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.0.tar.gz

Extract the tar.gz to /srv/mediawiki

tar xvzf mediawiki-1.33.0.tar.gz -C /srv/mediawiki

Install Mediawiki

The process of installing Mediawiki is very simple.

Open your web browser and enter your web server IP address, server name or domain name. Since I am in a lab environment, I will use the server IP address.

https://10.192.48.8

Copy files from old server to new server

Old server

- Database If you are using MYSQL like me, backup your database using the mysqldump command . if your wiki is hosted with a third party, you can use their portal to backup your database too. Once the database backed up, restore it to your new database for the new wiki.

- Folders to copy.

You need to copy also your:

- images folder

- extention folder

- skin folder

Last you need to copy your LocalSettings.php file as well.

New server

Restore the database from your old server

Copy all the folders from old server as well

Replace the LocalSettings.php with the one from your old server.

New server configuration

Open the LocalSettings.php file and change the Database information and the IP address to match your new wiki.