Manual:Installing Mediawiki on Oracle Linux 7

From Linux Web Expert

Revision as of 13:08, 1 December 2023 by imported>SamanthaNguyen (minor formatting)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page covers installing MediaWiki 1.30 (an old, nowadays outdated version) server in Oracle Linux 7. This document will not cover the installation of Oracle Linux 7.

Installation additional software packages

In order to be able to install a MediaWiki server you will have to install these extra software packages in Oracle linux: httpd, php, php-mysql, php-gd, php-xml, mariadb-server, mariadb, php-mbstring, php-json.

In order to be able to install the latest php software packages, you will have to add the development repository from Oracle Linux 7:

# yum-config-manager --add-repo http://yum.oracle.com/repo/OracleLinux/OL7/developer_php72/x86_64
# yum update

The httpd package is the Apache webserver, and mariadb-server is the mysql server.

# yum install httpd php php-mysql php-gd php-xml mariadb-server php-mbstring php-json

Check if both mariadb and httpd services are disabled:

# systemctl status mariadb
mariadb.service - MariaDB database server
  Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
  Active: inactive (dead)
# systemctl status httpd
 Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
  Active: inactive (dead)
    Docs: man:httpd(8)
          man:apachectl(8)

Configuration httpd webserver

Before proceeding, you will have to configure the httpd webserver first. The main configuration file httpd.conf of the httpd webserver can be found in /etc/httpd/conf. First of all you will have to add the IP address of the webserver to the httpd.conf file. You can do this to uncomment the line ServerName and fill in the correct IP address:

# cd /etc/httpd/conf
# cp httpd.conf httpd.conf.orig
# vi httpd.conf
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
# ServerName  www.example.com:80

The httpd.conf file contains also the DocumentRoot out of which your httpd server will serve your HTML documents.

 # DocumentRoot: The directory out of which you will serve your
 # documents. By default, all requests are taken from this directory, but
 # symbolic links and aliases may be used to point to other locations.
 #
 DocumentRoot "/var/www/html"

After filling in the correct IP address, you can enable and start the httpd service:

# systemctl enable httpd
# systemctl start httpd
# systemctl status httpd
httpd.service - The Apache HTTP Server
  Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
  Active: active (running) since Fri 2018-03-16 10:20:56 EDT; 12min ago
    Docs: man:httpd(8)
          man:apachectl(8)
Main PID: 15801 (httpd)
  Status: "Total requests: 3; Current requests/sec: 0; Current traffic:   0 B/sec"
  CGroup: /system.slice/httpd.service
          ├─15801 /usr/sbin/httpd -DFOREGROUND
          ├─15806 /usr/sbin/httpd -DFOREGROUND
          ├─15807 /usr/sbin/httpd -DFOREGROUND
          ├─15808 /usr/sbin/httpd -DFOREGROUND
          ├─15809 /usr/sbin/httpd -DFOREGROUND
          ├─15811 /usr/sbin/httpd -DFOREGROUND
          └─15989 /usr/sbin/httpd -DFOREGROUND
Mar 16 10:20:56 Mediawiki-OL7 systemd[1]: Starting The Apache HTTP Server...
Mar 16 10:20:56 Mediawiki-OL7 httpd[15801]: AH00558: httpd: Could not reliably determine the ...age
Mar 16 10:20:56 Mediawiki-OL7 systemd[1]: Started The Apache HTTP Server.

If you now open your browser and fill in the IP address of your Oracle Linux server, you will see the default Apache webserver page.

When your test was successful, you can stop the httpd server again:

# systemctl stop httpd

Mariadb root password

Before you can use the mariadb server, you will have to create a password for the root user.

# systemctl enable mariadb
# systemctl start mariadb
# systemctl status mariadb
mariadb.service - MariaDB database server
  Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Active: active (running) since Fri 2018-03-16 10:14:19 EDT; 2s ago
 Process: 15417 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
 Process: 15334 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 15416 (mysqld_safe)
  CGroup: /system.slice/mariadb.service
          ├─15416 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
          └─15578 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr...
Mar 16 10:14:17 Mediawiki-OL7 mariadb-prepare-db-dir[15334]: MySQL manual for more instructions.
Mar 16 10:14:17 Mediawiki-OL7 mariadb-prepare-db-dir[15334]: Please report any problems at http...a
Mar 16 10:14:17 Mediawiki-OL7 mariadb-prepare-db-dir[15334]: The latest information about Maria....
Mar 16 10:14:17 Mediawiki-OL7 mariadb-prepare-db-dir[15334]: You can find additional informatio...:
Mar 16 10:14:17 Mediawiki-OL7 mariadb-prepare-db-dir[15334]: http://dev.mysql.com
Mar 16 10:14:17 Mediawiki-OL7 mariadb-prepare-db-dir[15334]: Consider joining MariaDB's strong ...:
Mar 16 10:14:17 Mediawiki-OL7 mariadb-prepare-db-dir[15334]: https://mariadb.org/get-involved/
Mar 16 10:14:17 Mediawiki-OL7 mysqld_safe[15416]: 180316 10:14:17 mysqld_safe Logging to '/var...'.
Mar 16 10:14:17 Mediawiki-OL7 mysqld_safe[15416]: 180316 10:14:17 mysqld_safe Starting mysqld ...ql
Mar 16 10:14:19 Mediawiki-OL7 systemd[1]: Started MariaDB database server.
# mysqladmin -u root -p password

Download Mediawiki source software

You can visit the download page here to download MediaWiki. The mediawiki-1.30.0.tar.gz file can then be unpacked and copied into /var/www/html (DocumentRoot Apache server).

# scp <path download folder>/mediawiki-1.30.0.tar.gz <Oracle linux user>@<ip address Oracle linux server>:/var/tmp

On the Oracle linux server:

# cd /var/tmp
# gunzip mediawiki-1.30.0.tar.gz
# mv mediawiki-1.30.0.tar /var/www
# cd /var/www
# mv html html_httpd
# tar xvf mediawiki-1.30.0.tar
# mv mediawiki-1.30.0 html

When the Mediawiki software has been unpacked, you can start the httpd service:

# systemctl start httpd

Initial Mediawiki installation

If you now open your browser and fill in the ip address of Oracle linux 7 server, you will see the MediaWiki server first page and you can start the initial installation by clicking set up the wiki:

During the initial installation you will be prompted to fill in a Mediawiki database name and the root password of the mariadb server, which was generated earlier in this document. After the initial installation a LocalSetting.php file will be created. You will need to download the LocalSetting.php file and copy it to the DocumentRoot of your httpd webserver. In this case this will be /var/www/html.

After disabling/enabling the httpd service, you can start using your MediaWiki server:

# systemctl stop httpd
# systemctl start httpd

JefAdams (talk) 15:06, 16 March 2018 (UTC)