7. Install MediaWiki#
Over the last few weeks you’ve created a web application on your VM. The simple application counts visits using file storage. Files storage is fine for very simple applications but will eventually fail under heavy load, corrupting your precious data. This week we are going to install a database management system (DBMS), commonly referred to as a database. The DBMS offers structured storage that supports A.C.I.D. (Atomic, Consistent, Independent and Durable) transactions. Those important properties make it possible for many users to access our application at the same time without risk of data corruption. Every web application that has user-modifiable data and handles any amount of traffic uses a DBMS of some kind.
Labs#
In class we’ll do two top-level tasks:
Create a Postgres Database with the following settings:
Enterprise Edition (not Enterprise Plus)
“Sandbox” Edition Preset
Machine Configuration:
General Purpose - Shared Core
1 vCPU with 0.614 GB of Memory
A private address on your
cis-91VPC
Connecting to the instance
Manage a database from your VM
Install and configure MediaWiki
Tasks will be broken up into smaller parts in recorded labs. Since the second two activities are pretty specific to this class there are no written labs to follow.
Lab 2: Connecting to the Instance#
On the “Overview” page of your instance there’s a title “Connect to this instance”. Under that title there’s a heading “Need help connecting?”. Follow the instructions for both connecting with the cloud shell and connecting with your VM.
Lab 3: Manage Postgres#
In this recorded lab we’ll take a tour of Postgres by connecting to the DBMS and issuing SQL commands. Here’s a summary of the steps we’ll take:
Use the
pgsqlcommand to connect as the userpostgreswith the password you chose on setup.Introduction to SQL commands:
CREATEINSERTSELECTDELETEDROP
Lab 4: Install MediaWiki#
In this recorded lab we’ll install MediaWiki by downloading its source code into
our web directory. Start by downloading the source code with wget:
$ cd /var/www/html
$ sudo wget https://releases.wikimedia.org/mediawiki/1.46/mediawiki-1.46.2.tar.gz
$ sudo tar -xvf mediawiki-1.46.2.tar.gz
Edit your index.php file to redirect user to your wiki when they land on your
main page. This overwrites your existing index.php file.
$ sudo tee index.php << 'EOF'
<?php
header("Location: mediawiki-1.46.2");
exit;
EOF
Visit your site and you’ll see an error. This is because you need to install
some PHP extensions. Find them using apt search. After they’re installed you
have to run:
$ sudo systemctl restart apache2
With the proper PHP extensions installed you should be able to setup your Wiki
using the installer. The installer will ask you to add some packages, including
the php-Postgres package. Keep track of the packages you install. Use the
database information from your database instance. Once you’ve completed the
process you’ll have a LocalSettings.php file that contains your setup.
Keep a copy of LocalSettings.php
Project Documentation#
Your project documentation should focus on the steps you will need to take to
recreate MediaWiki. Carefully document the packages you installed and the steps
you took to configure Postgres. The Postgres documentation need not contain the
SQL commands we did in class. Your documentation should also include a copy of
your LocalSettings.php file.
Warning
LocalSettings.php contains passwords! Remove them before posting it to the
discussion forum!
You forum post this week should have at least:
Documentation of the packages you installed
Commands to create a user on Postgres
A copy of
LocalSettings.phpwith your passwords deletedA screenshot of your wiki