- At least 6-8GB of RAM (of those 4GB will be used for a virtual machine)
- At least 3GB of diskspace (depends on your dump data size)
- 1 - many hours of time (depends on your network speed and dump data size)
- MacOSX 10.13.6
- Homebrew 2.1.6
- Vagrant 2.2.5
- Virtualbox 6.0.10
- CentOS 7.6
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew cask install virtualbox
$ brew cask install vagrant
$ vagrant plugin install vagrant-vbguest
$ vagrant plugin install vagrant-scp
The following commands download a Vagrant box for CentOS 7 from their server. It takes time.
$ vagrant box add centos/7
Select 3 (VirtualBox)
$ mkdir CentOS7; cd CentOS7
$ vagrant init centos/7
$ mv Vagrantfile Vagrantfile.orig
The following command installs CentOS 7 to your virtual machine along with required libraries. It takes time.
$ vagrant up
$ vagrant ssh
[vagrant@localhost ~]$
Source of the following steps: https://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Red_Hat_Linux
[vagrant@localhost ~]$ sudo systemctl start mariadb
[vagrant@localhost ~]$ sudo mysql_secure_installation
...
Enter current password for root (enter for none):
...
Set root password? [Y/n] n
...
Remove anonymous users? [Y/n] Y
...
Disallow root login remotely? [Y/n] Y
...
Remove test database and access to it? [Y/n] Y
...
Reload privilege tables now? [Y/n] Y
...
[vagrant@localhost ~]$ mysql -u root -p
Enter password:
...
MariaDB [(none)]> CREATE USER 'wiki'@'localhost' IDENTIFIED BY 'wikipedia0';
MariaDB [(none)]> CREATE DATABASE jawiki;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON jawiki.* TO 'wiki'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| jawiki |
| mysql |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)
MariaDB [(none)]> SHOW GRANTS FOR 'wiki'@'localhost';
+-------------------------------------------------------------------------------------------------------------+
| Grants for wiki@localhost |
+-------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'wiki'@'localhost' IDENTIFIED BY PASSWORD '*D47E25F7211229630BE824987D144C13C91A9464' |
| GRANT ALL PRIVILEGES ON `jawiki`.* TO 'wiki'@'localhost' |
+-------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
MariaDB [(none)]> exit;
[vagrant@localhost ~]$
[vagrant@localhost ~]$ cd
[vagrant@localhost ~]$ wget https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.0.tar.gz
[vagrant@localhost ~]$ wget https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.0.tar.gz.sig
[vagrant@localhost ~]$ gpg --verify mediawiki-1.33.0.tar.gz.sig mediawiki-1.33.0.tar.gz
[vagrant@localhost ~]$ cd /var/www
[vagrant@localhost www]$ sudo tar -zxf /home/vagrant/mediawiki-1.33.0.tar.gz
[vagrant@localhost www]$ sudo ln -s mediawiki-1.33.0/ mediawiki
[vagrant@localhost www]$ sudo chown -R apache:apache /var/www/mediawiki
[vagrant@localhost www]$ sudo chown -R apache:apache /var/www/mediawiki-1.33.0
[vagrant@localhost www]$ sudo vi /etc/httpd/conf/httpd.conf
...
(Line 119) DocumentRoot "/var/www/mediawiki" # <- DocumentRoot "/var/www/html"
...
(Line 131) <Directory "/var/www/mediawiki"> # <- <Directory "/var/www/html">
...
(Line 157) DirectoryIndex index.html index.html.var index.php # <- Add this line
...
[vagrant@localhost www]$ sudo systemctl start httpd
- Go to http://192.168.33.10/
- Click Please set up the wiki first.
- Select your language
- Make sure you're ready with green message
- DB Settings
- Host: localhost
- DB Name: jawiki
- DB User name: wiki
- DB User password: wikipedia0
- Next, next
- MediaWiki Settings
- Wikiname: Wikipedia
- User name: root
- User password: wikipedia0
- Next, next, next
LocalSetting.php
will be automatically downloaded
The following command is from your host machine not the VM
$ vagrant scp ~/Downloads/LocalSettings.php /home/vagrant/
The following command is from the VM not your host machine
[vagrant@localhost www]$ sudo cp /home/vagrant/LocalSettings.php mediawiki
[vagrant@localhost www]$ sudo chown -R apache:apache mediawiki/LocalSettings.php
Go to http://192.168.33.10/index.php
[vagrant@localhost ~]$ wget https://extdist.wmflabs.org/dist/extensions/Scribunto-REL1_33-8328acb.tar.gz
[vagrant@localhost ~]$ sudo tar -xzf Scribunto-REL1_33-8328acb.tar.gz -C /var/www/mediawiki/extensions
[vagrant@localhost ~]$ sudo chown -R apache:apache /var/www/mediawiki-1.33.0
[vagrant@localhost ~]$ sudo chmod a+x /var/www/mediawiki/extensions/Scribunto/includes/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic/lua
[vagrant@localhost ~]$ sudo vi /var/www/mediawiki/LocalSettings.php
wfLoadExtension( 'Scribunto' ); # <- Add this line at the end
$wgScribuntoDefaultEngine = 'luastandalone'; # <- Add this line at the end
[vagrant@localhost ~]$ wget https://extdist.wmflabs.org/dist/extensions/MassMessage-REL1_33-22e7d07.tar.gz
[vagrant@localhost ~]$ sudo tar -xzf MassMessage-REL1_33-22e7d07.tar.gz -C /var/www/mediawiki/extensions
[vagrant@localhost ~]$ sudo chown -R apache:apache /var/www/mediawiki-1.33.0
[vagrant@localhost ~]$ sudo vi /var/www/mediawiki/LocalSettings.php
wfLoadExtension( 'MassMessage' ); # <- Add this line at the end
[vagrant@localhost ~]$ wget https://extdist.wmflabs.org/dist/extensions/TemplateStyles-REL1_33-c76fd84.tar.gz
[vagrant@localhost ~]$ sudo tar -xzf TemplateStyles-REL1_33-c76fd84.tar.gz -C /var/www/mediawiki/extensions
[vagrant@localhost ~]$ sudo chown -R apache:apache /var/www/mediawiki-1.33.0
[vagrant@localhost ~]$ sudo vi /var/www/mediawiki/LocalSettings.php
wfLoadExtension( 'TemplateStyles' ); # <- Add this line at the end
[vagrant@localhost www]$ cd
[vagrant@localhost ~]$ wget https://dumps.wikimedia.org/jawiki/latest/jawiki-latest-pages-articles.xml.bz2
- Dry run
[vagrant@localhost ~]$ php /var/www/mediawiki/maintenance/importDump.php --dry-run --conf /var/www/mediawiki/LocalSettings.php --server="http://192.168.33.10/" jawiki-latest-pages-articles.xml.bz2
100 (246.16 pages/sec 246.16 revs/sec)
200 (328.81 pages/sec 328.81 revs/sec)
300 (345.88 pages/sec 345.88 revs/sec)
400 (389.64 pages/sec 389.64 revs/sec)
500 (433.00 pages/sec 433.00 revs/sec)
600 (448.71 pages/sec 448.71 revs/sec)
700 (475.27 pages/sec 475.27 revs/sec)
800 (475.92 pages/sec 475.92 revs/sec)
900 (481.52 pages/sec 481.52 revs/sec)
1000 (489.51 pages/sec 489.51 revs/sec)
...
2403900 (1056.31 pages/sec 1056.31 revs/sec)
2404000 (1056.32 pages/sec 1056.32 revs/sec)
Done!
You might want to run rebuildrecentchanges.php to regenerate RecentChanges,
and initSiteStats.php to update page and revision counts
[vagrant@localhost ~]$
- Formal run
[vagrant@localhost ~]$ php /var/www/mediawiki/maintenance/importDump.php --conf /var/www/mediawiki/LocalSettings.php --server="http://192.168.33.10/" jawiki-latest-pages-articles.xml.bz2
This will take forever, like few days to complete for a large dump. Alternatively, you can try other dump data from Wikimedia Downloads.
- Go to http://192.168.33.10/index.php
- Click Ctrl+Option+X (or Ctrl+Alt+X) to show randomly selected pages
The following commands could be run when uploading is completed.
[vagrant@localhost ~]$ sudo php /var/www/mediawiki/maintenance/rebuildrecentchanges.php
[vagrant@localhost ~]$ sudo php /var/www/mediawiki/maintenance/initSiteStats.php --update
[vagrant@localhost ~]$ exit
$ vagrant halt
- Read How to increase a VM's disk space to increase the disk size.
- Read How to use a new partition as MariaDB's data folder to use the increased disk space to store MySQL data.