This page outlines the steps required to manually installMediaWiki. After installation, additional configuration details can be found atManual: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 theProject: Support desk or refer to other places listed atCommunication.
TheAppendices section below offersalternatives to manual installation, along with specific installation notes for different system configurations.
For a quicker local server setup of MediaWiki, refer to theLocal development quickstart.
Check that your system meets theinstallation requirements.
Make sure to also check theRelease notes of the MediaWiki version that you plan to install.
Download the MediaWiki tar file from theofficial download page.
If you are using MediaWiki in aproduction environment, the release manager has issued a strong recommendation that only versions listed atVersion 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.44.0.
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 as7-Zip (free),WinZip,WinRAR orIZArc (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 toManual:Security#File permissions.If you have not already uploaded the files to yourweb server (or copied, if your web server software runs locally on yourlocalhost
), do so now.
Upload the files to your web server's web directory either by:
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 yourhttpd.conf
file in theDocumentRoot
directive.By default, this is/var/www/
or<apache-folder>/htdocs
.
The exact location of the Apache server settings and directories filehttpd.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 towiki
, the URL will reflect this asexample.com/wiki
.If your web server is running ashttp://localhost
for example, renaming the directory to/w/
would mean you would access your wiki athttp://localhost/w/index.php
.
/wiki/
yet if you want to set upShort URLs after running theinitial configuration script.The MediaWikiinitial 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 theRun the installation script section.
If you do not know the root user’s password, for instance if you are using ahosted 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 theRun the installation script below.
No additional setup is required forSQLite if thepdo-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.
To create the database and user forMariaDB/MySQL, you can use one of the following methods:
The following commands will create a database namedmy_wiki
, a user namedwikiuser
, and assign permissions for the user on that database.
CREATEDATABASEmy_wiki;CREATEUSER'wikiuser'@'localhost'IDENTIFIEDBY'database_password';GRANTALLPRIVILEGESONmy_wiki.*TO'wikiuser'@'localhost'WITHGRANTOPTION;
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):
GRANTALLPRIVILEGESONmy_wiki.*TO'wikiuser'@'mediawiki.example.com'IDENTIFIEDBY'database_password';
![]() | MySQL/MariaDB logs all queries in a history file. It will include the database password for the user account. If this concerns you, delete and disable the.mysql_history file after running these queries by following theMySQL documentation. |
If you are usingPostgreSQL, 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 namedpostgres
.
The following commands on a Linux command-line, as the postgres user, create a database user namedwikiuser
, and a database namedmy_wiki
owned by the user namedwikiuser
.
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:
CREATEUSERwikiuserWITHNOCREATEDBNOCREATEROLENOSUPERUSERENCRYPTEDPASSWORD'database_password';CREATEDATABASEmy_wikiWITHOWNERwikiuser;
Beware of thelist of known issues when running MediaWiki with PostgreSQL.
Next, complete the installation of MediaWiki by going to the URL of your MediaWiki installation in your web browser: Follow the instructions inManual:Config script.
Once installed, make sure you stay up to date with releases, and keep your server secure!
Subscribe to the MediaWiki release announcements mailing list
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:
See also theComparison of distribution options.
The pages listed onManual: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 consultInstalling MediaWiki (this page) before looking at per-system installation documentation.
Refer toManual:FAQ#Installation and configuration.
Refer toManual:FAQ#Installation and configuration.