$Id: mediawiki.txt,v 1.4 2009/05/07 12:34:31 guru Exp $ How to install & configure Apache, PHP5, MySQL and MediaWiki to import a complete MediaWiki like http://es.wikipedia.org/wiki/ - install /usr/ports/www/apache13 - install /usr/ports/lang/php5 but make sure that Apache module is configure (it is off by default), i.e. run 'make config' - install /usr/ports/databases/mysql50-server - configure mysqlserver in /etc/rc.conf with mysql_enable="YES" mysql_dbdir="/usr/db/mysql" NOTE: in the EeePC use /usr/local/db/mysql for it! NOTE: see also the config file my.cnf - create /usr/db/mysql and chown it: # mkdir -p /usr/db/mysql # chown mysql:mysql /usr/db/mysql we need at least around 4 GByte for the DB later; - start mysqlserver (will come up now on any reboot): # /usr/local/etc/rc.d/mysql-server start - create the an account for the user 'root' in the MySQL database: $ mysqladmin -u root password 'xxxxxx' - configure Apache in /usr/local/etc/apache/httpd.conf for PHP5 (default is PHP4); change or add the following diff lines: # diff /usr/local/etc/apache/httpd.conf /usr/local/etc/apache/httpd.conf.old 440c440 < --- > 448,449c448,449 < < DirectoryIndex index.php index.html index.htm --- > > DirectoryIndex index.php index.html 1045,1048d1044 < < AddType application/x-httpd-php .php < AddType application/x-httpd-php-source .phps < AddType application/x-httpd-php .php .htm .html - configure Apache in /etc/rc.conf with apache_enable="YES" - install MediaWiki && friends from the ports collection: /usr/ports/www/mediawiki /usr/ports/www/p5-HTML-WikiConverter /usr/ports/www/p5-HTML-WikiConverter-MediaWiki /usr/ports/www/p5-WWW-Wikipedia - start Apache (will come up now on any boot): # /usr/local/etc/rc.d/apache restart - copy over the installed mediawiki tree to the DOCROOT of Apache: # cd /usr/local/www # cp -Rp mediawiki data - configure mediawiki, i.e. make the config dir writeable and fire up the config page in your browser # cd /usr/local/www/data/mediawiki # chmod a+w config http://localhost/mediawiki/config/ fill out the PHP form and submit it; below at the very end is the resulting output with my configuration: Wiki name: MyWiki Contact e-mail: guru@unixarea.de Language: es - Espaņol [x] No license metadata Admin username: WikiAdmin Password: xxxxxx [x] No caching [x] E-mail features enabled [x] User-to-user e-mail enabled Database type: [x] MySQL Database host: localhost Dabase name: wikidb DB username: wikiuser DB password: xxxxxx Superuser account: [x] Superuser name: root Superuser password: xxxxxx Storage engine [x] InnoDB - move over the resulting file LocalSettings.php and we're done with MediaWiki itself: # cd /usr/local/www/data/mediawiki # mv config/LocalSettings.php . Now we need additional extensions and tools for importing real MediaWiki stuff, see also: http://meta.wikimedia.org/wiki/Importing_a_Wikipedia_database_dump_into - install the port /usr/ports/lang/ocaml # cd /usr/ports/lang/ocaml # make install clean - install the port /usr/ports/lang/php5-extensions - install the port /usr/ports/textproc/php5-dom after the PHP extensions restart Apache so he can fetch the shared objects; - install the tool 'texcv' # cd /usr/local/www/data/mediawiki/math/ # cat README # gmake 'texcv' needs a worldwide writeable dir 'tmp' below Wiki topdir # cd /usr/local/www/data/mediawiki/ # mkdir tmp # chmod 0777 tmp - configure 'tidy' as explained in the above Wiki page # cd /usr/ports/www/tidy # make install clean insert into LocalSettings.php: $wgUseTidy = true; $wgTidyBin = '/usr/local/bin/tidy'; $wgTidyConf = $IP.'/extensions/tidy/tidy.conf'; and the /usr/local/www/data/mediawiki/extensions/tidy/tidy.conf file: show-body-only: yes force-output: yes tidy-mark: no wrap: 0 wrap-attributes: no literal-attributes: yes output-xhtml: yes numeric-entities: yes enclose-text: yes enclose-block-text: yes quiet: yes quote-nbsp: yes fix-backslash: no fix-uri: no - get some Wiki extensions from http://www.mediawiki.org/wiki/Special:ExtensionDistributor which does match exactly your version of MediaWiki (!) at least we need for nice rendering these: # tar xzf ParserFunctions-MW1.11-r25491.tar.gz -C /usr/local/www/data/mediawiki/extensions # tar xzf Cite-MW1.11-r25492.tar.gz -C /usr/local/www/data/mediawiki/extensions # tar xzf HTTPRedirect-MW1.11-r19878.tar.gz -C /usr/local/www/data/mediawiki/extensions # tar xzf Purge-MW1.11-r23140.tar.gz -C /usr/local/www/data/mediawiki/extensions # tar xzf TidyTab-MW1.11-r36280.tar.gz -C /usr/local/www/data/mediawiki/extensions # tar xzf ImageMap-MW1.11-r25543.tar.gz -C /usr/local/www/data/mediawiki/extensions - fetch and patch the XML to SQL converter xml2sql-0.5.tar.gz see: http://meta.wikimedia.org/wiki/Xml2sql $ CFLAGS="-I/usr/local/include " export CFLAGS $ LDFLAGS="-L/usr/local/lib " export LDFLAGS $ ./configure $ gmake # make install - now it's time to get the real stuff: a XML dump of the Spanish Wiki: $ wget http://download.wikimedia.org/eswiki/20080304/eswiki-20080304-pages-articles.xml.bz2 $ mkdir tmp ; cd tmp $ bunzip2 -c ../eswiki-20080304-pages-articles.xml.bz2 | xml2sql this gives around ~1.6 GByte import files $ mysqlimport -u root -p --local wikidb `pwd`/{page,revision,text}.txt Enter password: the import takes around 4 hours (on my 2.13GHz laptop) - *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MediaWiki 1.11.2 Installation Don't forget security updates! Keep an eye on the low-traffic release announcements mailing list. Checking environment... Please include all of the lines below when reporting installation problems. PHP 5.2.5 installed Found database drivers for: MySQL PHP server API is apache; ok, using pretty URLs (index.php/Page_Title) Have XML / Latin1-UTF-8 conversion support. Warning: A value for session.save_path has not been set in PHP.ini. If the default value causes problems with saving session data, set it to a valid path which is read/write/execute for the user your web server is running under. PHP's memory_limit is 128M. APC installed GNU diff3 not found. Found ImageMagick: /usr/local/bin/convert; image thumbnailing will be enabled if you enable uploads. Found GD graphics library built-in. Installation directory: /usr/local/www/data/mediawiki Script URI path: /mediawiki Installing MediaWiki with php file extensions Environment checked. You can install MediaWiki. Generating configuration file... Database type: MySQL Loading class: DatabaseMysql Attempting to connect to database server as root...success. Connected to 5.0.51a Attempting to create database... Created database wikidb Creating tables... done. Initializing data... Granting user permissions to wikiuser on wikidb...success. Created sysop account WikiAdmin. Creating LocalSettings.php... Installation successful! Move the config/LocalSettings.php file to the parent directory, then follow this link to your wiki. You should change file permissions for LocalSettings.php as required to prevent other users on the server reading passwords and altering configuration data.