Installing MediaWiki â Set Up Your First Wiki on Localhost
In this tutorial, you'll install MediaWiki on your own computer and see it running for the first time. This is Lesson 2 of our project: Build Your Own Documentation Wiki.
What You'll Build Today
By the end of this lesson, you will have:
- XAMPP running on your computer (Apache + MySQL + PHP)
- MediaWiki downloaded and installed
- A working wiki at
http://localhost/<a href="/cms/mediawiki/">MediaWiki</a> - The
LocalSettings.phpfile configured and protected
Your wiki will be empty â but it will be alive. In Lesson 3, you'll create your first page.
What You Need
- A computer running Windows, macOS, or Linux
- About 20-30 minutes
- Administrative access to install software
Why Installing Locally Matters
You could sign up for a hosted wiki service, but installing locally teaches you:
- How the pieces fit together (web server, database, PHP)
- Where configuration files live
- How to fix things when they break
- How to deploy to a real server later
Plus, it's free and works offline.
Step-by-Step: Install MediaWiki
Step 1: Install XAMPP
XAMPP is a package that gives you everything MediaWiki needs: Apache (web server), MySQL/MariaDB (database), and PHP (the programming language MediaWiki is written in).
Download XAMPP:
- Go to https://www.apachefriends.org
- Download the version for your operating system (look for the latest PHP 8.x version)
- Run the installer â accept all defaults
Start XAMPP:
- Windows: Open the XAMPP Control Panel, click "Start" next to Apache and MySQL
- macOS: Open the XAMPP app and start Apache and MySQL
- Linux: Run
sudo /opt/lampp/lampp start
After starting Apache, open your browser and go to http://localhost. You should see the XAMPP welcome page. If you see it, everything is working.
Step 2: Download MediaWiki
- Go to https://www.mediawiki.org/wiki/Download
- Click the link to download the latest stable version (it will be a
.tar.gzfile, about 50 MB) - Wait for the download to finish
Step 3: Extract MediaWiki to Your Web Server
The files need to go in your web server's document root so Apache can serve them.
- Windows: Extract to
C:\xampp\htdocs\mediawiki - macOS: Extract to
/Applications/XAMPP/htdocs/mediawiki - Linux: Extract to
/opt/lampp/htdocs/mediawiki
You can extract using any archive tool. The result should be a folder called mediawiki containing files like index.php, api.php, and folders like skins/, extensions/.
Alternative: You can use the command line if you prefer. On Linux or macOS:
cd /opt/lampp/htdocs
wget https://releases.wikimedia.org/mediawiki/1.42/mediawiki-1.42.1.tar.gz
tar -xvzf mediawiki-1.42.1.tar.gz
mv mediawiki-1.42.1 mediawiki
Step 4: Run the Web Installer
- Open your browser and go to:
http://localhost/mediawiki - You'll see a welcome page. Click the "set up this wiki" link
- You're now in the MediaWiki web installer
The installer asks several questions. Here's what to enter:
Wiki language: Choose your language (English is the default)
Database type: Leave as MySQL (or MariaDB)
Database host: Leave as localhost
Database name: Enter mediawiki
Database username: Enter root
Database password: Leave blank (XAMPP's default)
The root user with no password is only safe because this is on your local computer. Never use these settings on a public server. We'll cover security in Lesson 7.
Database table prefix: Leave blank
Wiki name: Enter My Documentation Wiki (you can change this later)
Your name: Enter your name or username
Password: Create an administrator password for your wiki account
Email: Your email address (optional but useful)
User rights profile: Choose "Create a wiki for use by a single person (private wiki)" â this gives you full control. Later you can change it.
License: Choose Creative Commons Attribution (or whichever you prefer)
Install: Click the "Continue" button
The installer will create the database tables and configuration. This takes about 30 seconds.
Step 5: Download and Protect LocalSettings.php
When the installer finishes, you'll see a page with a download link for LocalSettings.php. This file contains your wiki's entire configuration â including database credentials.
- Click the download link â it will download a file called
LocalSettings.php - Move this file into your
mediawikifolder (the same folder whereindex.phplives)
Windows: Move to C:\xampp\htdocs\mediawiki\
Linux: Move to /opt/lampp/htdocs/mediawiki/
- Protect this file. It contains your database password:
# Linux/macOS
chmod 600 /opt/lampp/htdocs/mediawiki/LocalSettings.php
# Windows: Right-click the file â Properties â Security â
# Make sure only your user account can read it
Without LocalSettings.php, your wiki won't work. If someone steals this file, they have access to your database. Keep it safe and never commit it to Git.
Step 6: Visit Your Wiki
Now go to http://localhost/mediawiki again.
You should see your wiki's Main Page â it will say "My Documentation Wiki" at the top and show a welcome message. Your wiki is alive!
Click around:
- Main Page: The default welcome page
- Special pages: A list of administrative tools (link in the sidebar)
- Log in: Sign in with the admin account you created during installation
What You Learned
- XAMPP gives you Apache + MySQL + PHP in one package
- MediaWiki files go in your web server's document root
- The web installer creates the database and generates
LocalSettings.php LocalSettings.phpis the brain of your wiki â protect it- Your wiki is now running at
http://localhost/mediawiki
In the next lesson, you'll customize your wiki's Main Page and learn the basics of wiki markup.
Common Errors
| Error | Why It Happens | How to Fix |
|---|---|---|
| "Error connecting to database" | MySQL isn't running | Open XAMPP Control Panel and start MySQL. Wait 10 seconds and refresh. |
| "404 Not Found" when visiting localhost/mediawiki | Files are in the wrong folder | Make sure the mediawiki folder with index.php is inside htdocs. Check the path. |
| "LocalSettings.php not found" | You forgot to download or move the file | The installer generates this file at the end. Download it and place it in the mediawiki folder. |
| White page (blank screen) | PHP error or missing extension | Check the XAMPP PHP error log. Common fix: enable php_mbstring in php.ini. |
| "The file is a corrupted zip" | Corrupted download | Delete and re-download MediaWiki. Try a different browser. |
| "Cannot modify header information" error | Whitespace in LocalSettings.php | Open LocalSettings.php and make sure there are NO blank lines or spaces before <?php or after ?>. |
FAQ
Can I install MediaWiki without XAMPP?
Yes, but it's harder. You need a web server (Apache or Nginx), PHP 7.4+, and MySQL/MariaDB installed individually. XAMPP bundles them all and is the easiest way for beginners.
I'm on macOS. Can I use MAMP instead of XAMPP?
Yes, MAMP works the same way. The htdocs folder is at /Applications/MAMP/htdocs/. Use MAMP's MySQL port (often 8889) instead of the default 3306.
I already have a web server running. Can I use that?
Yes. Just make sure it meets the requirements: PHP 7.4.3+ with the following extensions: mbstring, xml, intl, json, fileinfo, gd. The installer will tell you if something is missing.
Do I need a domain name?
No. Localhost is fine for learning. When you're ready to put your wiki online, you'll need a domain and web hosting. That's a separate topic.
How do I know if PHP has the right extensions?
Create a file called info.php in your htdocs folder with this content: <?php phpinfo(); ?>. Visit http://localhost/info.php in your browser. Look for the extensions listed above.
What's Next
Your wiki is installed and running. Now let's give it some content.
Continue to Lesson 3: Your First Wiki Page â Creating Content â you'll edit the Main Page, learn wiki markup, and create your first real content.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro