Skip to main content
This guide covers downloading MediaWiki, installing its PHP dependencies, and running the installer — either through the web-based setup wizard or the CLI.
Always back up your database before upgrading an existing MediaWiki installation.

Download MediaWiki

You can obtain MediaWiki by cloning the Git repository or downloading a release archive.
The canonical source is Wikimedia’s Gerrit instance:
git clone https://gerrit.wikimedia.org/r/mediawiki/core.git mediawiki
cd mediawiki
git checkout REL1_46

Install Dependencies with Composer

MediaWiki uses Composer to manage its PHP dependencies. If you cloned from Git, you must run composer install before the wiki will work.
composer install --no-dev
This installs all packages listed in the require section of composer.json into the vendor/ directory, and registers the MediaWiki\Composer\ autoloader.
Omit --no-dev if you intend to run tests or use development tools like Phan or PHPCS.
The pre-install-cmd hook runs MediaWiki\Composer\VersionChecker::onEvent to validate your PHP version before installation proceeds. If your PHP version is below 8.2.0, Composer will abort with an error.

Run the Installer

Choose between the web-based installer and the CLI installer.

Web-Based Installer

1

Place files on your web server

Copy or move the MediaWiki directory into your web server’s document root (e.g. /var/www/html/wiki).
2

Open the installer in your browser

Navigate to your wiki’s URL. If LocalSettings.php does not yet exist, MediaWiki automatically redirects to the setup wizard at mw-config/index.php.Fill in the form with your database credentials, wiki name, and administrator account details.
3

Download LocalSettings.php

At the end of the wizard, MediaWiki generates a LocalSettings.php file for you to download. Place this file in the root of your MediaWiki installation.
Download LocalSettings.php before leaving the installer — there is no way to retrieve it afterwards.
4

Remove or restrict mw-config/

Once the wiki is configured, the installer refuses to run again if LocalSettings.php exists. You may optionally remove the mw-config/ directory for additional security.

CLI Installer

The maintenance/install.php script provides a fully scriptable installation path. It is invoked via the maintenance/run.php dispatcher:
php maintenance/run.php install \
  --server=http://wiki.example.com \
  --dbtype=mysql \
  --dbserver=localhost \
  --dbname=my_wiki \
  --dbuser=wikiuser \
  --dbpass=secret \
  --pass=adminpassword \
  MyWiki Admin
The positional arguments are the wiki name (MyWiki) and the admin username (Admin). Full list of CLI options:
OptionDefaultDescription
--serverhttp://localhostBase URL of the web server
--scriptpath/<dirname>Relative path of the wiki in the URL
--langenWiki content language
--dbtypemysqlDatabase type (mysql, postgres, sqlite)
--dbserverlocalhostDatabase host name or IP
--dbport5432Database port (PostgreSQL only)
--dbnamemy_wikiDatabase name
--dbpath$IP/dataPath for the SQLite database file
--dbprefix(none)Optional table name prefix
--installdbuserrootDB user used for the install step
--installdbpass(none)Password for the install DB user
--dbuserwikiuserDB user for normal wiki operations
--dbpass(none)Password for the normal wiki DB user
--dbpassfile(none)Read --dbpass from a file
--pass(required)Administrator account password
--passfile(none)Read --pass from a file
--confpath$IPDirectory to write LocalSettings.php into
--dbschemamediawikiPostgreSQL schema name
--with-extensions(flag)Detect and include installed extensions
--extensions(none)Comma-separated list of extensions to enable
--skins(all)Comma-separated list of skins to enable
--with-developmentsettings(flag)Load DevelopmentSettings.php from LocalSettings.php
--env-checks(flag)Run environment checks only, make no changes

SQLite Quick-Install (Development)

The composer.json scripts section includes a one-command SQLite install for local development:
composer mw-install:sqlite
This runs the following command internally:
php maintenance/run.php install \
  --server=http://localhost:4000 \
  --dbtype=sqlite \
  --with-developmentsettings \
  --dbpath=cache/ \
  --scriptpath= \
  --pass=adminpassword \
  MediaWiki Admin
The SQLite database file is stored in cache/. The wiki is served at http://localhost:4000 with an empty script path.

Start the Development Server

After installing, start PHP’s built-in web server with:
composer serve
This is equivalent to:
PHP_CLI_SERVER_WORKERS=8 MW_LOG_DIR=logs MW_LOG_STDERR=1 php -S 127.0.0.1:4000
Your wiki will be available at http://localhost:4000.
The built-in PHP server is for development only. For production, use Apache or Nginx.

Docker (Development)

A docker-compose.yml is provided for containerized development. It uses Wikimedia’s official PHP 8.3 FPM image with an Apache frontend:
cp .env.example .env   # configure UID/GID and port
docker compose up
The default configuration sets:
  • Wiki served at http://localhost:8080
  • Database: SQLite stored at /var/www/html/w/cache/sqlite
  • Admin credentials: Admin / dockerpass
  • Log directory: /var/www/html/w/cache
A separate mediawiki-jobrunner service handles background job processing.

Build docs developers (and LLMs) love