Manual:Installing MediaWiki
This page outlines the steps required to manually install MediaWiki. After installation, additional configuration details can be found at Manual:System administration#Configuration.
To install MediaWiki, a basic understanding of web hosting is needed. Experience with Apache, PHP, and MySQL/MariaDB will make the process easier. For any questions regarding MediaWiki installations, ask the Project: Support desk or refer to other places listed at Communication .
The Appendices section below offers alternatives to manual installation, along with specific installation notes for different system configurations.
For a quicker local server setup of MediaWiki, refer to the Local development quickstart .
Installation requirements
Check that your system meets the installation requirements.
Make sure to also check the Release notes of the MediaWiki version that you plan to install.
Download the MediaWiki software
Download the MediaWiki tar file from the official download page.
If you are using MediaWiki in a production environment, the release manager has issued a strong recommendation that only versions listed at Version lifecycle and their end-of-life as the current "stable version", "legacy version" or "long-term support version" should be used in a production environment. Older versions may contain critical security vulnerabilities and other major bugs, including the threat of possible data loss and/or corruption. The current stable version is MediaWiki 1.42.4.
Extract the MediaWiki software
The downloaded file is in .zip
or in .tar.gz
file format.
It needs to be uncompressed before use.
The file can be uncompressed locally (and then upload via FTP to the server) or directly on your server.
On Windows, uncompressing is usually done with software such as 7-Zip (free), WinZip, WinRAR or IZArc (free).
On Linux and macOS, you can uncompress the file using the command:
tar -xzvf mediawiki-*.tar.gz
chown -R <new_owner_user> <mediawiki_folder>
For more information on securing file permissions, refer to Manual:Security#File permissions.Upload files to your web server
If you have not already uploaded the files to your web server (or copied, if your web server software runs locally on your localhost
), do so now.
Upload the files to your web server's web directory either by:
- directly copying the unzipped folder or
- by using an FTP client such as FileZilla (Windows, macOS and Linux) or Cyberduck (Windows and macOS).
- by using software already provided by your hosting service, such as the cPanel File Manager.
If your upload tool has a "change file names to lowercase" option, then you must disable this to prevent any unintended modifications to file names during the upload process.
If you use the Apache HTTPD web server, the correct directory is specified in your httpd.conf
file in the DocumentRoot
directive.
By default, this is /var/www/
or <apache-folder>/htdocs
.
The exact location of the Apache server settings and directories file httpd.conf
depends on your operating system.
In Debian and Ubuntu, the file for Apache server settings and directories is /etc/apache2/apache2.conf
.
In Red Hat and Fedora, the file is /etc/httpd/conf/httpd.conf
.
Rename the uploaded folder to your desired name, as this will determine how it appears in the URL.
For example, if you rename the folder to wiki
, the URL will reflect this as example.com/wiki
.
If your web server is running as http://localhost
for example, renaming the directory to /w/
would mean you would access your wiki at http://localhost/w/index.php
.
/wiki/
yet if you want to set up Short URLs after running the initial configuration script.
Set up the database
The MediaWiki initial configuration script requires a database name and a database username to store the wiki’s content.
If you already have a database server and know the password for the root (administrator) user, you can skip directly to the Run the installation script section.
If you do not know the root user’s password, for instance if you are using a hosted server, you will need to create a new database before proceeding to the MediaWiki installation script.
MariaDB/MySQL are the recommended databases. While PostgreSQL and SQLite are supported, they offer limited compatibility and should only be used only if necessary. If you're unsure which database to choose, use MariaDB.
Once the database setup is complete, proceed to the Run the installation script below.
SQLite
No additional setup is required for SQLite if the pdo-sqlite
module for PHP is installed on the system.
On the SQLite installation page, select a database name (any name is acceptable) and an SQLite database directory. The installer will attempt to use a directory outside the document root and create it if necessary. If this directory is web-readable or insecure, it should be manually changed to prevent unauthorized access.
MariaDB/MySQL
To create the database and user for MariaDB/MySQL, you can use one of the following methods:
- A control panel provided by your hosting service, such as phpMyAdmin.
- SSH access to your host, where you can enter the commands below into a MySQL prompt. Refer to your hosting provider’s documentation. Alternatively, you can request that your hosting provider create the database and user for you.
The following commands will create a database named my_wiki
, a user named wikiuser
, and assign permissions for the user on that database.
CREATE DATABASE my_wiki;
CREATE USER 'wikiuser'@'localhost' IDENTIFIED BY 'database_password';
GRANT ALL PRIVILEGES ON my_wiki.* TO 'wikiuser'@'localhost' WITH GRANT OPTION;
Only if your database is not running on the same server as your web server, you need to give the appropriate web server hostname (mediawiki.example.com
in the example below):
GRANT ALL PRIVILEGES ON my_wiki.* TO 'wikiuser'@'mediawiki.example.com' IDENTIFIED BY 'database_password';
PostgreSQL
If you are using PostgreSQL, you will need to either have a database and user created for you, or supply the name of a PostgreSQL user with "superuser" privileges to the configuration form.
Often, this is the database user named postgres
.
The following commands on a Linux command-line, as the postgres user, create a database user named wikiuser
, and a database named my_wiki
owned by the user named wikiuser
.
createuser -S -D -R -P -E wikiuser (then enter the database password) createdb -O wikiuser my_wiki
or as superuser (default postgres) execute the following commands at the database prompt:
CREATE USER wikiuser WITH NOCREATEDB NOCREATEROLE NOSUPERUSER ENCRYPTED PASSWORD 'database_password';
CREATE DATABASE my_wiki WITH OWNER wikiuser;
Beware of the list of known issues when running MediaWiki with PostgreSQL.
Run the installation script
Next, complete the installation of MediaWiki by going to the URL of your MediaWiki installation in your web browser: Follow the instructions in Manual:Config script .
Further configuration
- Manual:System administration - Additional configuration
- Manual:Administrators - Wiki administration
Keep up to date!
Once installed, make sure you stay up to date with releases, and keep your server secure!
Appendices
Alternatives to manual installation
Manual installation is often the preferred method because it gives the user more control and insight into how their wiki is installed, making troubleshooting and maintenance easier. Automated processes, packages, bundles, and services all come with their own idiosyncrasies.
Instead of manually installing MediaWiki, alternative options might be easier:
- pre-integrated software appliances
- hosting services with 1-click installation, or wiki farms
- Software bundles
- Hosting services which provide automatical installation of applications such as MediaWiki may offer outdated versions or have other issues. If you encounter problems, it does not mean that you cannot install MediaWiki. It means that you should install MediaWiki manually.
See also the comparison of distribution options .
System-specific instructions
The pages listed on Manual:OS specific help give more detailed installation instructions aimed at specific systems.
However, by and large these per-system docs are less maintained and might not always be up to date. First consult Installing MediaWiki (this page) before looking at per-system installation documentation.
Running multiple wikis
Refer to Manual:FAQ#Installation and configuration.
Importing an existing wiki database
Refer to Manual:FAQ#Installation and configuration.