Manual:Running MediaWiki on Debian or Ubuntu/ja

このガイドはUbuntuサーバ上でMediaWikiをインストール作業を手助けするためにあります.

いくつかのPCの知識、アプリケーションのインストール方法、オペレーティングシステムや、viエディタ(vi in 10 minutesを参照)の使い方に関する知識が必要です.

When text editing is required it can be carried out on the graphical desktop by pressing Alt-F2 and typing gksudo gedit ファイル名 Alternatively, editing can be done from a terminal sudo nano ファイル名 Of course, kate could be used instead of gedit or vi instead of nano.

Ubuntu Up-To-Date
Double check that Ubuntu is up-to-date by running:

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 normal Ubuntu installation using these commands:

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

Opt. Useful Packages
These packages are not necessary but may be useful, depending on the installation: 例: sudo apt-get install php-apc php5-intl imagemagick phpmyadmin vsftpd php5-cli

Get MediaWiki
This can be done from a browser or by    cd Downloads wget https://releases.wikimedia.org/mediawiki/1.26/mediawiki-1.26.2.tar.gz
 * download the official tarball (current version here)


 * extract in your Web directory
 * Ubuntu 14+: /var/lib/mediawiki

tar -xvzf /pathtofile/mediawiki-*.tar.gz sudo mkdir /var/lib/mediawiki sudo mv mediawiki-*/* /var/lib/mediawiki


 * Ubuntu < 14: /var/www/w

tar -xvzf /pathtofile/mediawiki-*.tar.gz sudo mv mediawiki-*/* /var/www/html

Regular Setup
First, set up a mysql root password. Remember not to use same password for system root and mysql root. This will also clear your command history so that other users cannot get to your password.

mysqladmin -u root password "" history -c

Secure Setup
Consider running mysql_secure_installation .
 * from main page:

PHPを設定する
次に、設定ファイルを設定する必要があります... For Ubuntu 14.x it is at. Depending on Ubuntu version it may be located at  or

sudo nano /etc/php5/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 to memory_limit = 128M If it is already 128M or more, leave it as is.

拡張機能
PHP MySQL support has to be enabled. さらに少しページダウンをして(約48%)次の行をアンコメントして下さい extension=mysql.so

If you use the GD graphics library to do image resizing (instead of ImageMagick), also uncomment: extension=gd.so

保存してVIエディタから抜け出してApacheを再起動して下さい sudo apache2ctl restart or sudo service apache2 restart

Configure Apache

 * Edit apache.conf file at /etc/mediawiki/apache.conf

sudo nano /etc/mediawiki/apache.conf and un-comment this line: Alias /mediawiki /var/lib/mediawiki

Save and exit out of the editor. sudo nano /etc/apache2.conf or sudo nano /etc/apache2/apache2.conf according to appropriate location.
 * Verify that the Mediawiki configuration is in Apache. Edit the Apache2 configuration file

Look for this line. Add it if is not present: Include /etc/mediawiki/apache.conf sudo apache2ctl restart or sudo service apache2 restart
 * Restart Apache:

MediaWikiを設定する
Navigate your browser to http://localhost/mediawiki (for certain installations it may be http://localhost/mediawiki/config or http://wiki.hostname.com/config 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のインストール作業を成功させるためにこの情報によって多くの問題を解決できます. 設定フォームを記入して続けて下さい.

Under Database Config, you may change the database name and DB username to new values, but you must turn on "Use superuser account", name: debian-sys-maint giving the mysql root password you configured earlier.

The configuration process creates a custom LocalSettings.php that must be moved to the parent directory of the new wiki. The configuration page will give the exact directory/filename that must be moved: sudo mv /var/lib/mediawiki/config/LocalSettings.php /var/lib/mediawiki For added safety you can then remove the config subdirectory entirely: sudo rm -rf config

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を手に入れました！！

General information
wikiは/var/www/wikiで見つかるLocalSettings.phpファイルによって設定されます. LocalSettings.phpで役に立つかもしれない詳細な情報があります. 次は一般的に役立つと思われる変更です.

LocalSettings.phpを編集するために次のコマンドを入力して下さい

gksudo gedit /etc/mediawiki/LocalSettings.php or from a terminal sudo nano /etc/mediawiki/LocalSettings.php

アップロードを有効にする
デフォルトでは、Wikiは画像のアップロードを許可しません、これを変更するために は$wgEnableUploadsを見つけて値をfalseからtrueに変更して下さい.

アップロード可能なファイルタイプを指定する
$wgFileExtensions配列の範囲内で受け入れられる拡張子のリストを修正したい場合を考えます. 例えば、デフォルトではPDFファイルをアップロードできません.

$wgFileExtensionsがLocalSettings.phpに存在しない場合はファイルの最後の方( ?> の前)に追加して下さい:

In addition to the $wgFileExtensions option, the following settings may cause files to be rejected (even if $wgStrictFileExtensions = false; is set):


 * $wgFileBlacklist, a list of file extensions that are not uploadable
 * $wgMimeTypeBlacklist, a list of forbidden MIME types.

If problems are still encountered with uploads, check the includes/DefaultSettings.php file.

画像のアップロードを許可する
imagesディレクトリを書き込み可能にしなければなりません: For Ubuntu 9.04 and newer, the command is: sudo chmod a+w /var/lib/mediawiki/images For older Ubuntu: sudo chmod a+w /var/www/wiki/images

Enable thumbnails
画像のサポートが有効になっている場合、image:タグに追加される|thumbオプションは自動的にサムネイルバージョンの画像を生成します.

sudo apt-get install imagemagick
 * As mentioned above in options, the ImageMagick package must be installed:

LocalSettings.phpにおいて、次の設定内容を設置してコメントアウトしないで下さい. それらは通常"To enable image uploads"と書かれた80行の下辺りにあります:

ロゴを変更する
$wgLogo変数はデフォルトで左上コーナーに表示されるグラフィカルなロゴを指定します. $wgScriptPath変数はwikiのトップディレクトリを含みます - この場合/var/www/wikiです.

ロゴ画像は135x135ピクセルが想定されています; それよりも大きい場合、想定サイズに合うように左上コーナーに表示されます. If the logo it is oversized for a specific skin it will show from the top left corner and clip the bottom/right of the image.

The logo file can be placed anywhere, but putting it in the top-level directory of the wiki is convenient. Fortunately, the variable $wgScriptPath contains the top directory of the wiki, so simply adding the following works well:

Standard Extensions
The current installer for mediawiki comes with a package of 15 or so of the most popular extensions, but there are literally hundreds more. Go to http://www.mediawiki.org/wiki/Category:Extensions for a complete list.

A list of the other "standard" extensions included with Ubuntu can be found by just running this command: ls /etc/mediawiki-extensions/extensions-available

Standard extensions can be installed with the mwenext command sudo mwenext extensionname.php

sudo mwenext ParserFunctions.php (If this fails the standard extension package needs to be installed with sudo apt-get install mediawiki-extensions )
 * Example: installing ParserFunctions

Once enabled, it should be listed as a symbolic link in /etc/mediawiki-extensions/extensions-enabled. You should now be able to go to http://localhost/mediawiki/index.php/Special:Version and see ParserFunctions listed there as an installed extension to your mediawiki. Confirm it's functioning by putting

on a wiki page and saving.

Other Extensions
Most MediaWiki extensions that are not available in the Ubuntu package system are downloaded in tarball (tar.gz) format and installed manually by putting the files into new subdirectory under extensions. The list of extensions is available here: Category:Extensions in Wikimedia version control Confirm you have installed it properly, by going to the Special pages in your wiki (link on left side) and choosing Version. All installed extensions are listed with versions, authors, and links to their home pages. For an example, let's take the relatively simple extension called MiniDonation. This extension lets you put a &lt;donationform&gt; tag in your wiki code, and it will display a link to paypal on the page. The site for MiniDonation is here: Extension:MiniDonation
 * Download the tarball, unpack it to the "extensions" directory (on Ubuntu: "/var/lib/mediawiki/extensions")
 * Edit the "LocalSettings.php" (see above) to add a line reading
 * Example: installing MiniDonation

Download the tarball (save it to ~/Desktop), then unpack the files to the extensions directory: cd /var/lib/mediawiki/extensions sudo tar -zxvf ~/Desktop/MiniDonation Next, modify LocalSettings with the Include directive specified in the instructions sudo nano /etc/mediawiki/LocalSettings.php Finally, check http://localhost/mediawiki/index.php/Special:Version - it should now list MiniDonation there. Edit a wikipage and add a tag to it, save the page and a functional paypal button should be available.

Upgrading Extensions
The extension must be disabled using the command mwdisext ExtensionName.php before installing the files from the new version into the correct directory in /var/lib/mediawiki/extensions.
 * Standard MediaWiki extensions (such as Cite.php) included in the mediawiki-exstensions package can be upgraded to a newer version.


 * Manually installed extensions are upgraded by simply repeating the instructions, above, for installing other exstensions.

Shortened URL
To use /wiki/* instead of /wiki/index.php/* on Ubuntu, follow the recommended short URL guide using  as the script path instead of   and placing the rewrites in /etc/apache2/conf.d/mediawiki.conf.

関連項目

 * Canonical maintains a MediaWiki page with more information
 * Debian MediaWiki page
 * Ubuntuguide.org provides detailed instructions for setting up MediaWiki on Ubuntu and Kubuntu, including multiple wikis and nested subwikis.
 * Start to end Mediawiki Setup Guide at ofswiki.org, closely referencing official docs, support for multiple distros including Debian/Ubuntu, automation and a minimal style