Manual:Running MediaWiki on Arch Linux

From MediaWiki.org
Jump to: navigation, search


Installation guidesManual:Installation guide
FreeBSDManual:Running MediaWiki on FreeBSD
GNU/LinuxManual:Running MediaWiki on GNU/Linux
- ALT LinuxManual:Running MediaWiki on ALT Linux
- Arch LinuxManual:Running MediaWiki on Arch Linux
- DamnsmalllinuxManual:Running MediaWiki on Damnsmalllinux
- Debian or UbuntuManual:Running MediaWiki on Debian or Ubuntu
- FedoraManual:Running MediaWiki on Fedora
- GentooManual:Running MediaWiki on Gentoo Linux
- MandrivaManual:Running MediaWiki on Mandriva
- Red Hat Enterprise LinuxManual:Running MediaWiki on Red Hat Linux
- SlackwareManual:Running MediaWiki on Slackware Linux
Mac OS XManual:Running MediaWiki on Mac OS X
NetWareManual:Running MediaWiki on NetWare
SolarisManual:Running MediaWiki on Solaris
- Solaris 11 / opensolarisManual:Running MediaWiki on Solaris 11 / opensolaris
- Solaris 10Manual:Running MediaWiki on Solaris 10
WindowsManual:Running MediaWiki on Windows
- Windows Server 2016Manual:Installing MediaWiki on Windows Server 2016
on a stickManual:Wiki on a stick
- Uniform ServerManual:Installation on Uniform Server (Windows)
- XAMPPManual:Installing MediaWiki on XAMPP
Sourceforge.netManual:Installing MediaWiki on SourceForge.net

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[edit]

pacman -S mediawiki mariadb php apache php-apache

Optional packages[edit]

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)[edit]

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

Set up Apache and PHP[edit]

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

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 line:

LoadModule mpm_event_module modules/mod_mpm_event.so

and then uncomment the line:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

Edit /etc/php/php.ini and add ":/tmp:/usr/share/webapps/:/var/lib/mediawiki" at the end of the "open_basedir=" line. (/var/lib/mediawiki is the directory for uploads).

Then, also in /etc/php/php.ini , uncomment the following lines by removing the leading semicolons: (in the Dynamic Extensions section)

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[edit]

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[edit]

If you have enabled image uploads in LocalSettings.php ($wgEnableUploads = true;), you may want to install ImageMagick

pacman -S imagemagick

and uncomment the lines

 $wgUseImageMagick = true;
 $wgImageMagickConvertCommand = "/usr/bin/convert";

in /usr/share/webapps/mediawiki/LocalSettings.php. Then restart Apache for the changes to take effect:

systemctl restart httpd