Mediawiki

= Installation =

Prerequisites:

Ubuntu 16.04.2 LTS and Debian Stretch include PHP 7.0, and renamed many packages from "php5" to plain "php". Some PHP modules are now in separate packages (xml, mbstring):

sudo apt-get install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring

Ubuntu Trusty, Debian Jessie and Raspbian (Jessie) include PHP 5, and use "php5" in most (but not all) packages:

sudo apt-get install apache2 mysql-server php5 php5-mysql libapache2-mod-php5

Get MediaWiki

cd Downloads wget https://releases.wikimedia.org/mediawiki/1.28/mediawiki-1.28.2.tar.gz

Extract in your Web directory

tar -xvzf /pathtofile/mediawiki-*.tar.gz sudo mkdir /var/www/html/mediawiki sudo mv mediawiki-*/* /var/www/html/mediawiki

Configure MySQL

mysqladmin -u root password "enter the new password here"

Optional: Configure PHP

Change Maximum upload file size in File Uploads section to sudo nano /etc/php5/apache2/php.ini upload_max_filesize = 20M

Memory limit memory_limit = 128M

= Logo =

= Favicon =

= Backup Script =

mysqldump -u root -ppwd@123 my_wiki | gzip > /home/aman/Backup/my_wiki-$(date +"%d-%b-%Y").sql.gz echo "$(date +"%d-%b-%Y"): MYSQL DB backup done" >> /home/aman/Backup/status.log sleep 2 tar cfz /home/aman/Backup/images-$(date +"%d-%b-%Y").tar.gz /var/www/html/images/ echo "$(date +"%d-%b-%Y"): Images Backup Done" >> /home/aman/Backup/status.log sleep 2 tar cfz /home/aman/Backup/LocalSettings-$(date +"%d-%b-%Y").tar.gz /var/www/html/LocalSettings.php echo "$(date +"%d-%b-%Y"): LocalSettings Backup done" >> /home/aman/Backup/status.log exit

If you dont want gzip compression: mysqldump -u root -pavi123 my_wiki > /home/test/Backup/my_wiki-$(date +"%H%M%S-%d-%b-%Y").sql


 * Run Backup every week at 5:00AM:

* 5 * * 1 /home/aman/backup-wiki.sh 2>&1 >> /home/aman/Backup/cron_output.log

sudo nano /etc/logrotate.d/backup-wiki
 * Logrotate:

/home/test/Backup/*.sql.gz { weekly missingok rotate 3 compress notifempty }

sudo logrotate /etc/logrotate.conf --debug

= Restoring From Backup =

Restore Images php mediawiki/maintenance/importImages.php --search-recursively images/

Rebuild all php mediawiki/maintenance/php5 rebuildall.php


 * References