Difference between revisions of "Install MediaWiki as Wikipedia in Linux CentOS 7"

From Gejoreuy
Jump to navigation Jump to search
Line 17: Line 17:
 
</pre>
 
</pre>
  
=== Step 2 : Install PHP & MariaDB Database ===  
+
=== Step 2 : Install MariaDB Database ===  
  
 
In this step, we just install MariaDB database. Start it. And setup security.
 
In this step, we just install MariaDB database. Start it. And setup security.
Line 40: Line 40:
 
</pre>
 
</pre>
  
=== Install PHP mbstring ===
+
=== Install PHP, PHP-MySQL, & PHP-MBString ===
[[Install PHP mbstring on CentOS 7]] --> $ yum install php-mbstring
+
 
 +
PHP is a general-purpose server-side scripting language.
 +
 
 +
<pre>
 +
[root@qemu01 ~]# yum install php php-mysql php-mbstring
 +
[root@qemu01 ~]# systemctl restart httpd.service
 +
</pre>
  
 
=== Install PHPMyAdmin ===
 
=== Install PHPMyAdmin ===

Revision as of 16:01, 9 August 2019

System Requirements

MediaWiki requires PHP 5.5.9+ and either MySQL 5.0.2+, MariaDB, or one of the other three possible stores.

Setup Web Server and Database

Step 1 : Install Apache Web Server

Install Apache Web Server, PHP & MySQL on CentOS 7 --> https://hostadvice.com/how-to/how-to-install-lamp-stack-on-centos-7/

Update the server. Install Apache web server. Enable and start it. Then test to access it from a web browser.

[root@qemu01 ~]# yum update
[root@qemu01 ~]# yum install httpd
[root@qemu01 ~]# systemctl enable httpd.service
[root@qemu01 ~]# systemctl start httpd.service

Step 2 : Install MariaDB Database

In this step, we just install MariaDB database. Start it. And setup security.

[root@qemu01 ~]# yum install mariadb-server mariadb
[root@qemu01 ~]# systemctl enable mariadb.service
[root@qemu01 ~]# systemctl start mariadb
[root@qemu01 ~]# mysql_secure_installation

In MariaDB securing steps, we have to provide the answers below for simplicity.

Set root password? [Y/n] Y
New password: Enter your password here
Re-enter new password: repeat your password
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Install PHP, PHP-MySQL, & PHP-MBString

PHP is a general-purpose server-side scripting language.

[root@qemu01 ~]# yum install php php-mysql php-mbstring
[root@qemu01 ~]# systemctl restart httpd.service

Install PHPMyAdmin

Install PHPMyAdmin on CentOS 7 --> https://www.hostinger.com/tutorials/how-to-install-phpmyadmin-on-centos-7/

Prepare MediaWiki Sources

Download MediaWiki 1.27.0

The last stable MediaWiki can be downloaded from MediaWiki.

wget https://releases.wikimedia.org/mediawiki/1.27/mediawiki-1.27.0.tar.gz

Put Media Wiki in Web Server

As example, if we're using Centos 7, the web server path is in /var/www/html/.

mv mediawiki-1.27.0.tar.gz /var/www/html/

Extract the File

Extract the tar file and rename it with your wiki name, as example named with wikipedia.

tar xvzf mediawiki-1.27.0.tar.gz

mv /var/www/html/mediawiki-1.27.0 /var/www/html/wikipedia

Run the MediaWiki Installation

Open MediaWiki index.php page at http://[web_server_address]/wikipedia/index.php and follow the installation requirement there.

Troubleshooting

Problem 1 : LocalSettings.php File Not Readable

Solution : run restorecon command into the wikipedia website folder.

[root@qemu01 ~]# restorecon -r /var/www/html/wikipedia/

Problem 2 : First Login Error (Session Hijacking Protection)

Solution : Change $wgMainCacheType from CACHE_ACCEL to CACHE_ANYTHING as suggested in LocalSettings.php file.

[root@qemu01 ~]# cd  /var/www/html/wikipedia
[root@qemu01 wikipedia]# vi LocalSettings.php
...
## Shared memory settings
#$wgMainCacheType = CACHE_ACCEL;
$wgMainCacheType = CACHE_ANYTHING;
$wgMemCachedServers = [];
...

Problem 3 : Upload File Error (LocalFileLockError)

Solution : Run setenforce 0 script and then try again.

[root@qemu01 ~]# sudo setenforce 0