Manual:Running MediaWiki on Gentoo Linux

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 mirrors and test them by accessing http://www.gentoo.org/main/en/mirrors.xml

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


 * 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 idea to add support 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(broken link) about installing support for mathematical formulas in mediawiki.

Remember to -p them first! if you already have them, you probably don't need them again!. For example 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'
 * Required packages...

If you are getting errors the echoed text at the end of the emerge will inform you of the USE flags that are required so just add them to your 'package.use' file.

(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 permanently with ufed. I have not encountered yet problems with this setting. Also make sure that mysql support is added in USE when emerging php (stating the obvious but it doesn't hurt :))

Configure Apache
start web server by apache2 Or /etc/init.d/apache2 start Stop it by apache2ctl stop Or /etc/init.d/apache2 stop After making changes to the Apache config files, you can quickly restart Apache by /etc/init.d/apache2 restart

(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

adding php support (step 1)
vi /etc/conf.d/apache2 APACHE2_OPTS="-D SSL -D PHP5" /etc/init.d/apache2 restart
 * 1) APACHE2_OPTS="-D SSL"

Gentoo automatically installs /etc/apache2/modules.d/70_mod_php.conf which contains the directives to load the module, as described in step 2. The -D PHP5 is necessary to pass the IfDefine PHP5 which wraps 70_mod_php.conf.

(This is with net-www/apache-2.0.58-r2.)

adding php support (step 2)
vi /etc/apache2/conf/apache2.conf or  vi /etc/apache2/httpd.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 or you can edit /etc/apache2/modules.d/*.conf, where *.conf is the name of the module ( ex: 70_mod_php5.conf )

Add mod_php into it by one more line: LoadModule php5_module   modules/libphp5.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 .php5 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

Initialize the mysql database ebuild /var/db/pkg/dev-db/mysql-VERSION/mysql-VERSION.ebuild config Start the server /etc/init.d/mysql start Choose a password: /usr/bin/mysqladmin -u root password 'PASSWORD' Test it mysqlshow -p

Let it run automatically each time your machine is powered up rc-update add mysql default

= Get Mediawiki = Run the following command to install mediawiki:

emerge mediawiki

Unpack
cp -rf /usr/share/webapps/mediawiki/{version...}/htdocs /var/www/localhost/mediawiki (you don't have put it into your webroot. It is also possible to alias the directory, conditional on php being active and suitable symlink permissions)

Set Permissions
user should be apache, group should be apache.

chown -R apache: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 config directory during initialization. Now, we use /var/www/localhost/htdocs/mediawiki cd /var/www/localhost/htdocs/mediawiki chmod a+w config

Alias Directory
edit your /etc/apache2/conf/commonapache2.conf file or /etc/apache2/httpd.conf

You do NOT want mediawiki in a world readable directory, when php isn't running, so this is useful: (this is using apache2, so the php4 module is called 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

 Order deny,allow Allow from all 

 Options +includes Order deny,allow Allow from all  </IfModule>
 * 1)      AllowOverride All

Setup Rewrite Rules
I have no idea how to do these, see Manual:Short URL

This is what I used:

RewriteRule ^/mediawiki/  - [L]

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

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

Also see http://gentoo-wiki.com/HOWTO_Wiki