Skip to content

Instantly share code, notes, and snippets.

@amirulasyraf88
Created September 17, 2015 11:53
Show Gist options
  • Save amirulasyraf88/ae75959a5e424cecda90 to your computer and use it in GitHub Desktop.
Save amirulasyraf88/ae75959a5e424cecda90 to your computer and use it in GitHub Desktop.
'''MediaWiki has been successfully installed.'''
[[File:8.png]]
==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 prerequisites or [https://www.mediawiki.org/wiki/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. Most users who wish to use wiki software may benefit from using a [http://wikiindex.org/Category:Free_MediaWiki_wiki_farms free MediaWiki host] or via a [https://www.mediawiki.org/wiki/Software_bundles software bundles.]
Note Note: For troubleshooting information, see [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Errors_and_Symptoms#Installation_Errors Special:MyLanguage/Manual:Errors and Symptoms#Installation Errors.]
<dl><strong>Contents</strong> [https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki# hide] </dl>
<dl>[https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#Download_MediaWiki_software 1 Download MediaWiki software]</dl>
<ol><dl>[https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#For_developers 1.1 For developers]</dl></ol>
<dl>[https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#Uploaded_files 2 Uploaded files]</dl>
<dl>[https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#Create_a_database 3 Create a database]</dl>
<ol><dl>[https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#SQLite 3.1 SQLite]</dl></ol>
<ol><dl>[https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#MySQL 3.2 MySQL]</dl></ol>
<ul><ol><dl>[https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#Unix.2FLinux_installation 3.2.1 Unix/Linux installation]</dl></ol></ul>
<ol><ol><dl>[https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#Windows_installation 3.2.2 Windows installation]</dl></ol></ol>
<ol><ol><dl>[https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#Installation_continued 3.2.3 Installation continued]</dl></ol></ol>
<ol><dl>[https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#PostgreSQL 3.3 PostgreSQL]</dl></ol>
<dl>[https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#Run_the_installation_script 4 Run the installation script]</dl>
<dl>[https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#Keep_up_to_date.21 5 Keep up to date!]</dl>
<dl>[https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#Installation_assistance 6 Installation assistance]</dl>
<dl>[https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#See_also 7 See also]</dl>
<strong>Download MediaWiki software</strong>
You can download a release version of MediaWiki from the [https://www.mediawiki.org/wiki/Special:MyLanguage/Download official download page:] generally, if you're using a production environment, you want to be running the stable release.
To download MediaWiki 1.25.2, which is the latest stable release version, to a *nix machine you can use the following command:
<code>wget https://releases.wikimedia.org/mediawiki/1.25/mediawiki-1.25.2.tar.gz</code>
<ul>Alternatively, using [https://en.wikipedia.org/wiki/cURL cURL]:</ul>
<code>curl -O https://releases.wikimedia.org/mediawiki/1.25/mediawiki-1.25.2.tar.gz</code>
The downloaded files are in .tar.gz format, so 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 [http://www.7-zip.org/ 7-Zip] (free), [http://www.winzip.com/ WinZip], [http://www.rarlabs.com/ WinRAR] or [http://www.izarc.org/ IZArc] (free) on Windows. On Linux and Mac OS X, you can untar the file using this command:
<code>tar xvzf mediawiki-*.tar.gz</code>
<strong>NOTE:</strong> If you untar the archive as root, you should probably change the ownership afterwards with chown, otherwise the files will end up owned as user # 1000, which may or may not be what you want.
<strong>For developers</strong>
Developers on the other hand should probably [https://www.mediawiki.org/wiki/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 [https://www.mediawiki.org/wiki/Composer Composer.]
<strong>Uploaded files</strong>
If you have not already uploaded the files to your web server, do so now.
<strong>Make sure the "Change file names to lowercase" option for upload is disabled.</strong>
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 [http://filezilla.sourceforge.net/ FileZilla] (Open Source Software, Windows, OSX and Linux) or [http://cyberduck.ch/ Cyberduck] (OSX).
If you installed Apache, the correct directory is specified in your <code>httpd.conf</code> file (it's typically <code><apache-folder>/htdocs</code>). Note: This changes in Ubuntu 14.04 with [http://nixmash.com/linux/changes-that-will-affect-you-in-apache-2-4-7/ Apache 2.4.7] where the primary config file for Apache server settings and directories is <code>/etc/apache2/apache2.conf</code>.
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 [https://en.wikipedia.org/wiki/Symbolic_link 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 <code>http://localhost</code> for example, renaming to <code>/w/</code> directory would mean you would access your wiki at <code>http://localhost/w/index.php</code>. <strong>Do not use <code>/wiki/</code> if you want to use it as a </strong>[https://www.mediawiki.org/wiki/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 <strong>referred</strong> as <code><MediaWiki-folder></code>.
<strong>Create a database</strong>
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 [https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki#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, MySQL or PostgreSQL to store the actual contents of your wiki.
<strong>SQLite</strong>
MediaWiki supports SQLite since version 1.13, however at least 1.16 is highly recommended. SQLite is a stand-alone database library that stores the database contents in a single file. If PHP has the <code>pdo-sqlite</code> 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.
<strong>MySQL</strong>
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 [https://en.wikipedia.org/wiki/PhpMyAdmin PhpMyAdmin], which are often available from shared hosts, or you may be able to use [https://en.wikipedia.org/wiki/Secure_Shell 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.
==<strong>Unix/Linux installation</strong>==
1. Download and install [http://dev.mysql.com/downloads/mysql MySQL] - MediaWiki supports version 5.0.2 or later. MySQL typically installs in <code>/usr/local/mysql</code>. (If you use your Linux distribution's package manager to install MySQL, the following commands may be in some other directory; try typing them without the path prefix <code>/usr/local/mysql/bin/</code> .)
2. Check and see if the database server is running; for example, run <code>/usr/local/mysql/bin/mysqladmin</code> status. If it is not, run <code>mysqld_safe> to start it: <code>sudo /usr/local/mysql/bin/mysqld_safe</code> &.
Another way to initially start the MySQL server is to run the configure script available at the root of the installation. It creates the initial tables and automatically starts the mysql daemon
3. Set a password for the "root" account on your database server. /usr/local/mysql/bin/mysqladmin -u root password yourpassword
4. Run the MySQL command-line client: <code>/usr/local/mysql/bin/mysql -u root -p</code>
This will prompt for the "root" database password you just set, then connect to the MySQL server. Now, continue with the SQL commands below.
Consult the [http://meta.wikimedia.org/wiki/Help:Contents User's Guide] for information on using the wiki software.
== Getting started ==
* [http://www.mediawiki.org/wiki/Manual:Configuration_settings Configuration settings list]
* [http://www.mediawiki.org/wiki/Manual:FAQ MediaWiki FAQ]
* [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce MediaWiki release mailing list]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment