Fedora 27: Install MediaWiki for wiki software

This article will describe installing MediaWiki.

1 Install MediaWiki

  • Changing open port of firewall from https to http, you can connect via http.
  • MEDIAWIKI_PASSWD is password of admin user.
#!/bin/sh

[ -z "${MEDIAWIKI_PASSWD}" ] && \
  MEDIAWIKI_PASSWD=mediawiki_passwd

mysql_install()
{
  sudo dnf install -y mariadb-server
  sudo systemctl enable mariadb
  sudo systemctl start mariadb
}

mediawiki_install()
{
  sudo dnf install -y mediawiki php-mysqlnd

  # Create DB table and LocalSettings.php.
  cd /usr/share/mediawiki
  sudo php maintenance/install.php mediawiki admin \
       --pass "${MEDIAWIKI_PASSWD}" --dbuser root
  cd /var/www/wiki
  sudo ln -s /usr/share/mediawiki/LocalSettings.php .
}

apache_install()
{
  sudo dnf install -y mod_ssl

  cat <<EOF | sudo tee -a /etc/httpd/conf.d/mediawiki.conf
Alias /wiki/skins /usr/share/mediawiki/skins
Alias /wiki /var/www/wiki
EOF

  sudo firewall-cmd --add-service=https --permanent
  sudo firewall-cmd --reload
  sudo systemctl enable httpd
  sudo systemctl start httpd
}

mediawiki_main()
{
  mysql_install
  mediawiki_install
  apache_install
}

mediawiki_main

2 Access to MediaWiki

Access to the following URL. Accept this page's certification to browser.

https://<server>/wiki

MediaWiki is displayed. Click "Log in" at the top right, and input admin to user and MEDIAWIKI_PASSWD value to password. Then you can login to MediaWiki.

0001_MediaWiki.png