MediaWiki
This page documents how to set up MediaWiki on Funtoo Linux.
Add the following line to /etc/make.conf:
PHP_TARGETS="php-5-4"
Add the following lines to /etc/portage/package.use/php:
dev-lang/php curl exif fpm gd mysql mysqli sockets suhosin threads intl >=dev-php/xcache-2.0.0 php_targets_php5-4
Emerge xcache. This should pull in MySQL as well as php-5.4 and postfix:
# emerge --jobs xcache
Time to configure MySQL with a root password, start it, secure it, and enable it to start at boot:
# emerge --config mysql # rc-update add mysql default # rc # mysql-secure-installation
While we're at it, let's enable postfix:
# rc-update add postfix default # rc
Now, let's create a database named mediawiki for use by MediaWiki, and a mediawiki@localhost user to access this database, using a password of wikifever:
# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 5.1.62-log Gentoo Linux mysql-5.1.62-r1 Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database mediawiki; Query OK, 1 row affected (0.01 sec) mysql> grant index, create, select, insert, update, delete, alter, lock tables on mediawiki.* to 'mediawiki'@'localhost' identified by 'wikifever'; Query OK, 0 rows affected (0.01 sec) mysql> \q Bye #
We will use nginx as our Web server. Let's emerge it:
# emerge --jobs nginx
When we run our wiki, we will run it as the docs user, for security. Let's set up a docs user and group:
# groupadd docs # useradd -g docs --home /home/docs docs # install -d /home/docs # chown -R docs:docs /home/docs
We're getting close. Now, head to http://www.mediawiki.org/wiki/Download and copy the link address for the latest version of MediaWiki, currently 1.19.1 at the time this was written. Let's download the archive to /var/tmp:
# cd /var/tmp # wget http://download.wikimedia.org/mediawiki/1.19/mediawiki-1.19.1.tar.gz
As our last major configuration step, we will configure the PHP FastCGI Process Manager by creating a /etc/php/fpm-php5.4/php-fpm.conf file with the following contents (existing contents can be deleted):
[global] error_log = /var/log/php-fpm.log log_level = notice [docs] listen = /var/run/docs.php-fpm.socket listen.allowed_clients = 127.0.0.1 listen.owner = docs listen.group = nginx listen.mode = 0660 user = docs group = docs pm = dynamic pm.max_children = 16 pm.start_servers = 2 pm.min_spare_servers = 2 pm.max_spare_servers = 2 pm.max_requests = 500 php_admin_value[open_basedir] = /home/docs/public_html:/tmp php_admin_value[error_log] = /home/docs/php-errors.log php_admin_value[disable_functions] = exec, system, shell_exec, passthru, popen, dl, curl_multi_exec, posix_getpwuid, disk_total_space, disk_free_space, escapeshellcmd, escapeshellarg, eval, get_current_user, getmyuid, getmygid, posix_getgrgid, parse_ini_file, proc_get-status, proc_nice, proc_terminate, suexec, pclose, virtual, set_time_limit, show_source
This configuration file tells PHP to use the docs user when running MediaWiki. Please note that the last line is very long - I have split it into 3 lines for readability on this wiki, but you should combine them into a single line in your configuration file. The line should start with php_admin_value[disable_functions] and end with show_source.