Install & Configure MediaWiki -CentOS/Ubuntu




MediaWiki is a free software wiki package written in PHP, originally for use on Wikipedia. It is now used by several other projects of the non-profit Wikimedia Foundation and by many other wikis, including this website, the home of MediaWiki.
There are many wiki software available. you can pick most suitable one for you from. If you wish to use Mediawiki, this article will help you through installation & configuration. Mediawiki is

Installing MediaWiki
Install Dependencies
CentOS

yum install httpd mysql-server php php-mysql php-pear -y
service httpd start
service mysqld start

Ubuntu

apt-get install mysql-server php5 apache2 libapache2-mod-php5 php-pear
service apache2 start
service mysql start

Create database

mysql -u root -p
CREATE DATABASE wiki;
GRANT ALL ON wiki.*
TO wiki@localhost IDENTIFIED BY 'wiki';

Download latest & extract version from http://www.mediawiki.org/wiki/Download

tar zxvf mediawiki-1.16.1.tar.gz 
cd mediawiki-1.16.1
#ON CentOS
mv * /var/www/html/
cd /var/www/html
chmod a+w config
 
#ON Ubuntu
mv * /var/www/
cd /var/www
chmod a+w config

access http://webserver/ & follow steps to complete installation.
To complete the installation, move config/LocalSettings.php to the parent directory.

Configuring MediWiki
By default you can signup & start using wiki, if you wish to change default behavior following config will help you.
Add Following syntax in LocalSettings.php
To disable creation of new account (only admin will be able to create using special pages)

$wgGroupPermissions['*']['createaccount'] = false;

To disallow unauthenticated users from editing pages.

$wgGroupPermissions['*']['edit'] = false;


To disallow unauthenticated users from reading pages.

$wgGroupPermissions['*']['read'] = false;

To Enable POP3 Auth Login. This is great relief for Admins.

pear install Net_Socket

copy code from http://www.mediawiki.org/wiki/Extension:AuthPOP3 & save as extensions/Auth_pop3.php
make relevant changes in Auth_pop3.php for mailserver & maildomain

Add followings in LocalSettings.php

require_once('extensions/Auth_pop3.php');
$wgAuth = new Auth_pop3();

Now you should be able to login with you pop3 authentication.

if still you are unable to connect OR getting Undefined variable: mailserver in http/error.log

replace code
FROM
        $user = "$user@$maildomain";
        require_once('Net/Socket.php');
        $socket = new Net_Socket();
        $result = $socket->connect($mailserver, 110, false, 3);
 
TO
  $user = "$user@YOUR-MAIL-SERVER.com";
        require_once('Net/Socket.php');
        $socket = new Net_Socket();
        $result = $socket->connect("pop.YOUR-MAIL-SERVER.com", 110, false, 3);

To block pop3 loggedin users from editing pages If you wish to allow pop3 users read only access, and assign write access to particular group. use following config.

$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['read'] = false;
$wgGroupPermissions['user']['edit'] = false;
$wgGroupPermissions['linuxreaders']['edit'] = true;
$wgGroupPermissions['linuxreaders']['createpage'] = true;
$wgGroupPermissions['linuxreaders']['move']             = true;
$wgGroupPermissions['linuxreaders']['move-subpages']    = true;
$wgGroupPermissions['linuxreaders']['move-rootlinuxreaderspages'] = true; // can move root linuxreaderspages
$wgGroupPermissions['linuxreaders']['read']             = true;
$wgGroupPermissions['linuxreaders']['edit']             = true;
$wgGroupPermissions['linuxreaders']['createpage']       = true;
$wgGroupPermissions['linuxreaders']['createtalk']       = true;
$wgGroupPermissions['linuxreaders']['writeapi']         = true;
$wgGroupPermissions['linuxreaders']['upload']           = true;
$wgGroupPermissions['linuxreaders']['reupload']         = true;
$wgGroupPermissions['linuxreaders']['reupload-shared']  = true;
$wgGroupPermissions['linuxreaders']['minoredit']        = true;
$wgGroupPermissions['linuxreaders']['purge']            = true; // can use ?action=purge without clicking "ok"
$wgGroupPermissions['linuxreaders']['sendemail']        = true;

To Enable Image upload
Change

$wgEnableUploads       = false;

To

$wgEnableUploads       = true;

Change Admin Password
If you are using pop3 login, you may not be able to change password for Admin user, use following query to change password. Read This Before running following query

UPDATE user SET user_password = CONCAT(':B:somesalt:', MD5(CONCAT('somesalt-', MD5('somepass')))) WHERE user_name = 'Admin';

For UserRights
Reset Password


if you find any missing point in here, please let us know in comment section or tweet us at @linuxreaders. To get more articles like this, subscribe to our RSS feeds / Mails.
Read 240 articles by
  • Pingback: Install & Configure MediaWiki -CentOS/Ubuntu | LinuxReaders | unixsecure test

Trending Posts