Manual:Running MediaWiki on Arch Linux
<translate> It has been suggested that this page or section be merged with <tvar name=5>Manual:Installing MediaWiki</tvar>.</translate>(<translate> Discuss</translate>) |
· <span style="" title="<translate nowrap> Edit this template</translate>"><translate> e</translate> |
Arch Wiki has a page about MediaWiki that provides more details, but lacks paste-able code to quickly get things up and running. So the focus here is on just the basic recipe for a quick installation. Note the following commands should be run as root user (to get into root run su
, for example).
Install Apache, PHP, MySQL, and MediaWiki
pacman -S mediawiki mariadb php apache php-apache
Optional packages
To enable cache on php (mediawiki will work faster):
pacman -S php-apcu
If your mediawiki database is encoded in binary php-intl will make the translation from binary to utf8 faster:
pacman -S php-intl
Set up MySQL (MariaDB)
This will do the basic configuration of MySQL (without this MySQL will fail to start):
mysql_install_db --user=mysql --basedir=/usr/ --ldata=/var/lib/mysql/
This will start MySQL and and enable the start at bootup:
systemctl start mysqld
systemctl enable mysqld
Set a database root password:
mysqladmin -u root password YOUR_DESIRED_PASSWORD_HERE
history -c
Alternately, to set a root password:
mysql_secure_installation
Set up Apache and PHP
cd /etc/webapps/mediawiki
grep -v open_basedir apache.example.conf > httpd-mediawiki.conf
cd /usr/share/webapps/mediawiki
If you already have a .htaccess
file you can run
perl -p -i -e "s/deny/allow/" .htaccess
Otherwise you have to create one from scratch. A very basic (but insecure?) one could look like this:
cat >> .htaccess << EOF
order allow,deny
allow from all
EOF
cat >> /etc/httpd/conf/httpd.conf << EOF
LoadModule php7_module modules/libphp7.so
Include conf/extra/php7_module.conf
Include /etc/webapps/mediawiki/httpd-mediawiki.conf
EOF
if you run into errors launching httpd - you need to omit the 7 related to php
cat >> /etc/httpd/conf/httpd.conf << EOF
LoadModule php_module modules/libphp.so
Include conf/extra/php_module.conf
Include /etc/webapps/mediawiki/httpd-mediawiki.conf
EOF
As the Arch Wiki notes [1], mod_mpm_event does not work with libphp7.so. So you need to open /etc/httpd/conf/httpd.conf
and comment the the mpm_event_module
and uncomment the mpm_prefork_module
:
#LoadModule mpm_event_module modules/mod_mpm_event.so LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
Edit /etc/php/php.ini
and set the open_basedir
to the path /var/lib/mediawiki
(the directory for uploads).
open_basedir = "/tmp:/usr/share/webapps/:/var/lib/mediawiki"
Still in /etc/php/php.ini
, in the Dynamic Extensions
, make sure the following extentions are activated, by uncommenting or creating the following lines:
extension=gd.so extension=intl.so extension=iconv.so extension=mysqli.so
Now start Apache and tell systemd to launch it during boot:
systemctl start httpd
systemctl enable httpd
Use the browser to configure MediaWiki
Go to http://localhost/mediawiki/mw-config/index.php and follow the instructions. Enter the database root password you defined above in the appropriate box. Don't skip any parts of the installation even if the installer suggests it—you need those extra steps to enable file uploads and wiki extensions.
When configuration is finished, your browser will download the file LocalSettings.php
. Copy it to /usr/share/webapps/mediawiki/
. Your Wiki should now be accessible at http://localhost/mediawiki/.
Uploads and image thumbnails
To enabled image uploads, first, install ImageMagick.
pacman -S imagemagick
Then, in /usr/share/webapps/mediawiki/LocalSettings.php
, uncomment the lines:
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
And finally, restart Apache for the changes to take effect:
systemctl restart httpd