• Part 1: How to install MediaWiki
    June 22, 2019

    As you guys might know , I just got started in the field of programming and open-source contribution. I was hoping that it would be easy enough for me to grasp the concept but after a fatal step (of which I have no idea) , the task of installing MySQL became so elusive and frustrating that I was literally about to loss my mind . So I’m gonna try to prevent you guys from doing the same mistake as me.

    Step 1
    Do not try install Apache,MySQL or PHP separately.
    Try using the command sudo apt-get install lamp-server^ This will install all 3 of them.

    Step 2
    Install git , if you do not already have it . To install it,use sudo apt-get install git

    Step 3
    After installing git, you must configure your username and email as git tracks any changes you make using your username and email.
    git config –global “user.email”—–Enter you email address instead of user.email.
    git config –global “user.name”—-Enter your chosen username and replace it with “user.name”.

    Step 4
    Now, you need to generate SSH keys to establish a connection between your PC and Gerrit but to be able to generate a new key you need to check if a key already exists. To check for this , try :
    ssh-keygen -t rsa -C “your email address”
    After you enter the above command , you’re gonna be prompted for a passphrase. Do not worry about that just press enter. You now need to create a Gerrit account and add the SSH key. Follow the following steps.

    • 1. Go to wikitech.wikimedia.org.
    • 2. Log into the web interface of Gerrit.
    • 3. Go to settings and click on “SSH Public Keys”
    • 4. Paste your ssh key into the corresponding filed

    Now , run eval ‘ssh-agent‘ and ssh-add .ssh/id_rsa
    In order not to get “Permission denied”, you should run ssh -p 29418 USERNAME@gerrit.wikimedia.org

    Step 5
    Download MediaWiki through the following command.

    Step 6
    Once the download is completed, you need to extract the folder and place it in your web directory. To extract the folder use the following command.
    tar -xvzf /tmp/mediawiki-*.tar.gz
    Now rename the mediawiki file as “core” and copy it to the www folder of var. If you are not able to paste it , it might be because your the folder is read only. So to solve this , apply the following command sudo chmod 777 -R 777 /var/www/html

    This will remove any restriction and then just copy the core file into www folder. You can try to see if the localhost is working. So go to your browser and search for https://localhost/core/
    It may also happen that you may not have installed all the extension . The extensions that you might be asked to download might be php-mdstring and xml.

    To install mbstring , just type the following command,
    sudo apt-get install php-mbstring

    To install xml,
    sudo apt-get install php-xmlOnce you completed downloading everything restart the Apache server using the command systemctl restart apache2

    Now try localhost/core/ again. It should work.

    Step 7
    Now just go through the local setting till you reach a page where you are asked for a for username and password. Those are actually for your database which you have not yet created. So open terminal and create a database.

    1. Create a mysql user.

    sudo mysql -u root -p “password” —-Replace the “password” with an actual password.
    mysql>CREATE USER ‘new_mysql_user’@’localhost’ IDENTIFIED BY “your password”;

    2. Create a mysql database pi_wiki
    sudo mysql -u root
    mysql> CREATE DATABASE pi_wiki;
    mysql> use pi_wiki;

    3. Grant user access to new database.
    mysql> GRANT ALL ON pi_wiki.* TO ‘new_mysql_user’@’localhost’;

    Step 8
    Now fill in the boxes with the appropriate information and you're good to go.