Manual:Running MediaWiki on Debian or Ubuntu/ru

На этой странице объясняется, как установить MediaWiki на сервер Debian или Ubuntu GNU/Linux.

Введение
Приведённые ниже инструкции относятся к Debian. Изменения для Ubuntu или Raspbian указываются отдельно.

Процедура установки требует умения работать с терминалом (например, для установки приложений) и текстовым редактором (графические: gedit, kate; текстовые: nano, emacs, vi).

Для использования текстового редактора с графической оболочкой переключитесь на грифический рабочий стол, нажав Alt-F2 и набрав

gksudo gedit gksudo gedit filename

или не переключаться в графический режим, используя команду терминала

sudo nano sudo nano filename

Конечно же, вы можете использовать другие текстовые редакторы, например, kate вместо gedit или vi вместо nano.

Убедитесь, что операционная система обновлена
Повторно проверьте, что Debian обновлен, выполнив команды в терминале:

Установка LAMP Stack
Серверная версия Ubuntu позволяет установить LAMP (Apache, PHP и MySQL) для в процессе установки. 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:

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

You can install any of the above with.

Get MediaWiki
This can be done from a browser or by
 * Download the official tarball

cd Downloads wget https://releases.wikimedia.org/mediawiki//mediawiki-.tar.gz


 * extract in your Web directory

Regular setup
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"

Secure setup
Consider running mysql_secure_installation .
 * from main page:

Optional: Configure PHP
Edit your PHP configuration file, php.ini. On Ubuntu Trusty and Debian Jessie, it is located at.

On Ubuntu Xenial and Debian Stretch (PHP 7), it is located at.

Maximum upload file size
Assuming that various files are going to be uploaded to the Wiki as content, the limit on the maximum size of an upload has to be adjusted. About one-half way down is the File Uploads section. Change: to at least 20M. You may have to adjust this again in the future if you want bigger uploads.

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 to If it is already set to 128M or more, leave it as is.

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.
 * Pay close attention for "Checking environment..." in MediaWiki installation script.

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

Fill out the configuration form and continue.

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

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 /var/lib/mediawiki/LocalSettings.php

or from a terminal

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

File uploads
See.

Changing the logo
See.

MediaWiki extensions
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.

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