CentOS 8.x mediawiki setup new wiki optionally using existing database

From Notes_Wiki

Home > CentOS > CentOS 8.x > Web based tools > mediawiki > setup new wiki optionally using existing database

To setup new mediawiki On CentOS 8.x optionally using existing database use:

  1. Download latest mediawiki ( https://www.mediawiki.org/wiki/Download )
    • 1.37.1 at time of writing this article
  2. Install web server
    dnf -y install httpd
    systemctl enable httpd
    systemctl start httpd
  3. Extract the mediawiki in web server document-root or some other appropriate sub-folder
  4. Based on situation disable SELinux / firewall or set appropriate permissions / firewalls rules to work with SELinux / firewalld.
  5. Open http://localhost to see HTTP server test / welcome page
  6. Check php versions available and enable the one most suitable for mediawiki version being setup
    dnf module list php
    dnf -y module enable php:8.0
    • Avoiding use of remi when php-8 is available in normal CentOS repos
    • Optionally 'dnf -y module reset php' in case any other php module was enabled earlier
  7. Install php packages required for mediawiki
    dnf -y install php php-mysqlnd php-intl
    dnf -y insstall epel-release
    dnf -y install php-gd
    systemctl restart httpd
  8. Check if mediawiki setup page is opening in browser properly or not. It should not show errors about missing dependencies.
  9. Setup Mariadb Database
    dnf -y install mariadb-server
    systemctl enable mariadb
    systemctl start mariadb
  10. In case of production setups use:
    mysql_secure_installation
  11. (Optional) If you are upgrading as existing old mediawiki, we can setup the same database, username, password, etc. before starting the setup wizard to achieve upgrade.
    mysql -u root -p
    mysql> create database notes_wiki;
    mysql> grant all on notes_wiki.* to notes_wiki@localhost identified by '<Secret>';
    mysql> flush privileges;
    mysql> quit
    dnf -y install sshpass
    bunzip2 -c notes_wiki.sql.bz2 | /usr/bin/sshpass -p <secret> mysql -u notes_wiki -p notes_wiki
  12. Go through the wiki web based setup wizard
    1. Choose language (eg English, English) and click continue
    2. Enusre no serious warning on Welcome page. "Warning: Could not find APCu or WinCache." is expected. Click continue
    3. On database page enter database host, username, password, database name, etc. properly and click continue
    4. (Optional - In case you are doing upgrade) For "There are MediaWiki tables in this database. To upgrade them to MediaWiki 1.37.1, click Continue." messaage click continue.
      • Page will appear to freeze. Avoid clicking continue second time and wait for next page to appear
    5. Use option to renegenerate LocalSettings.php
    6. Enter Wiki name, username, password, etc. Choose "Ask me more questions"
    7. Choose appropriate user rights profile and license. Enable required skins and extensions. Enable file upload and give path for deleted files. Avoid enabling caching. Continue.
      • mkdir deleted upload path; chmod 777 deleted upload path
    8. Download LocalSettings.php file and move it to wiki base folder
  13. Edit LocalSettings.php as per requirements such as:
    $wgServer
    FQDN of final server later on
    wgLogos
    Path to logo Or overwrite logo at <wiki-base-path>/resources/assets/wiki.png
    $wgDefaultSkin
    In case you want a different default skin
  14. Block unauthorized edits by adding following to LocalSettings.php file
    #Block unauthorized edits
    $wgGroupPermissions['*']['createaccount'] = false;
    $wgGroupPermissions['*']['edit'] = false;
    $wgGroupPermissions['*']['createpage'] = false;
    $wgGroupPermissions['*']['createtalk'] = false;
    $wgGroupPermissions['*']['writeapi'] = false;
  15. Set upload folders and parameters in LocalSettings.php file
    #Setting local directory for upload and its corresponding server URL
    $wgUploadDirectory='/documents/public_html/upload';
    #$wgUploadDirectory='/documents/room-documents/documents/databases/mysql/notes_wiki/upload';
    $wgUploadPath='/notes_wiki/upload';
    #Allow uploads from URL
    $wgAllowCopyUploads=true;
    #Enabling upload
    $wgEnableUploads=true;
    #Do not check for extensions too strictly
    $wgStrictFileExtensions=false;
    $wgFileExtensions = array_merge( $wgFileExtensions,
    array( 'doc', 'xls', 'mpp', 'pdf', 'ppt', 'xlsx', 'jpg',
    'tiff', 'odt', 'odg', 'ods', 'odp', 'json'
    )
    );
    $wgVerifyMimeType= "false";
  16. Go to wiki folder and run
    php maintenance/update.php
  17. Open the new wiki and check everything is as per expectations or not


Refer:


Home > CentOS > CentOS 8.x > Web based tools > mediawiki > setup new wiki optionally using existing database