Help:Running MediaWiki on Gentoo Linux

From Meta, a Wikimedia project coordination wiki
This is an archived version of this page, as edited by 207.218.183.7 (talk) at 18:13, 17 November 2004 (→‎Prerequisites). It may differ significantly from the current version.

Prerequisites

It is possible to have connection problems when you emerge something.

Try to add one line for mirror list into your /etc/make.conf like following: GENTOO_MIRRORS="ftp://ftp.heanet.ie/pub/gentoo/ http://ftp.easynet.nl/mirror/gentoo/"

You can get possible mirros and test them by accessing http://www.gentoo.org/main/en/mirrors.xml


  • Optional, suggested
emerge sync
emerge ufed -uD

Note: ufed is the Gentoo Linux USE flags editor ufed (check useflags, you'll need mod_php, gd if you want thumbnails) the option -uD means update and check the dependence tree thoroughly.

  • Needed for support of mathematical formulas
emerge imagemagick 

(ImageMagick can also make thumbnails if you do not want to include gd [a library] support in php). If you have done this it is a good ideea to add suport for imagemagick in the USE flags.

To add LaTeX support do:

emerge tetex

After that you should see the programs latex and dvips available on the command line.

Finally do:

emerge dev-lang/ocaml 

You can find additional info here about installing support for mathematical formulas in mediwiki.

  • Required packages...

Remember to -p them first! if you already have them, you probably don't need them again!. For exampe type 'emerge -p mysql' to see what would happen

emerge mysql -uD
emerge apache -uD
USE="session" emerge php -uD

Note: I encountered a problem when merge php, ERROR: media-video/nvidia-kernel-1.0.5336-r4 failed. I checked it out from http://forums.gentoo.org/ and found it is not a simple problem. I suggest to use 'USE="session" emerge php ' instead of 'USE="session" emerge php -uD'

(check useflags with ufed. php has many use flags options.. use emerge -pv php to see them all.) NOTE!! by default, some (if not all) php ebuilds disable sessions, which will break logins. add sessions by appending 'session' to the mod_php USE line in /etc/portage/package.use) (probably required) (so try the following)

USE="session" emerge mod_php -uD

Another NOTE: you can also add 'session' in the USE flags permenently with ufed. I have not encountered yet problems with this setting. Also make sure that mysql suport in added in USE when emerging php (stating the obvious but it doesn't hurt :))

Configure Apache

start web server by

apache2

Stop it by

apache2ctl stop

(get services going by default)

rc-update add apache2 default

(turn on services)

/etc/init.d/apache2 start

Add PHP Support

apache2 uses modules to dynamically load and unload extra functionalities. php support is one of them. There is no mod_php module in apache server after the default installation. We need to add mod_php into apache. Edit the configuration file of apache2

easy way to add php support

vi /etc/conf.d/apache2
#APACHE2_OPTS="-D SSL"
APACHE2_OPTS="-D SSL -D PHP4"
 /etc/init.d/apache2 restart

complex way to do things

vi /etc/apache2/conf/apache2.conf

You will see module list in apache2.conf

LoadModule access_module                 modules/mod_access.so
LoadModule auth_module                   modules/mod_auth.so
LoadModule auth_anon_module              modules/mod_auth_anon.so
LoadModule auth_dbm_module               modules/mod_auth_dbm.so

Add mod_php into it by one more line:

 LoadModule php4_module    extramodules/libphp4.so

Consequently add .php file name handling capability by adding

        AddType application/x-httpd-php .php 
        AddType application/x-httpd-php .phtml
        AddType application/x-httpd-php .php3
        AddType application/x-httpd-php .php4
        AddType application/x-httpd-php-source .phps

save apache2.conf and restart apache server

 apache2ctl restart

or

/etc/init.d/apache2 restart

We now have an apache server with php support.

Configure MySQL

Refer to http://meta.wikimedia.org/wiki/MySQL_config for details

Intialize the mysql database

mysql_install_db

Start the server

mysqld_safe

Test it

mysqlshow

Let it run automatically each time your machine is powered up

cd /etc/init.d
cp /usr/sbin/mysqld 
rc-update add mysqld default

Possibility of an ebuild for mediawiki!

http://bugs.gentoo.org/show_bug.cgi?id=37894

Talk:Running_MediaWiki_on_Gentoo_Linux#Possibility of an ebuild for mediawiki

Get Mediawiki

(from the SourceForge page, it took me forever to find!) http://sourceforge.net/project/showfiles.php?group_id=34373


Unpack

using tar -xvvzf filename 

(don't put it into your webroot, alias the directory, conditional to php being operational)

cp it into /var/www/localhost if you like, where the default www root(htdocs) is located.

Set Permissions

user should be apache, group should be apache. You should not give anybody access to this directory.. or at least LocalSettings.conf as it contains passwords! Just let user apache do it.

Mediawiki 1.3.2 needs to write confi directory during initialization.

cd /var/www/localhost/mediawiki
chmod a+w config

Alias Directory

edit your /etc/apache2/conf ... commonapache2.conf? file apache configuration

You do NOT want mediawiki in a world readable directory, when php isn't running, so this is usefull: (this is using apache2, so the php4 module is called sapi_apache2.c )

<IfModule sapi_apache2.c>
    Alias /mediawiki/ /var/www/localhost/mediawiki-1.3.3/
    Alias /mediawiki /var/www/localhost/mediawiki-1.3.3
    Alias /wiki_persistant/ /var/www/localhost/wiki_persistant/
    Alias /wiki_persistant /var/www/localhost/wiki_persistant

    <Directory /var/www/localhost/wiki_persistant/>
        Order deny,allow
        Allow from all
    </Directory>

   <Directory /var/www/localhost/mediawiki-1.3.3/>
        Options +includes
        Order deny,allow
        Allow from all
#       AllowOverride All
   </Directory>

Setup Rewrite Rules

I have no idea how to do these, see Rewrite Rules

Restart apache

/etc/init.d/apache2 restart

Run the Configuration Web Page

yes, you have to config that directory manually...

MediaWikis running on Gentoo

  • http://gentoo-wiki.com A little surprise for me when I found it. :-)
  • http://escargot.icehouse.net/mediawiki (the page upgrade from 1.2 to 1.3 was origionally written with a gentoo box) and this user is silly enough to be willing to provide _limited_ tech support if you bother to User:AaronPeterson (he prefers telephone, because he types too much!)
  • http://lnx101.parl.clemson.edu
  • http://www.securityforest.com SecurityForest.com is a collaboratively edited Forest consisting of Trees which anyone can contribute to. SecurityForest's trees are specific security repositories that any security professional should be interested in. SecurityForest.com is a collection of repositories for the community - by the community. In other words - the updating, modifying and improving can be done by anyone in the community.

References

http://www.doctaur.com/dtdocs/databases/mysql-manual/table-of-contents.html

http://dev.mysql.com/doc/mysql/en/index.html