Ubuntu 16.04: Install MediaWiki

The mediawiki in Ubuntu 16.04 is removed on 2016/8. Newer mediawiki is added in Ubuntu 16.10. This article will describe porting newer mediawiki from Ubuntu 16.10 to Ubuntu 16.04.

1 Install mediawiki

Install devscripts with apt.

$ sudo apt install -y devscripts

Download mediawiki source code in Ubuntu 16.10.

$ mkdir mediawiki
$ cd mediawiki/
$ MEDIAWIKI=http://archive.ubuntu.com/ubuntu/pool/universe/m/mediawiki
$ wget ${MEDIAWIKI}/mediawiki_1.27.0-1.debian.tar.xz
$ wget ${MEDIAWIKI}/mediawiki_1.27.0-1.dsc
$ wget ${MEDIAWIKI}/mediawiki_1.27.0-1_all.deb
$ wget ${MEDIAWIKI}/mediawiki_1.27.0.orig.tar.gz

Extract source code.

$ tar zxf mediawiki_1.27.0.orig.tar.gz
$ cd mediawiki-1.27.0/
$ tar xf ../mediawiki_1.27.0-1.debian.tar.xz

Install packages for building mediawiki.

$ sudo apt install -y `dpkg-checkbuilddeps 2>&1 | \
sed -e 's/.*build dependencies://g' -e 's/([^)]*)//g'`

Change PHP5 to PHP7 in devscript.

$ sed -i -e 's/php5enmod/phpenmod/g' debian/mediawiki.postinst
$ sed -i -e 's/php5dismod/phpdismod/g' debian/mediawiki.prerm
$ sed -i -e 's:etc/php5:etc/php/7.0:g' debian/mediawiki.install
$ sed -i -e 's/mods_php5/mods_php7.0/g' debian/etc/mediawiki.conf

Build mediawiki source code.

$ dpkg-buildpackage -us -uc

Install mediawiki deb file with installing depends package.

$ sudo apt install -y php-common
$ sudo dpkg -i ../*.deb || (sudo apt install -f -y && sudo dpkg -i ../*.deb)

Install packages required by mediawiki.

$ sudo apt install -y libapache2-mod-php7.0 php7.0-xml imagemagick git
$ sudo systemctl retart apache2

2 Install MySQL

Install mysql-server with apt.

$ sudo apt install -y  mysql-server

Input MySQL password.

0001_MySQL-input-password.png

Confirm MySQL password.

0002_MySQL-confirm-password.png

3 Access to MediaWiki

Access the following URL with browser.

http://<server>/mediawiki

Click "set up the wiki".

0003_MediaWiki-start-setting.png

Select language.

0004_Mediawiki-select-lang.png

Improvements about mediawiki are displayed.

0005_MediaWiki-check-setting.png

Select MySQL and input MySQL password.

0006_MediaWiki-database-password.png

Use default database setting.

0007_MediaWiki-database-setting.png

Input Wiki name and add admin user.

0008_MediaWiki-username.png

Select access control list to Wiki. This article will use "Authorized editors only" which allow authorized user to write and allow public user to read.

0009_MediaWiki-user-rights-profile.png

Start installation.

0010_MediaWiki-start-install.png

The installation is completed.

0011_MediaWiki-complete-install.png

Download LocalSetting.php and copy to /etc/mediawiki manually.

$ sudo mv LocalSettings.php /etc/mediawiki/

0012_LocalSetting-php.png

Accessing the previous URL with browser will display Main page.

0013_MediaWiki.png