Special:Badtitle/NS90:User talk:Gishzida/Notes on HowTo Build a MediaWiki Appliance using the Turnkey Linux LAMP stack ISO to Run All The Tropes

Notes on HowTo Build a MediaWiki Appliance using the Turnkey Linux LAMP stack ISO to Run All The Tropes

My last go at this was using a prebuilt VM with MediaWiki 1.19 installed... but some of the ATT sites extensions will not run with that version. So I chose to take the Turnkey LAMP Stack and install MediaWiki 1.23.5

Note: The following was done on a system running Windows 7 Pro as the Host system with lots of Hard drive space (a non-primary 2 Tb drive with nearly 1 Tb free) and 48 GB of system memory and 2 x quad core Xeon processors-- on other system configurations YMMV.

I chose the "prebuilt" Turnkey Linux LAMP Stack VM which has all of the components needed except for MediaWiki already included. The VM includes Webmin to administer the server, A web browser based virtual console terminal, and PHPMyAdmin to administer the MySQL server. These three things replace the overhead created by using a linux distro with a GUI.

The only thing missing is MediaWiki 1.23.5 which is installed as part of this HowTo

1)Install Virtual Box https://www.virtualbox.org/wiki/Downloads

2) Download the Turnkey Linux LAMP ISO http://www.turnkeylinux.org/lampstack Note this is based on the Debian Linux distro

3) Burn ISO to CD-Rom [Alternate method would be to mount the ISO as a virtual disk at install time]

4) load CD or mount iso

5) Start Virtual Box and create a new host

Host properties: The minimum Drive space should be a minimum of 2.5 times the amount of memory allocated to the machine with the minimum disk size being no smaller than 20 Gb -- The reason for the large disk is because Turnkey Linux allocates the size of memory allocated to hard drive swap space. For example if you allocate 8 Gb of memory to the VM 8 Gb of your Drive space will be allocated to the Swap volume. A small virtual drive allocation will mean your disk will run out of space quickly. A decompressed ATT dump file is 1.6 Gb

If you were to use a Turnkey Linux VM for installation of a personal copy of wikipedia you'd probably need a disk 4 * the size of the wikipedia dump file + the size of memory. enwiki is 11.6 Gb. so that would be 48 Gb plus 8gb of memory

I used a 32 GB disk partition and assigned 8 gb of memory. The net result after the basic system came up was a primary disk volume of about 20 Gb of usable space.

6) Install Turnkey Linux Mediawiki to the new VM

Notes: Just follow the defaults except skip the backup prompts unless you have a Turnkey hosting account.

You will be prompted for enter passwords for root, MySQL root, and MediaWiki Admin

7) In virtual box set the network interface to bridge to the host network interface [the server needs to be able to download updates and packages from the internet)

8) In the Virtual Box Console screen for the Turnkey VM navigate to the Advanced menu>networking to assign a fixed IP for the server.

6) Login to the shell via web browser. https://:12320

Note you may have to allow a certificate security exception if you don't have a register CA SSL certificate. The default is a self signed certificate which will cause a certificate error in most modern browsers.

7) Install the latest patches first. At the console prompt:

apt-get upgrade

press enter.

You may be prompted for additional information.

8) Install the debian java default jre:

at the console prompt type:

apt-get install default-jre

press return

Java is required as the default Turnkey Linux install does not contain java and it is required to import the sql dump file to restore the ATT database using mwdump.jar.

9) Go to the MediaWiki site and choose a method to install.

https://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Ubuntu

You can download the file to your host machine and then up load it to the VM or you can download it directly to your VM.

Either upload the file to /usr/share/ using the file manger or at the command prompt:

cd /usr/share/

press return. This will move you to the folder where the mediawiki folder will be created.

wget http://releases.wikimedia.org/mediawiki/1.23/mediawiki-1.23.5.tar.gz

This downloads the mediawiki installation archive to the /usr/share/ folder where it will be installed.

13)In the Webmin file manager extract the compressed archive and select the option to remove the archive when finished.

14)In the webAdmin file manager select the mediawiki-1.23.5 folder and rename it to mediawiki

15) Before proceeding with the next step-- Take a "snapshot" of your VM. This will allow you to return to this point if something fails or you run into problems with the installation.


 * Important Note About Step 16 ***

The MediaWiki site information does not match the actual state of the TurnkeyLinux host. There is no httpd.conf file. The /etc/apache2/apache.conf file enables two folders which allow symbolic links to add to the configuration of the web daemon. The default symbolic link needs to be removed and a new set of links and a configuration file needs to be created. Step 16 covers these steps.

16) Configure Apache2 so it can access the mediawiki site as follows:

a) Create a folder in /etc named mediawiki

b) in the /etc/mediawiki folder create a document named apache2.conf

The following information should be saved in the /etc/mediawiki/apache2.conf (Between the askarisk lines):

NameVirtualHost *:80 NameVirtualHost *:443

 UseCanonicalName Off ServerAdmin webmaster@localhost DocumentRoot /usr/share/mediawiki/ 

 SSLEngine on   SSLCertificateFile /etc/ssl/certs/cert.pem ServerAdmin webmaster@localhost DocumentRoot /usr/share/mediawiki/ 

 Options +FollowSymLinks -Indexes AllowOverride All order allow,deny allow from all 



c) Using the WebAdmin file manager create a symbolic link in the /etc/apaches2/sites-available folder named mediawiki to /etc/mediawiki/apache2.conf

This makes the site "available" but does not "turn the site on"

d) Using the WebAdmin file manager create a symbolic link in the  /etc/apache2/sites-enabled folder named mediawiki to /etc/apaches2/sites-available/mediawiki

This creates the symbolic link to enable the mediawiki site

This is a security cut-out. If you delete the symbolic link the site becomes unavailable.

e) Remove the 'default' synbolic link from the /etc/apache2/sites-enabled folder

f) At the console type:

apache2ctl restart

press enter. This will allow the new configuration to become available.

17) Open a new web browser and go to http:// a)You should see a page which indicates that MediaWiki is ready to be configured and installed. b)Follow the link to install WediaWiki. c)When prompted save the LocalSettings.php file. d)Upload this file to the /usr/share/mediawiki folder 18) Install lua5.1

apt-get install lua5.1

press return.

19)Install scribunto and variable extensions

Note: see the wikimedia site for the actual extension files and the code to be added to the local settings file. https://www.mediawiki.org/wiki/Category:Extensions

20) Download the latest ATT database dump file from https://static.orain.org/common/dumps/allthetropes/

21) Decompress the zip file-- note that it is 1.6 Gb decompressed.

22) upload the ATT dump.xml file to /home

23) login to phpmyadmin https://:12322

Note: requires the MySQL root password

24) Select the mediawiki database in the left hand pane

25) In the right hand pane click on the the SQL Tab

26) paste the following command into the "run SQL query box":

DELETE FROM page; DELETE FROM text; DELETE FROM revision;

Click the "GO" button.

Note if you fail to perform this step you will get an error shortly after you start the import but the import will continue. If you forgot press Control-C to break import and then go to phpMyAdmin and run the SQL command.

27) At the console type:

java -jar /home/mwdumper.jar --format=sql:1.5 /home/dump.xml | mysql -u root -p mediawiki

press the enter key.

You will be prompted for the MySQL root password.

Note if you forgot to perform Step 26 you will get an error shortly after you start the import but the import will continue. If you forgot press Control-C to break import and then go to phpMyAdmin and run the SQL command

Step 28 is the actual import of the ATT dump into the media wiki

29) Once the dump upload completes [there are approximately 255,359 pages to import] at the console type:

php /usr/share/mediawiki/maintenance/update.php press the enter key.

This will step updates all of the links. This will take a while... 1163022 revisions were made

30) There are a whole bunch of MediaWiki extensions added to ATT. Load as many as you can. Remember that each extension requires an "include" statement and / or variables to be added to the LocalSettings.php file. If an extension does not work. Comment it out with a # sign at the beginning of the line. As tedious as it may seem, install one extension at a time.



Note: My copy of ATT is functioning but I am getting an "script error" of some pages such as the "Bleach/Characters" Pages. The error message reports "Script Error: No such module as Subpages 2"

Caveats: I cut some corners in writing this up... I discovered that the MediaWiki documentation does not match the way Turnkey built their system image. Fortunately I had made enough mistakes and kept a previous version that I could piece together what was missing.

There are a lot of extensions that ATT uses some of these are not needed for a "private, non-public" copy.