Manual:Running MediaWiki on Debian or Ubuntu/ko

이 페이지는 우분투에 미디어위키를 어떻게 설치하는지 설명하는 페이지입니다.

이 설치 과정에는 터미널에서 명령 실행(예: 응용 프로그램 설치)이나 텍스트 편집기 (GUI: gedit, kate; TEXT: nano, emacs, vi)사용에 대한 지식이 필요합니다.

텍스트 편집이 필요한 경우에는 GUI 환경에서 Alt-F2를 누른 후 다음과 같이 입력합니다. gksudo gedit 파일명 또는 터미널에서 편집이 가능합니다. sudo nano 파일명 물론, gedit대신 kate를 사용하거나 nano대신 vi 를 사용 해도 됩니다.

우분투 업데이트
아래의 두 명령어를 사용하여 우분투의 최신 버전 여부를 확인합니다.

sudo apt-get update sudo apt-get upgrade

LAMP스택 설치
우분투 서버에디션은 설치 과정중 LAMP (Apache, PHP, and MySQL)의 설치를 가능하게 합니다. 설치 과정중, 반드시 LAMP의 설치를 고르세요. 또는,이 명령어를 사용하여 일반 우분투에서 이러한 모든 패키지를 설치할 수 있습니다.

for Ubuntu with php7.0

sudo apt-get install apache2 mysql-server php7.0 php7.0-mysql libapache2-mod-php7.0 php7.0-xml for Ubuntu with php5

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

선택사항. 유용한 패키지들
이 패키지들은 필수는 아니나 설치에 따라 유용할 수 있습니다. 예시: sudo apt-get install php-apc php5-intl imagemagick phpmyadmin vsftpd php5-cli

미디어위키 설치
다운로드는 브라우저를 이용 하거나, 아래의 명령어를 이용할 수 있습니다. cd Downloads wget https://releases.wikimedia.org/mediawiki/1.26/mediawiki-1.26.3.tar.gz
 * 다운로드 공식 타르볼 (현재 버전은 이곳에서 받으세요.)


 * 당신의 웹 디렉토리에 압축을 풉니다.
 * 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/html

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

일반 설정
이 작업은 만약 당신이 MySQL 설치중 mysql 루트 암호를 생성했을 경우 필수적으로 요구되지 않습니다.

첫째, mysql의 루트 암호를 설정합니다. 시스템 루트와 mysql루트 암호를 서로 동일하게 만들지 마세요. 또한 당신의 명령 기록을 삭제하여 다른 유저들이 당신의 암호를 얻을 수 없게 합니다.

mysqladmin -u root password "" history -c

보안 설정
Consider running mysql_secure_installation .
 * from main page:

선택 사항: PHP 설정
당신의 PHP설정파일, php.ini를 수정하세요. 우분투 14.x의 경우 에 위치합니다. 우분투 버전에 따라 나  에 위치할 수 있습니다.

sudo nano /etc/php5/apache2/php.ini

최대 업로드 파일 크기
위키에 다양한 종류의 파일을 업로드하고자 한다면, 최대 파일 업로드 제한 용량을 조절해야 합니다. About one-half way down is the File Uploads section. 수정: upload_max_filesize = 2M 에서 최소 20M으로. 더 큰 업로드를 원할 경우, 나중에 다시 조정할 수 있습니다.

Memory limit
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.

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:

Configure 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

This can solve a lot of problems by specifically identifying the source of any errors. Fill out the configuration form and continue.
 * Pay close attention for "Checking environment..." in MediaWiki installation script.

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.

Done! You now have a working Wiki

General information
Mediawiki is configured by the LocalSettings.php file, usually found in. Manual:LocalSettings.php has detailed information that may be useful. The following are changes that appear to be universally helpful

To edit LocalSettings.php use

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

Enable uploads
By default, the Wiki will not permit images to be uploaded. To change this find $wgEnableUploads and change it from false to true.

Specifying uploadable file types
You may want to modify the list of accepted extensions, which is stored within the $wgFileExtensions array. For example, you will not be able to upload PDF files without making this change.

If $wgFileExtensions is not already in LocalSettings.php add it at the end (before the ?> line, if one exists in your LocalSettings.php file):

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.

Image file uploads
The images directory must be writable: 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
The   option added to an   tag will automatically generate a thumbnail version of a picture — if support has been enabled, as follows:

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

They are normally about 80 lines down in the file marked "To enable image uploads":
 * In LocalSettings.php, make sure the following settings are in place and not commented out.

Changing the logo
The $wgLogo variable specifies the graphical logo that gets displayed on the top left corner by default. However, the $wgLogo variable may not be present in LocalSettings.php by default - it must be added in manually to the bottom.

There is no standard for the size of the logo image, but 135x135 pixels will fit most skins. 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.