Installing MediaWiki on a Buffalo Duo Pro NAS

So, I decided to use MediaWiki to store my notes, it's also an opportunity to practise my MediaWiki skills.  The first question was.... "Where to install it ?"

It struck me that one of the features of my new Buffalo Duo Pro NAS was embedded MySQL and WebServers, could it be that easy ? Probably not....but lets see...

I started by enabling the webserver...

  1. I created a new shared folder on the NAS to store websites etc called "webserver" (imaginative eh!)
  2. Log into the NAS web-console and go to "Network->WebServer"
    1. Set it to enabled
    2. Set the path to "webserver\websites"
    3. Click 'OK'
  3. I was then able to point a browser at "http://{server}:81/" to see the standard PHP settings page. So far so good.
Now to enable the MySQL database....
  1. Log into the NAS web-console and go to "Network->MySQL Server"
    1. Set it to enabled
    2. Set the data folder to "webserver\mysql"
  2. Setting up the database
    1. Click on the "Open PHPMyAdmin" button on the "Network->MySQL Server" page
    2. You will then be presented with a login page. 
      1. Note, this does not accept your NAS credentials !
    3. Enter the following default credentials
      1. Username : admin
      2. Password: password
    4. Click on the "databases" tab, enter the name of the database to use for the wiki into the entry field at the bottom of the page, e.g. wiki, and click 'create'
    5. It is also worth changing the default password for 'admin', this is done on the 'Priveleges' tab.
Installing MediaWiki.....
  1. Download MediaWiki from the website (I used 1.16)
  2. Extract the achive to a directory on the web-server shared folder below 'htdocs' (e.g. \webserver\htdocs\wiki)
  3. Point your favourite browser to the directory e.g. http://{server}/wiki.  The installation page should be displayed.
  4. Follow the screen prompts to peform the installation
    1. You will need to provide the MySQL database name and password that you setup earlier.

Done ! 

Point your browser back to http://{Server}/wiki and you should see the familiar MediaWiki homepage 

First thing you may notice is the performance....which can be sorted out, see below....


Speeding up page retrieval


The NAS supports the eAccelerator module in PHP, which makes a significant difference to page retrieval times.  To enable this make sure the following is set in your 'LocalSettings.php' file.

$wgMainCacheType    = CACHE_ACCEL;

You can also enable the "mbstring"module (which is recommended in the MediaWiki documentation).

Below I have given my settings from 'php.ini', which can be edited from the NAS web-console ('Network->Webserver')


[mbstring]
; language for internal character representation.
mbstring.language = English


; internal/script encoding.
; Some encoding cannot work as internal encoding.
; (e.g. SJIS, BIG5, ISO-2022-*)
mbstring.internal_encoding = UTF-8


; http input encoding.
mbstring.http_input = auto


; http output encoding. mb_output_handler must be
; registered as output buffer to function
;mbstring.http_output = SJIS


; enable automatic encoding translation according to
; mbstring.internal_encoding setting. Input chars are
; converted to internal encoding by setting this to On.
; Note: Do _not_ use automatic encoding translation for
;       portable libs/applications.
mbstring.encoding_translation = On


; automatic encoding detection order.
; auto means
mbstring.detect_order = auto


; substitute_character used when character cannot be converted
; one from another
;mbstring.substitute_character = none;


; overload(replace) single byte functions by mbstring functions.
; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
; etc. Possible values are 0,1,2,4 or combination of them.
; For example, 7 for overload everything.
; 0: No overload
; 1: Overload mail() function
; 2: Overload str*() functions
; 4: Overload ereg*() functions
mbstring.func_overload = 7


Disabling anonymous entry/editing


To force users to login before accessing your wiki add the following to the 'LocalSettings.php' file

 # Disable reading by anonymous users
$wgGroupPermissions['*']['read'] = false;

# But allow them to access the login page or else there will be no way to log in!
# NOTE: You also need to provide access here to the .css and .js files that the
# allowed pages attempt to load; otherwise, users will get errors on the page
# when they attempt to load it (IE will complain about the errors;
# FF will show them in its error console)
# [You also might want to add access to "Main Page", "Wikipedia:Help", etc.)
$wgWhitelistRead = array ("Special:Userlogin", "MediaWiki:Common.css",
"MediaWiki:Common.js", "MediaWiki:Monobook.css", "MediaWiki:Monobook.js", "-");

# Disable anonymous editing
$wgGroupPermissions['*']['edit'] = false;

# Prevent new user registrations except by sysops
$wgGroupPermissions['*']['createaccount'] = false;

Comments

  1. Good stuff. Exactly what I was looking for. Just installed it using MediaWiki 1.9.2.

    Unfortunately the CACHE_ACCEL doesn't work and the mbstring changes make the wiki not accessible anymore.

    ReplyDelete

Post a Comment

Popular Posts