Signup/Sign In
FEBRUARY 10, 2023

How to setup mediawiki in centos9?

    MediaWiki is a popular open-source wiki software that is used to create and manage wikis by thousands of websites including Wikipedia. It is an one of the most ideal platform for creating collaborative websites and documentation portals. In this article, we will guide you how to install MediaWiki on a CentOS 9 server (fresh VPS).

    Prerequisites

    Before you begin, you will need a CentOS 9 server with a non-root user with sudo privileges or root user. Secondly, make sure the firewall does not block the http server ports i.e, 80 and 443.

    If you are using a cloud platform then use the following configuration:

    name centos-9
    size s-1vcpu-2gb-amd
    image centos-stream-9-x64
    Authentication key (.pem)

    Open terminal or SSH into the server.

    CentOS 9 ssh

    Step1: Install Necessary Packages required by MediaWiki

    The first step is to install the necessary packages for MediaWiki. These include Apache2 (web server), MariaDB (database server), PHP (Interpreter), and some PHP modules (required to MediaWiki). You can install them by running the following command:

    sudo yum install httpd mariadb-server php php-mysqlnd php-xml php-intl wget vim nano libnsl netstat

    yum install lamp server on centos 9

    Step 2: Start Apache and MariaDB servers

    Once the packages are installed, you need to start and enable the Apache and MariaDB services. You can do this by running the following commands:

    sudo systemctl start httpd
    sudo systemctl enable httpd
    sudo systemctl start mariadb
    sudo systemctl enable mariadb

    Start http and sql server on centos 9

    Step3: Create a Database and User for MediaWiki

    The next step is to create a new database and user for MediaWiki. You can do this by following these steps:

    1. Connect to the database server with this command:
      sudo mysql

    2. Create and modify permissions in the database with:
      CREATE DATABASE wikidb;
      #CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'password';
      GRANT ALL PRIVILEGES ON wikidb.* TO 'wikiuser'@'localhost';
      FLUSH PRIVILEGES;
      EXIT;

    MediaWiki SQL database setup

    mysql_secure_installation can be used to encrypt the database with a secure password.

    Step 4: Download and Extract MediaWiki

    You can download the latest version of MediaWiki from the official website. Once it is downloaded, you need to extract it to the Apache web or document root directory (/var/www/html).

    curl -O 'https://releases.wikimedia.org/mediawiki/1.39/mediawiki-1.39.1.zip'
    unzip mediawiki-1.39.1.zip
    mv mediawiki-1.39.1 mediawiki

    mediawiki download and extract

    Step 5: Change Ownership of MediaWiki Files

    Change the ownership of the MediaWiki files to the Apache user by running the following command:

    sudo chown -R apache:apache /var/www/html/mediawiki
    sudo chmod -R 755 mediawiki

    Chmod and Chown command in centos9

    Step 6: Start the MediaWiki installation script in web browser

    You can access the MediaWiki installation script by navigating to "http://localhost/mediawiki" or "http://your-server-ip/mediawiki" in your web browser. Follow the prompts to complete the installation, including providing the database information and user you created in step 3.

    Mediawiki installation in browser

    Conclusion

    Congratulations! You have successfully installed MediaWiki on your CentOS 9 server. With this powerful wiki tool, you can create and manage wikis for your organization or community. With the help of this guide, you can easily set up your own MediaWiki server, and start creating and sharing knowledge to the world.

    Pradeep has expertise in Linux, Go, Nginx, Apache, CyberSecurity, AppSec and various other technical areas. He has contributed to numerous publications and websites, providing his readers with insightful and informative content.
    IF YOU LIKE IT, THEN SHARE IT
    Advertisement

    RELATED POSTS