Manual:Installing MediaWiki

MediaWiki installs itself using an interactive, web-based installation script. Before you can run this script, you need to do a couple of things: see 1>Special:MyLanguage/Manual:Installation requirements|prerequisites or 2>Special:MyLanguage/Manual:Installation_guide#Summarized_installation_guide|short installation guide for experts.

MediaWiki can be difficult to install for the average computer user who does not have experience with Apache, PHP and MySQL/MariaDB. Most users who wish to use wiki software may benefit from using a [https://wikiindex.org/Category:Free_MediaWiki_wiki_farms free MediaWiki host] or via a 1>Special:MyLanguage/software bundles|software bundle.

Download MediaWiki software
You can download a release version of MediaWiki from the official download page: generally, if you're using a production environment, you want to be running the stable release.

To download MediaWiki, which is the latest stable release version, to a *nix machine you can use the following command:

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

Alternatively, using cURL:

curl -O https://releases.wikimedia.org/mediawiki//mediawiki-.tar.gz

The downloaded files are in  format, so they will need to be uncompressed before use. This can be done locally (and then uploaded via FTP) or directly on your server. This is usually done with software such as 7-Zip (free), WinZip, WinRAR or IZArc (free) on Windows. On Linux and Mac OS X, you can untar the file using this command:

tar xvzf mediawiki-*.tar.gz

For developers
Developers on the other hand should probably 1>Special:MyLanguage/download from Git|download from Git to set up a local repository with the latest code in development. They will also need to manually install dependencies via Composer.

Upload files to your server
If you have not already uploaded the files to your web server, do so now.

Upload the files to your web server's web directory either by:


 * 1) directly copying the unzipped folder or


 * 1) by using an FTP client such as <tvar|filezilla>FileZilla</> (Open Source Software, Windows, OSX and Linux) or <tvar|cyberduck>Cyberduck</> (Also OSS, Windows and OSX).
 * 1) by using cPanel File Manager (see below)

If your upload tool has a "change file names to lowercase" option, then you must disable this.

If you installed Apache, the correct directory is specified in your <tvar|conf> </> file (it's the [<tvar|docroot>https://httpd.apache.org/docs/current/mod/core.html#documentroot</> DocumentRoot] directive, typically  or  ). Note: This changed in Ubuntu 14.04 with Apache 2.4.7 where the primary configuration file for Apache server settings and directories is <tvar|conf> </>.

If you are using a Linux or Unix server you can instead copy the files to any directory on your server and then make a symbolic link to that folder from your web server's web directory.

Rename the uploaded folder to whatever you would like to have in the URL. If your web server is running as  for example, renaming to   directory would mean you would access your wiki at <tvar|index> </>. Do not use <tvar|wiki> </> if you want to use it as a short-url>Special:MyLanguage/Manual:Short URL</>|Short URL. (And don't set up short URLs until you have run the installation script.)

This (renamed) folder will now be referred as.

cPanel File Manager
cPanel is a popular interface used by many web hosts. This method is efficient because the files are uncompressed on the server itself.


 * Navigate to the directory where you want your wiki folder.
 * Upload the mediawiki-1.xx.x.tar.gz file. You may need to hit "Reload" to see it.
 * Extract the mediawiki-1.xx.x.tar.gz file. Reload again.
 * Confirm that the mediawiki-1.xx.x folder is present.
 * Delete the tar.gz file.

Create a database
If you already have a database server and know the root password for it, the MediaWiki installation script can create a new database for you. If this is the case, you can skip to the 1>#Run the installation script</>|Run the installation script section below. If you don't know the root password, for example if you are on a hosted server, you will have to create a new database now. Currently, you must use SQLite, MariaDB/MySQL or PostgreSQL to store the actual contents of your wiki. If you're unsure which database to choose, use MariaDB as it is the one best supported by MediaWiki.

SQLite
SQLite is a stand-alone database library that stores the database contents in a single file. If PHP has the  module, no further setup is required.

On the installation page, you will need to choose a database name (which can be anything) and the SQLite database directory. For the database directory, the installer will attempt to use a subdirectory outside of the document root and create it if needed. If this directory is not safe (for example, web-readable), change it manually to avoid making it accessible to everyone on the web.

MariaDB/MySQL
MediaWiki will ask you for database and user name and will attempt to create them if they don't already exist. If doing so from MediaWiki is impossible, you can do this using various control panels such as PhpMyAdmin, which are often available from shared hosts, or you may be able to use ssh to login to your host and type the commands into a MySQL prompt. See the corresponding documentation.

Alternatively, contact your host provider to have them create an account for you.

If your database is not running on the same server as your web server, you need to give the appropriate web server hostname &mdash; mediawiki.example.com in the example below &mdash; as follows:

PostgreSQL
If you are using PostgreSQL, you will need to either have a database and user created for you, or simply supply the name of a PostgreSQL user with "superuser" privileges to the configuration form. Often, this is the database user named postgres.

Here's one way to do most of the setup. This is for a Unix-like system. In this example, we'll create a database named wikidb, owned by a user named wikiuser. From the command-line, as the postgres user, perform the following steps.

createuser -S -D -R -P -E wikiuser (then enter the password) createdb -O wikiuser wikidb

or as superuser (default postgres) execute the following commands at the database prompt:

Beware of the phab>phab:tag/postgreSQL</>|list of known issues when running MediaWiki with PostgreSQL.

Run the installation script
Once all of the above steps are complete, you can complete the installation through a web browser by going to the index.php URL in your browser — check the instructions mentioned in <tvar|man></>.

The installation tool will prompt you to download the <tvar|ls></> file, and to save this as <tvar|ls-path> </>.

Alternatively, you can run the command-line installer or CLI: <tvar|command> </> adding the appropriate configuration parameters.

Further steps
These are optional but make your site look so much better.


 * Logo
 * favicon.ico

Keep up to date!
maillist>mail:mediawiki-announce</>|Subscribe to our release announcements mailing list.

Once installed, make sure you stay up to date with releases, and keep your server secure!

Installation assistance

 * Read the faq>Special:MyLanguage/Manual:FAQ#Installation_and_configuration</>|FAQ about installation and configuration
 * Chat with MediaWiki developers, system administrators, and users: <tvar|irc></>
 * The maillist>mail:mediawiki-l</>|mediawiki-l mailing List is the high-traffic list on which to ask for support