Upgrade from 1.2 to 1.3

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search
Ambox outdated content.svg

This page is kept for historical interest. Its content is outdated or may be wrong.

You may find more up-to-date information on the www.mediawiki.org website.

MediaWiki logo
Blue Glass Arrow.svg MediaWiki.svg
A proposal to move this page to MediaWiki.org was rejected.
Because the Template:MoveToMediaWiki tag was on the page for a year without any MediaWiki.org importers seeing fit to transwiki it, the move proposal was regarded as rejected by the MediaWiki.org community.

See also: http://meta.wikipedia.org/wiki/How_to_move_a_MediaWiki_Database

Aaron's attempt, beta 3

Aaron Peterson, alpeterson@wsu.edu http://escargot.icehouse.net/mediawiki is attempting to upgrade his media wiki, here are his commands, in order.

Ironically, this is also the procedure that I use to upgrade between minor releases. It might be possible to just copy over the LocalSettings.php (when your upgrading from 1.3.x to 1.3.y) but I always rebuild it anyway...

in brief[edit]

Outsider interjection here - I found an overview of what to do, from another user in the what not to do (?) sub-page useful, in that it was a concise overview; sometimes you need concise general directions, other times detailed walk-throughs. This process worked to upgrade my own wiki install and is a loose re-reworking of that overview:

  1. Back up 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. Restart apache.
  10. You probably don't need to do anything special like manually copy your old localsettings.php or tweak variables in it to be sure your setup matches (but why not check)

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

getting started[edit]

irc channel[edit]

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

download[edit]

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[edit]

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[edit]

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[edit]

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

examine previous settings[edit]

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!)

make mediawiki not accept edits[edit]

shutdown apache[edit]

/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. (Another option is to create a lock file to disable edits, but this is not as safe.)

in new versions there is a variable to set that will lock the database[edit]

$wgReadOnly="we are upgrading mediawiki, please be patient";

database back-up[edit]

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[edit]

(I use gentoo linux, your flavor may vary)

vi /etc/apache2/conf/commonappache2.conf

don't show .php source if php isn't loaded[edit]

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[edit]

<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[edit]

/etc/init.d/apache2 start

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

Reconfiguring mediawiki[edit]

what worked for the last step[edit]

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[edit]

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[edit]

  • look at your includes/DefaultSettings.php

variables of interest:

$wgScriptPath       = "/mediawiki";

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

[edit]

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[edit]

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[edit]

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