Friday, March 15, 2019

Fedora Scratch MediaWiki Server

This guide is for installing a personal MediaWiki server on your own computer.

Install VirtualBox

  1. Install dependencies
    • sudo dnf install -y binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms qt5-qtx11extras libxkbcommon
  2. Add Oracle VirtualBox repository
    • sudo wget
  3. Install VirtualBox
    • sudo dnf install -y VirtualBox-6.0
  4. vbox kernel modules
    • sudo /usr/lib/virtualbox/ setup
  5. vbox user group
    • sudo usermod -a -G vboxusers username

Create VM

  1. Download Fedora 29 LXQT iso file
    • link
  2. Install VirtualBox
  3. Create vm
    • CD Drive: point to iso file
    • Network Adapter: Bridged
  4. Start vm

Set Up VM

  1. Uninstall annoying updater
    • sudo dnf remove dnfdragora
  2. Update
    • sudo dnf update
  3. Install basics
    • sudo dnf install nitrogen i3 vim
  4. Install VirtualBox Guest Additions
    1. su
    2. dnf install libxcrypt-compat gcc kernel-devel kernel-headers dkms make automake bzip2 perl
    3. KERN_DIR=/usr/src/kernels/`uname -r`/build
    4. export KERN_DIR=/usr/src/kernels/$(uname -r)
    5. KERN_DIR=/usr/src/kernels/5.xxxx.x86_64/build
    6. export KERN_DIR
    7. cd /run/media/username/VBox_GAs_6.0.4/
    8. ./
    9. usermod -aG vboxsf $USER
    10. Restart the vm
  5. Rename the VM if desired
    • sudo hostnamectl set-hostname new-name
    • restart

 Install Dependencies

  1. sudo dnf install python2 python2-libs python-unversioned-command python2-pip python2-setuptools policycoreutils-python-utils
  2. sudo dnf install -y httpd mariadb mariadb-server php php-pear php-xml php-mysqlnd php-intl php-pecl-zendopcache php-gd php-mbstring ImageMagick-perl
  3. sudo dnf install composer nginx-filesystem oniguruma php-PsrLog php-cli php-common php-fpm php-gd php-gmp php-intl php-json php-mbstring php-pear php-process php-symfony-class-loader php-symfony-common php-symfony-process php-xml php-Monolog php-cssjanus php-fedora-autoloader php-liuggio-statsd-php-client php-mediawiki-at-ease php-oojs-oojs-ui php-pear-Auth-SASL php-pear-Mail php-pear-Mail-Mime php-pear-Mail-mimeDecode php-pear-Net-SMTP php-pear-Net-Socket php-wikimedia-assert php-wikimedia-avro php-wikimedia-cdb php-wikimedia-ip-set php-wikimedia-utfnormal php-zordius-lightncandy
  4. sudo dnf install ImageMagick*
  5. sudo dnf update

Test Apache and PHP

  1. Permit site access through firewall
    • sudo firewall-cmd --add-service=http --permanent
  2. Permit ssh site access through firewall
    • sudo firewall-cmd --add-service=https --permanent
  3. Reload firewall
    • sudo firewall-cmd --reload
  4. Enable Apache on startup
    • sudo systemctl enable httpd.service 
  5. Start Apache
    • sudo systemctl start httpd.service
  6. Test Apache web service in browser
    • localhost 
    • ip address of server
  1. Create php info file
    1. cd /var/www/html/
    2. sudo vim info.php
    3. <?php
    4. :wq
  2. Test info file in browser
    • localhost/info.php

Set Up MariaDB

  1. Installation (done previously)
    • sudo dnf install mariadb mariadb-server 
  2. Make MariaDB run on startup
    • sudo systemctl enable mariadb
  3. Start MariaDB
    • sudo systemctl start mariadb
  4. Configure:
    1. sudo mysql_secure_installation
    2. When prompted for password:
      • press enter
    3. Set root password?
      • enter y
    4. Enter db root password twice (new custom password)
    5. Remove anonymous users?
      • enter y
    6. Disallow root login remotely?
      • enter y
    7. Remove test database and access to it?
      • enter y
    8. Reload privileges table now?
      • enter y
  5. Open db prompt
    • mysql -u root -p
  6. Create a database for the wiki
    •  CREATE DATABASE mydb;
  7. Create a database user for the wiki
    1. Initial creation
      • CREATE USER 'myuser' IDENTIFIED BY 'mypassword';
    2.  Allow user to use database server
      • GRANT USAGE ON *.* TO 'myuser'@localhost IDENTIFIED BY 'mypassword';
    3.  Grant user privileges to database
      • GRANT ALL privileges ON mydb.* TO 'myuser'@localhost;
    4. Apply changes
    5. Verify changes
      • SHOW GRANTS FOR 'myuser'@localhost;
  8. Exit
    • exit

  • To delete a database
    • DROP DATABASE mydb;
  • To delete a database user
    • DROP USER myuser@localhost;

Unpack MediaWiki

  1. Download MediaWiki in the vm Browser
    • to /home/user/Downloads/
  2. Create a wiki directory
    • cd /var/www/html/
    • mkdir wiki
  3. Unpack MediaWiki compressed file
    • It should unpack into a new directory in Downloads
  4. Copy contents of directory into wiki site directory
    • sudo cp -r /home/user/Downloads/MediaWikixxx/* /var/www/html/wiki/
  5. Change owner and group of files
    • cd /var/www/html/
    • sudo chown -R apache:apache wiki
  6. Navigate to wiki directory
    • cd /var/www/html/wiki 

  • If you need to run composer to install wiki dependencies
    1. cd /var/www/html/wiki
    2. composer update --no-dev

    Install MediaWiki

    This post is incomplete.
    There are some issues I need to research about file permissions, etc.

    Configure Uploads

    Configure for https

    No comments:

    Post a Comment