2012年11月9日 星期五

FreeBSD,mediaWiki,and English Wiktionary Dump Importing





Running MediaWiki on FreeBSD


The following process has been tested on mediawiki-1.20.0
Do not use the bundled package from freeBSD8.2, which is mediawiki-1.16.2

reference:
Running_MediaWiki_on_FreeBSD

1.pkg_add -r apache22 mysql51-server php5 php5-mysql

2. cd /usr/ports/lang/php5
 make config
 make
 make deinstall
 make reinstall
During the make config step above, enable the "APACHE" option in the menu. <-Enable all option except DEBUG
Also install XMLReader and ctype extension for php.

pkg_add -r php5-xmlreader php5-ctype


3.Edit MySql account

if mysqld did not start, start it.
then

mysqladmin -u root password yourpassword

4.Edit apache config

Make sure the following sections have been added to httpd.conf:

 LoadModule php5_module        libexec/apache/libphp5.so   <-may differ...
   <IfModule php5_module>
       DirectoryIndex index.php index.html
       AddType application/x-httpd-php .php
       AddType application/x-httpd-php-source .phps
   </IfModule>


Add the following Directory settings to your httpd.conf


 <Directory "your_mediawiki_path">
   Options Indexes FollowSymLinks
   DirectoryIndex index.php index.html
   AllowOverride None
   Order allow,deny
   Allow from all
 </Directory>


And then,
restart your apache

5.
make mediawiki/mw-config writable

 cd /usr/local/www
 chmod 777 mediawiki/config





Make sure all MediaWiki files belong to user www:
 chown -R www mediawiki



Now open http://localhost/mediawiki/mw-config/index.php in your browser to start installation.

6. During Installation
Set Mysql User account/pw to root/yourpw
Make sure to include ParserFunction extension   <- important

7. After Installation:
copy LocalSettings.php to your mediawiki root

8.Download wiktionary xml from wikipedia sites
I use enwiktionary-20121104-pages-articles.xml.bz2 

9. unzip the bz2 file

---------------------------------------IMPORTANT---------------------------------

run the gfdl-wikititle program to strip out illegal titles in XML dumps provided by foundation:
https://meta.wikimedia.org/wiki/Gfdl-wikititle
(This program should be run on windows or linux.)

If you did not do this step, then the "NULL title exception" will cause importDump.php to freeze.
Especially on large XML dumps such as enwiki...

reference:
https://meta.wikimedia.org/wiki/Data_dumps#importDump.php
The authur of gfdl-wikititle complain about importDump.php and mwDumper

10. go to mediawiki/maintainence/
php importDump.php your_path_to_enwiktionary_xml

11.See the following messages:





The 200 or 300 means numbers of pages it have processed.
Please wait for a long time.

12.Using DumpHtml.php~






FreeBSD Related problems (For Beginners)


Problems encountered:


1.su: Sorry

How to resolve:
users must be in wheel group to use su
so add user to wheel group

new user:
pw adduser <username> -G wheel
passwd <passwd>

existing user:
pw usermod <username> -G wheel



2.pkg_add -r gnome2
failed at first
pkg_add again-> success

3.startx : no command

pkg_add -r xorg
failed first time, sucess on second try

4.Network problem:
in VM use NAT(addition to)
in FreeBSD
vi /etc/rc.conf

add
ifconfig_<device name>="DHCP"
My <device name> is em0.

5. dns setup
ref0
ref1
vi /etc/resolv.conf


search xxx.com
nameserver 8.8.8.8
nameserver 8.8.4.4

6. scroll lock 
or plug a windows keyboard to your laptop

7.switch between tty and gnome
CTRL ALT +F1~F7  tty F9 GNOME

8.FTP PASSIVE MODE:
When logging into gnome with root
the terminal's environment will be cleaned.
Thus ftp passive mode is not set,
resulting the pkg_add -r fail...

So,

sudo FTP_PASSIVE_MODE=1 pkg_add -r somepackage

or using tty to pkg_add

reference:
http://forums.freebsd.org/showthread.php?t=19257


9. apache could not resolve servername:
reference:
http://apache-http-server.18135.n6.nabble.com/users-httpd-FreeBSD-apache-problems-td4767903.html
http://www.gossamer-threads.com/lists/apache/users/385781