Upgrade from 1.3 to 1.4

From Meta, a Wikimedia project coordination wiki
This is an archived version of this page, as edited by Ngungo (talk | contribs) at 21:36, 8 February 2005. It may differ significantly from the current version.

ngungo, ngungo@56degrees.com http://viettrans.org/mediawiki-1.4beta6/ is attempting to upgrade his media wiki, here are his commands, in order.

in brief

  1. Backup the database (in case something goes wrong installing)
  2. Unrar the new mediawiki version into its own new folder
  3. Redirect (symlink) trafic (from the old wiki folder) to that new folder
  4. chmod the new wiki folder's /config directory to 777 (everyone can do everything with it)
  5. Point your browser to the wiki's index.php or config/index.php
  6. Fill out that install form
  7. Move the generated localsettings.php in /config up one directory
  8. chmod the /config directory back to non-readable, writable, or executable
  9. Replace the /images directory with the old /images
  10. Restart apache.


--Mr alex hall 18:28, 19 Dec 2004 (UTC)

getting started

irc channel

open irc channel to #MediaWiki on irc.freenode.net #mediawiki

download

go to http://wikipedia.sourceforge.net or http://www.sf.net/projects/wikipedia to get the latest version

(retrieved from wikipedia.sourceforge.net --click project page in lower left)

extract

su 
cd /var/www/localhost
mv /home/aaron/mediawiki-1.3.0-beta3.tar.gz ./
tar -xvvzf media<tab>
(old mediawiki was in the mediawiki folder, I plan to
  just symlink versions, or change my apache conf to alias the directories) 

the directory listing

root@escargot localhost # ls -lah
total 2.0M
drwxr-xr-x   9 root   root    4.0K Jun 23 22:22 .
drwxr-xr-x   4 root   root    4.0K Oct 23  2003 ..
drwxr-xr-x   2 root   root    4.0K Jun  5 02:00 cgi-bin
drwxr-xr-x   3 root   root    4.0K Sep 26  2003 error
drwxr-xr-x  58 apache apache  8.0K Jun  2 14:09 htdocs
drwxr-xr-x   3 root   root    4.0K Sep 26  2003 icons
drwxr-xr-x  11 apache apache  4.0K Jun 23 22:14 mediawiki
drwxr-xr-x  14    501 dialout 4.0K Jun 12 18:25 mediawiki-1.3.0beta3
-rw-r--r--   1 aaron  users   1.4M Jun 12 18:28 mediawiki-1.3.0beta3.tar.gz
drwxr-xr-x   2 root   root    4.0K May 11 19:57 perl
-rw-r--r--   1 root   root    617K Jun 23 22:23 wikidb-wikiuser-mediawiki-1.2.6-
2004-06-23
root@escargot localhost #

well now.. this is scarry.. I don't have a user 501 or a group dialout.. and.. yikes.. my permissions might be bad for my /var/www/localhost .. please email me (alpeterson@wsu.edu)

fix permissions

chown -R apache mediawiki-1.3.0beta3
chgrp -R apache mediawiki-1.3.0beta3

examine previous settings

vi ./mediawiki/Local<tab>
I see this information, at about line 76
$wgDBserver         = "localhost"
$wgDBname           = "wikidb";
$wgDBuser           = "wikiuser";
$wgDBpassword   (and the password.. which is secret!)

shutdown apache

/etc/init.d/apache2 stop  (start it later... with start!)

This step technically isn't necessary to backup the database, but if your wiki is publicly available this will prevent any database changes during backup, which could leave your backup in an inconsistent state.

database back-up

It's a good time to backup your database every time you get a new version of mediawiki. This is especially important when you are upgrading from 1.2x to 1.3x because the database undergos a conversion that is not easily reversable. It's also not extremely well tested because there aren't many installations of mediawiki out there.

so the command is:

mysqldump -u wikiuser -p wikidb > wikiuser-wikidb-mediawiki-1.2.6-2004-06-23.sql

(replace usernames and database names, and dates, and versions with appropriate ones, etc)

mysqldump -u <wikiuser> -p <wikidatabase>  >  <something memorable.sql>

apache conf

(I use gentoo linux, your flavor may vary)

vi /etc/apache2/conf/commonappache2.conf

don't show .php source if php isn't loaded

protect myself from leaking passwords from .php files.

<IfModule !sapi_apache2.c>
  <Files ~ '\.php$'>
       Order allow,deny
       Deny from all
       Allow from none
  </Files>
  <Files ~ '\.phps'>
       Order deny,allow
       Allow from all
  </Files>
</IfModule>

and importantly:

alias the mediawiki directory to the proper directory

<IfModule sapi_apache2.c>
   Alias /mediawiki/ /var/www/localhost/mediawiki-1.3.0beta3/
   Alias /mediawiki /var/www/localhost/mediawiki-1.3.0beta3
   <Directory /var/www/localhost/mediawiki-1.3.0beta3/>
       Options +includes
       Order deny,allow
       Allow from all
   </Directory>
#    <Location /mediawiki>
#       Options +includes
#    <Location>
</IfModule>

start apache

/etc/init.d/apache2 start

(or simply restart it if you didn't stop it earlier)

Reconfiguring mediawiki

what worked for the last step

follow regular installation instructions

escargot localhost # chown -R apache mediawiki-1.3.2
escargot localhost # chgrp -R apache mediawiki-1.3.2
escargot mediawiki-1.3.2 # chmod o+w config
  • (now go to http://localhost/mediawiki/ or where ever you put it in your browser)
  • click on the configure your wiki link (There was a problem with it in 1.3.2, I had to type in the configure/index.php )
  • You already have your database configured, so you don't need the rootdb password, but you do need to fill in the rest of the stuff
escargot mediawiki-1.3.2 # chmod o-w config
escargot mediawiki-1.3.2 # cp config/LocalSettings.php ./
escargot mediawiki-1.3.2 # pwd
/var/www/localhost/mediawiki-1.3.2
  • and you should be done..

You should see output similar to what's in: 1.3 install success

  • You'll probably want to copy over your wiki.png, and other custom skins too..


remember to fill in the same database information as was in the last LocalSettings.php / how you setup the database last time. I did not need the root db password, or restore my database.

Restoring Customizations

I have been keeping a symlink called /var/www/localhost/mediawiki pointed to the latest version of mediawiki. I do that by doing:

cd /var/www/localhost
rm mediawiki
ln -s mediawiki-latest mediawiki

tweak your new LocalSettings.php

  • look at your includes/DefaultSettings.php

variables of interest:

$wgScriptPath       = "/mediawiki";

$wgStylePath        = "$wgScriptPath/stylesheets";
$wgStyleDirectory   = "$IP/stylesheets";
$wgLogo             = "$wgStylePath/images/wiki.png";

I set my $wgLogo as follows so I don't have to copy the logo over manually.

$wgLogo = "$wgStylePath/../../wiki_persistant/wiki.png"

I also had to add an extra alias to my commonapache2.conf

copy logo over manually

escargot images # cp ../../../mediawiki-1.3.1/stylesheets/images/wiki.png ./
cp: overwrite `./wiki.png'? y
escargot images # pwd
/var/www/localhost/mediawiki/stylesheets/images
escargot images # ls -lah /var/www/localhost/mediawiki
lrwxrwxrwx  1 root root 15 Aug 31 04:43 /var/www/localhost/mediawiki -> mediawiki-1.3.2
escargot images #  

What NOT to do

/What didn't work is what i tried first, instead of simply following the regular web install.