This article will describe installing MediaWiki.
Table of Contents
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 -e PHP_VERSION=7.2 MYSQL_VERSION=5.7 [ -z "${MYSQL_PASSWD}" ] && \ MYSQL_PASSWD=mysql [ -z "${MEDIAWIKI_PASSWD}" ] && \ MEDIAWIKI_PASSWD=mediawiki_passwd mysql_install() { cat <<EOF | sudo debconf-set-selections mysql-server-${MYSQL_VERSION} mysql-server/root_password password \ ${MYSQL_PASSWD} mysql-server-${MYSQL_VERSION} mysql-server/root_password_again password \ ${MYSQL_PASSWD} EOF sudo apt install -y mysql-server } mediawiki_install() { sudo apt install -y mediawiki # Create DB table and LocalSettings.php. cd /usr/share/mediawiki sudo php maintenance/install.php mediawiki admin \ --pass "${MEDIAWIKI_PASSWD}" --scriptpath /mediawiki \ --dbuser root --dbpass "${MYSQL_PASSWD}" } apache_install() { sudo apt install -y \ libapache2-mod-php php-xml php-intl imagemagick git sudo cp /etc/apache2/conf-available/mediawiki.conf \ /etc/apache2/conf-available/mediawiki.conf.orig cat <<EOF | sudo tee /etc/apache2/conf-available/mediawiki.conf <VirtualHost _default_:443> SSLEngine on SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key $(sed -e 's/^/ /g' /etc/apache2/conf-available/mediawiki.conf.orig) </VirtualHost> EOF sudo a2enmod php${PHP_VERSION} sudo a2enmod ssl sudo systemctl enable apache2 sudo systemctl restart apache2 } mediawiki_main() { mysql_install mediawiki_install apache_install } mediawiki_main