Difference between revisions of "Mediawiki setup"

From DiLab
Jump to: navigation, search
(New page: === Things to edit in Localsettings.php === Restricting edits only to registered users: $wgGroupPermissions['*']['edit'] = false; Disable new users from registering $wgGroupPermissio...)
 
Line 1: Line 1:
=== Things to edit in Localsettings.php ===

Restricting edits only to registered users:
$wgGroupPermissions['*']['edit'] = false;

Disable new users from registering
$wgGroupPermissions['*']['createaccount'] = false;

Restrict all pages but a few readable by the registered users
$wgWhitelistRead = array ("Main Page", "Special:Userlogin", "Wikipedia:Help");
$wgGroupPermissions['*']['read'] = false;


=== Creating another wiki on the same webserver ===
=== Creating another wiki on the same webserver ===


Line 18: Line 5:
* assign the appropriate permissions to directories and
* assign the appropriate permissions to directories and
* visit the wiki (http://localhost/wiki2) for configuration. Make sure that the database name, user and table prefix are different for this wiki.
* visit the wiki (http://localhost/wiki2) for configuration. Make sure that the database name, user and table prefix are different for this wiki.


=== Recovering wiki after upgrade ===

This is what happened: I upgraded Ubuntu to 8.04 and all of a sudden my wiki was unreachable... Investigation showed that there is a new mediawili installed, wiping almost all of the old configuration, including the /var/lib/mediawiki-?? with links.

Luckily I had the Localhost.php with settings in the old /etc/mediawiki-?? directory that was not wiped. After investigating I found that the content of the wiki remained in the mysql database. That gave me a hope, and this is what I did:

* recreated mysql passwords for the wikiuser and mysql-root. You can reset root password - stop mysql and start the daemon with no-

** reset mysql root password
sudo /etc/init.d/mysql stop
sudo mysqld --skip-grant-tables
mysql -u root
mysql> UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
mysql> FLUSH PRIVILEGES; command.
mysql> exit
sudo mysqladmin shutdown -u root
sudo /etc/init.d/mysql start

** Change mysql wikiuser password
$ mysql -u root -p
mysql> use mysql;
mysql> update user set password=PASSWORD("NEWPASSWORD") where User='wikiuser';
mysql> flush privileges;
mysql> quit

* created a new root directory for the wiki (actually several for several wiki's)
sudo mkdir /var/lib/wiki

* used lndir to create links in the new directory
cd /var/lib/wiki
lndir <insert your parameters here>

* added the following fragment to set up mediawiki with apache2: create/add this in /etc/mediawiki/apache.cnf

Alias /wiki /var/lib/wiki
#=== My wiki ===
<Directory /var/lib/wiki/>
Options +FollowSymLinks
AllowOverride All
order allow,deny
allow from all
</Directory>
# some directories must be protected
<Directory /var/lib/wiki/config>
Options -FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/lib/wiki/upload>
Options -FollowSymLinks
AllowOverride None
</Directory>

* made sure /etc/apache2/conf.d has a link to the file above (in /etc/mediawiki/apache.conf)


* started web pointing to http://example.com/wiki and
* set all the parameters as before, except using the new mysql passwords as appropriate.
* compared the newly created Localsettings.php with my old (if present) and copied that into /var/lib/wiki, and set the permissions so that it could not be changed by anyone or read by anyone but the www-data (webserver).

Revision as of 16:47, 3 October 2008

Creating another wiki on the same webserver

  • create a new directory (say wiki2) in the document root.
  • lndir the /opt/mediawiki to the new directory,
  • assign the appropriate permissions to directories and
  • visit the wiki (http://localhost/wiki2) for configuration. Make sure that the database name, user and table prefix are different for this wiki.


Recovering wiki after upgrade

This is what happened: I upgraded Ubuntu to 8.04 and all of a sudden my wiki was unreachable... Investigation showed that there is a new mediawili installed, wiping almost all of the old configuration, including the /var/lib/mediawiki-?? with links.

Luckily I had the Localhost.php with settings in the old /etc/mediawiki-?? directory that was not wiped. After investigating I found that the content of the wiki remained in the mysql database. That gave me a hope, and this is what I did:

  • recreated mysql passwords for the wikiuser and mysql-root. You can reset root password - stop mysql and start the daemon with no-
    • reset mysql root password
 sudo /etc/init.d/mysql stop
 sudo mysqld --skip-grant-tables
 mysql -u root 
 mysql> UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
 mysql> FLUSH PRIVILEGES; command. 
 mysql> exit
 sudo mysqladmin shutdown -u root
 sudo /etc/init.d/mysql start
    • Change mysql wikiuser password
 $ mysql -u root -p
 mysql> use mysql;
 mysql> update user set password=PASSWORD("NEWPASSWORD") where User='wikiuser';
 mysql> flush privileges;
 mysql> quit
  • created a new root directory for the wiki (actually several for several wiki's)
sudo mkdir /var/lib/wiki
  • used lndir to create links in the new directory
cd /var/lib/wiki
lndir <insert your parameters here>
  • added the following fragment to set up mediawiki with apache2: create/add this in /etc/mediawiki/apache.cnf
Alias /wiki /var/lib/wiki

#=== My wiki ===
<Directory /var/lib/wiki/>
       Options +FollowSymLinks
       AllowOverride All
       order allow,deny
       allow from all
</Directory>

# some directories must be protected
<Directory /var/lib/wiki/config>
       Options -FollowSymLinks
       AllowOverride None
</Directory>
<Directory /var/lib/wiki/upload>
       Options -FollowSymLinks
       AllowOverride None
</Directory>
  • made sure /etc/apache2/conf.d has a link to the file above (in /etc/mediawiki/apache.conf)


  • started web pointing to http://example.com/wiki and
  • set all the parameters as before, except using the new mysql passwords as appropriate.
  • compared the newly created Localsettings.php with my old (if present) and copied that into /var/lib/wiki, and set the permissions so that it could not be changed by anyone or read by anyone but the www-data (webserver).