Manual:Running MediaWiki on Debian or Ubuntu

Jump to: navigation, search
This page is a translated version of the page Manual:Running MediaWiki on Debian or Ubuntu and the translation is 42% complete.

Outdated translations are marked like this.
Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎日本語 • ‎한국어 • ‎polski • ‎中文

インストール ガイドManual:Installation guide
FreeBSDManual:Running MediaWiki on FreeBSD
GNU/LinuxManual:Running MediaWiki on GNU/Linux
- ALT LinuxManual:Running MediaWiki on ALT Linux
- Arch LinuxManual:Running MediaWiki on Arch Linux
- DamnsmalllinuxManual:Running MediaWiki on Damnsmalllinux
- Debian or UbuntuManual:Running MediaWiki on Debian or Ubuntu
- FedoraManual:Running MediaWiki on Fedora
- GentooManual:Running MediaWiki on Gentoo Linux
- MandrivaManual:Running MediaWiki on Mandriva
- Red Hat Enterprise LinuxManual:Running MediaWiki on Red Hat Linux
- SlackwareManual:Running MediaWiki on Slackware Linux
Mac OS XManual:Running MediaWiki on Mac OS X
NetWareManual:Running MediaWiki on NetWare
SolarisManual:Running MediaWiki on Solaris
- Solaris 11 / opensolarisManual:Running MediaWiki on Solaris 11 / opensolaris
- Solaris 10Manual:Running MediaWiki on Solaris 10
WindowsManual:Running MediaWiki on Windows
- Windows Server 2016Manual:Installing MediaWiki on Windows Server 2016
スティック (USB メモリなど)Manual:Wiki on a stick
- Uniform ServerManual:Installation on Uniform Server (Windows)
- XAMPPManual:Installing MediaWiki on XAMPP
Sourceforge.netManual:Installing MediaWiki on
This page documents how to install MediaWiki using the release tarballs. If you want to use system packages, see User:Legoktm/Packages.

このページでは、Debian や Ubuntu の GNU/Linux サーバー上で MediaWiki をインストールする方法を説明します。 The instructions below refer to Debian, but unless otherwise noted also apply to Ubuntu and Raspbian.



    gksudo gedit ファイル名


    sudo nano ファイル名



Ensure Debian is up-to-date


sudo apt-get update
sudo apt-get upgrade

LAMP スタックのインストール

Ubuntu Server Edition makes LAMP (Apache, PHP, and MySQL) available for installation during the install process. During the installation step, make sure you choose to install a LAMP server. Alternately, you can install all of these packages from a standard installation using these commands:

注 注: Ubuntu 16.04.2 LTS (Xenial) and Debian Stretch include PHP 7.0, and renamed many packages from "php5" to plain "php". In addition, some PHP modules are now in separate packages (xml, mbstring).

sudo apt-get install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring

注 注: Ubuntu Trusty, Debian Jessie and Raspbian (Jessie) include PHP 5, and use "php5" in most (but not all) packages.

sudo apt-get install apache2 mysql-server php5 php5-mysql libapache2-mod-php5

Optional useful packages

These packages are not necessary but may be useful, depending on the installation:

名前 パッケージ 説明
Alternative PHP Cache php-apcu or php5-apcu Modern MediaWiki versions will automatically take advantage of this being installed for improved performance.
PHP Unicode normalization php-intl or php5-intl MediaWiki will fallback to a slower PHP implementation if not available.
ImageMagick imagemagick Image thumbnailing.
Inkscape inkscape Alternative means of SVG thumbnailing, than ImageMagick. Sometimes it will render SVGs better if originally created in Inkscape.
PHP GD library php-gd or php5-gd Alternative to ImageMagick for image thumbnailing.
PHP command-line php-cli or php5-cli Ability to run PHP commands from the command line, which is useful for debugging and running maintenance scripts.

You can install any of the above with sudo apt-get install packagename.

MediaWiki のインストール

This can be done from a browser or by

    cd Downloads
  • extract in your Web directory
tar -xvzf /pathtofile/mediawiki-*.tar.gz
sudo mkdir /var/lib/mediawiki
sudo mv mediawiki-*/* /var/lib/mediawiki


Regular setup

注 注: This step is not necessary if you were prompted to create a mysql root password during MySQL installation.

First, set up a mysql root password. Remember not to use same password for system root and mysql root. Make sure that you do the following command after a space so that bash (the command-line shell) will not add it to your command history.

 mysqladmin -u root password "enter the new password here"
警告 警告: Remember this user (root) and password because you will need them when you configure MediaWiki.

Secure setup

Consider running mysql_secure_installation .

This program enables you to improve the security of your MySQL installation in the following ways:
  • You can set a password for root accounts.
  • You can remove root accounts that are accessible from outside the local host.
  • You can remove anonymous-user accounts.
  • You can remove the test database (which by default can be accessed by all users, even anonymous users), and privileges that permit anyone to access databases with names that start with test_.


これらのステップはシンプルに経験に基づいたものです。 このステップをすべてスキップできます(もしくは後でも十分で行うことができます)

次に、設定ファイルを設定する必要があります... On Ubuntu Trusty and Debian Jessie, it is located at /etc/php5/apache2/php.ini.

On Ubuntu Xenial and Debian Stretch (PHP 7), it is located at /etc/php/7.0/apache2/php.ini.


様々なファイルがWikiにコンテンツとしてアップロードされることを想定すると、アップロード可能なファイルサイズの上限を調整しなければなりません。 このセクションの後半の半分はファイルのアップロードに関することを取り扱います。 変更

upload_max_filesize = 2M

少なくとも20Mです。 将来再びこの値を変更しなければならないことがあります。


Some PHP scripts require a lot of memory to run. To increase the maximum amount of memory a script can use, page down to about 21%, and change the following entry, if found, from

memory_limit = 8M


memory_limit = 128M

If it is already set to 128M or more, leave it as is.


Navigate your browser to http://localhost/mediawiki (for certain installations it may be http://localhost/mediawiki/config or instead) and following the procedure given.

If this gives a 404 error then this technique may work:

cd /var/www/html
sudo ln -s /var/lib/mediawiki mediawiki

MediaWikiのインストールスクリプトで"Checking environment..."を注目して下さい。 MediaWikiのインストール作業を成功させるためにこの情報によって多くの問題を解決できます。

It may complain that php extensions like mbstring and xml are missing even you have installed them. Please manually activate them by using:

 sudo phpenmod mbstring
 sudo phpenmod xml
 sudo systemctl restart apache2.service


Under Database Config, you may change the database name and DB username to new values, but you must turn on "Use superuser account", name:


giving the mysql root password you configured earlier.

The configuration process will prompt you to download a LocalSettings.php that must be saved to the parent directory of the new wiki. The configuration page will give the exact directory/filename that must be moved:

 sudo mv ~/Downloads/LocalSettings.php /var/lib/mediawiki/

And navigate your browser to http://localhost/mediawiki (or http://server_ip_address/mediawiki or http://server_ip_address/mediawiki/index.php) to see your new wiki.

やりました! 稼働しているwikiを手に入れました!!



ウィキは /var/lib/mediawiki にある LocalSettings.php ファイルで設定変更できます。 LocalSettings.phpで役に立つかもしれない詳細な情報があります。 次は一般的に役立つと思われる変更です。

LocalSettings.php を編集するには以下を使用します

gksudo gedit /var/lib/mediawiki/LocalSettings.php

or from a terminal

sudo nano /var/lib/mediawiki/LocalSettings.php


See Manual:ファイルのアップロードの設定Manual:Configuring file uploads.


See Manual:$wgLogoManual:$wgLogo.

MediaWiki 拡張機能

The current tarball for Mediawiki comes with a package of 15 or so of the most popular extensions, but there are literally hundreds more.

Instructions on how to enable extensions can be found at Manual:Extensions#Installing an extensionManual:Extensions#Installing an extension.

短縮 URL

To use /wiki/* instead of /wiki/index.php/* on Debian, follow the recommended short URL guide using '/mediawiki' as the script path instead of '/w' and placing the rewrites in /etc/apache2/conf-enabled/mediawiki.conf.