3

I just installed and configured MediaWiki on Ubuntu Server 10.04. I've now copied the instance in /usr/share/mediawiki/ to a different directory to run as a separate instance, and would like to reset it to a clean state so that it takes me through initial configuration again.

How can I do this without uninstalling and starting again?

Captain Blammo
  • 213
  • 1
  • 3
  • 8

2 Answers2

3

This should be as simple as just adding a second database to your MySQL (or chosen SQL system) and then resetting your config file to allow you to start the installation from scratch.

cd /var/www/mediawiki
cp LocalSettings.php LocalSettings.php.old
nano LocalSettings.php 

Place in the new details and then kickstart your install.

Glenn Kelley
  • 1,294
  • 6
  • 10
  • 1
    I hope you don't mind me answering myself after going away and playing around. I just thought it best to share my results. Thanks for the help! – Captain Blammo Nov 24 '10 at 01:27
2

We're going to delete some files, so back them up first if you want a copy for later reference.


Short version:

cd/usr/local/mediawiki    
sudo rm -f LocalSettings.php
sudo rm -f config/LocalSettings.php

Now open your wiki in a browser. It will walk you through initial setup again.


Long Version:

The default installation directory in Ubuntu server is /usr/local/mediawiki, softlinked from /var/www/mediawiki. If you have copied the directory elsewhere, just use that path instead in the following example. Depending on your user privileges, you may want to log in as root or sudo all of the following commands.

cd /usr/local/mediawiki
ls -l
  1. You should see a LocalSettings.php file. This is a real file or a symlink to /etc/mediawiki/LocalSettings.php, which you can delete instead if you prefer. If you are using multiple wikis, though, it is helpful to replace all of these symlinks with local copies.

    rm -f LocalSettings.php

  2. you should also see a config directory. If you don't you can create one thus:

    ln -s /var/lib/mediawiki/config ./config
    

    Now you can remove the generated config file (which doesn't actually get used, just copied to the proper location)

    rm -f config/LocalSettings.php
    

Now if you hop over to your wiki in a browser, you will be prompted to go through initial setup again. This will generate the config/LocalSettings.php file again, allowing you to copy it to your install dir.

cp config/LocalSettings.php ./

Under Ubuntu, I changed the permissions and the user to my web server user for security:

chmod 700 LocalSettings.php
chown www-data LocalSettings.php
Captain Blammo
  • 213
  • 1
  • 3
  • 8