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
This section is under construction. |
Favicon
This section is under construction. |
Backup
Using Script
Installation
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 -ppwd@123 my_wiki > /home/aman/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
- Logrotate:
sudo nano /etc/logrotate.d/backup-wiki
/home/aman/Backup/*.sql.gz { weekly missingok rotate 3 maxage 7 compress notifempty }
sudo logrotate /etc/logrotate.conf --debug --force
Restoring From Backup
Restore Images
php mediawiki/maintenance/importImages.php --search-recursively images/
Rebuild all
php mediawiki/maintenance/php5 rebuildall.php
Using Dumpgenerator
Source: github.comgithub.com
Install Poetry:
curl -sSL https://install.python-poetry.org | python3 -
Install Dumpgenerator:
git clone https://github.com/mediawiki-client-tools/mediawiki-dump-generator cd mediawiki-dump-generator poetry update && poetry install && poetry build pip3 install --force-reinstall dist/*.whl
If you are getting an error for dependancies:
pip3 install lxml==4.9.4 sudo apt install libxml2-dev libxslt-dev python3-dev
Generate Backup:
dumpgenerator --xml --images --api https://aman.awiki.org/w/api.php --index https://aman.awiki.org/w/index.php --bypass-cdn-image-compression https://aman.awiki.org
Restoring Backup:
Source: meta.miraheze.org
- References
{{#widget:DISQUS
|id=networkm
|uniqid=Mediawiki
|url=https://aman.awiki.org/wiki/Mediawiki
}}