Help:Running MediaWiki on Gentoo Linux: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
m →‎Restart apache: code display fix
Line 172: Line 172:


== Setup Rewrite Rules ==
== Setup Rewrite Rules ==
I have no idea how to do these, see [[Rewrite Rules]]
I have no idea how to do these, see [[Eliminating index.php from the url]]


This is what I used:
This is what I used:

Revision as of 13:36, 21 August 2005

Template:H:hns

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


  • Optional, suggested
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.

  • 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 about installing support for mathematical formulas in mediawiki.

  • Required packages...

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'

(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 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

adding php support (step 1)

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

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 PHP4 is necessary to pass the IfDefine PHP4 which wraps 70_mod_php.conf.

(This is with net-www/apache-2.0.54-r5.)

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_php.conf )

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

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

(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 <PATH_TO_MEDIAWIKI_DIRECTORY>

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 apache configuration

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 )

<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>
</IfModule>

Setup Rewrite Rules

I have no idea how to do these, see Eliminating index.php from the url

This is what I used:

RewriteRule ^/mediawiki/ - [L]

Restart apache

/etc/init.d/apache2 restart

Run the Configuration Web Page

yes, you have to config that directory manually... (Now you can use a web-configuration page)

Note: If your ServerName isn't the same as the address being used to access the mediawiki, you may have problems (such as mediawiki not loading at all). Try setting ServerName in apache2.conf to be the same as your hostname+domainname.

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 originally 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!) !!! Link is not active now !!!
  • 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