References
- MediaWiki Manual:Installation Guide
- Install MediaWiki on Ubuntu 18.04 LTS with Apache2, MariaDB and PHP 7.1 Support
- How to Install MediaWiki on Ubuntu 18.04 LTS
- MariaDB Repositories
Prerequisites
- A working installation of Ubuntu Server
- LAN access to Ubuntu Server
Install Apache2
-
sudo apt install apache2 -y
- Disable directory listing
sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/apache2/apache2.conf
- Set Apache2 service to start on boot
sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service
Install MariaDB 10.3
- Add repo
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,arm64] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main' - Update to see new packages
sudo apt update
- Install
sudo apt install mariadb-server mariadb-client -y
Set root password for MariaDB
- Set MariaDB service to start on boot
sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service - Lock it down! (answer Y to all)
sudo mysql_secure_installation
- Restart MariaDB service
sudo systemctl restart mariadb.service
Install PHP 7.1
- Add repo
sudo add-apt-repository ppa:ondrej/php
- Update to see new packages
sudo apt update
- Install all the things!
sudo apt install php7.1 libapache2-mod-php7.1 php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-gd php7.1-xml php7.1-intl php7.1-mysql php7.1-cli php7.1-curl
- Open php.ini for editing
sudo nano /etc/php/7.1/apache2/php.ini
- Make the following changes
file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Pacific
Create the MediaWiki Database
- Log on to the db server
sudo mysql -u root -p
- Create db
CREATE DATABASE mediawiki;
- Create db user
CREATE USER 'mediawikiuser'@'localhost' IDENTIFIED BY 'new_password_here';
- Grant user full access
GRANT ALL ON mediawiki.* TO 'mediawikiuser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;
- Save and exit
FLUSH PRIVILEGES;
EXIT;
Download MediaWiki 1.31.0
- Download the tarball
cd /tmp && wget https://releases.wikimedia.org/mediawiki/1.31/mediawiki-1.31.0.tar.gz
- Extract and move to www
sudo tar -zxvf mediawiki*.tar.gz
sudo mkdir -p /var/www/html/mediawiki
sudo mv mediawiki-1.31.0/* /var/www/html/mediawiki - Modify permissions
sudo chown -R www-data:www-data /var/www/html/mediawiki/
sudo chmod -R 755 /var/www/html/mediawiki/
Configure Apache2
- Create and edit conf file
sudo nano /etc/apache2/sites-available/mediawiki.conf
- Add conf
Enable MediaWiki Site && Restart Apache2
-
sudo a2ensite mediawiki.conf sudo a2enmod rewrite sudo systemctl restart apache2.service
The Finish Line
- You should now be able to visit the MediaWiki page by navigating to http://server.ip.address/mediawiki
- From here, simply follow the GUI installation process. Once the installation process is complete, you will need to move the LocalSettings.php file created into the MediaWiki directory on the server (default: /var/www/html/mediawiki)