Difference between pages "Install/ru/Partitioning" and "ConsoleOutput MediaWiki Extension"

From Funtoo
< Install‎ | ru(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
<noinclude>
The ConsoleOutput MediaWiki extension was created by Daniel Robbins to provide highlighting of user input for interactive terminal session blocks. To use it, surround user input with  <tt>&lt;console&gt;</tt> opening and closing tags, and put a <tt>##i##</tt> input code immediately before user input on each line. This will cause all text from the <tt>##i##</tt> point to the end of the line to be in a darker color. The rest of the text will be in a lighter grey, allowing it to be distinguished more easily from user input. Here are other sequences that can be used:
{{InstallPart|процесс разбиения диска и создания файловых систем}}
</noinclude>
=== Подготовка жесткого диска ===


В этой части  мы научимся различным способам установки Funtoo Linux -- и загрузки с -- жесткого диска.
* <tt>##b##</tt> - highlight the rest of the line in bold.
* <tt>##b## text here ##!b##</tt> - highlight the text between both markers in bold.
* <tt>##i## text here ##!i##</tt> - highlight the text between both markers in a darker color.


==== Введение ====
This extension can be further extended to add color support, as desired, and some of the CSS for color support can already be found in the code below.


В прежние времена существовал лишь один способ загрузить PC-совместимый компьютер. Все наши дектопы и сервера имели стандартный PC BIOS, все наши харды использовали MBR и были разбиты используя схему разбивки MBR.  Вот как это все было и нам это нравилось!
Here are a few examples of the ConsoleOutput extension. First this is how you might typically display {{c|ls}} output, with a particular directory highlighted:
 
Затем появились EFI и UEFI,  встроенные программы нового образца наряду со схемой разбивки GPT, поддерживающая диски размером более 2.2TБ. Неожиданно, нам стали доступны различные способы установки и загрузки Линукс систем . То, что было единым методом, стало чем-то более сложным.
 
Воспользуемся моментом и рассмотрим доступные способы конфигурации жесткого диска для загрузки Funtoo Linux. Данное Руководство рекомендует способ "по-старинке" , загрузка BIOS и использование MBR.  Данный способ работает (за исключением редких случаев) и всесторонне поддерживается. И в этом нет ничего плохого. Если Ваш жесткий диск 2TБ или меньшего размера это не является препятствием для использования всего дискового пространства.
 
Но, бывают ситуации когда метод "по-старинке"  не является оптимальным. Если Ваш жесткий диск размером более 2TБ , MBR разбивка не сможет обеспечить доступ ко всему дисковому пространству.  Это одна из причин.  Вторая причина: существуют  "PC" системы, которые более не поддерживают  BIOS загрузку  и  форсируют UEFI загрузку. Из чувства сострадания к тем, кто попал в затруднение перед выбором, это Руководство также описывает установку и загрузку UEFI систем.
 
Мы всё же рекомендуем разбивку "по-старинке". Загрузчик, который мы используем для загрузки Линукс в этом руководстве называется GRUB,  таки образом мы называем метод  как '''BIOS + GRUB (MBR)''' . Это традиционный способ установки на PC-совместимые компьютеры.
 
Если Вам необходимо использование UEFI для загрузки, мы советуем не использовать MBR вообще, ввиду того, что некоторые системы поддерживают MBR,  а некоторые нет. Вместо, мы советуем использование UEFI  для загрузки GRUB, который, затем в свою очередь загрузит Линукс. Мы называем этот  метод как '''UEFI + GRUB (GPT)'''.
 
И да, есть еще несколько способов, некоторые из них задокументированы в [[Boot Methods]] . Обычно мы рекомендуем  '''BIOS + GRUB (GPT)''' метод, но он ограничивается не столь широкой поддержкой со стороны комплектующих.
 
'''Вопрос --  какой из методов использовать?'''  Вот какой.
 
;Принцип 1 - "По-старинке":  Если Вы можете успешно загрузить System Rescue CD и видите синее меню, то Вы используете BIOS,  и скорее всего Вы можете загрузить Funtoo Linux используя BIOS. Итак,  следуйте этому способу и используйте BIOS загрузку,  кроме случаев Вам по-какой либо причине необходим UEFI, например если размер жесткого диска >2.2TБ.  В этом случае следуйте Принцип  2.
 
;Принцип 2 - "Модерн":  Если Вы можете успешно загрузить System Rescue CD и видите черно-белое меню -- поздравления,  Ваша система поддерживает UEFI загрузку. Это значит, что Вы готовы установить Funtoo Linux к загрузке с помощью UEFI.  Ваша система также может поддерживать загрузку BIOS,  но попрбуйте UEFI для начала. Вы можете "покопаться" в настройках BIOS.
 
;Какая разница между "По-старинке" и "Модерн"?:  Если Вы следуете  MBR разбивке, Ваш <code>/boot</code> раздел будет отформатирован файловой системой ext2 , и Вы будете использовать <code>fdisk</code> для создания MBR разделов.  Если Вы следуете "модерн", GPT разделам и UEFI загрузке,  Ваш <code>/boot</code> раздел будет отформатирован  в файловую систему vfat,  поскольку это единственная файловая система поддерживаемая UEFI, и Вы будете использовать <code>gdisk</code> для создания GPT разделов.  И Вы установите GRUB несколько иначе.  Вот к чему сводится различие между методами.
 
;Имейте в виду: Для установки Funtoo Linux используя метод "модерн", Вы должны загрузить System Rescue CD в UEFI режиме -- и увидеть начальное черно-белое меню. В противном случае, UEFI не активно и Вы не сможете продолжить!
 
{{Note|'''Некоторые материнские платы якобы поддерживают UEFI, но на самом деле нет.''' Исследуйте . К примеру,  Award BIOS в моей Gigabyte GA-990FXA-UD7 rev 1.1 имеет возможность включить UEFI загрузку для CD/DVD. '''Этого не достаточно для обеспечения UEFI загрузки для жестких дисков и установки Funtoo Linux.''' UEFI должно поддерживать и сьемные носители (таким образом Вы сможете загрузить System Rescue CD используя  UEFI) и жесткие диски (Вы можете загрузить Funtoo Linux.) Оказывается, что более поздние ревизии этой платы (rev 3.0) имеют новую версию BIOS который полностью поддерживает UEFI.  Это приводит к третьему принципу -- знайте Ваши комплектующие.}}
 
==== Метод (BIOS/MBR) "По-старинке" ====
 
{{Note|Используйте данный метод при загрузке с помощью BIOS,  и если System Rescue CD имеет начальное меню загрузки светло-голубое.  Если Вы собираетесь использовать "модерн", [[#Метод (UEFI/GPT) "Модерн"|кликните здесь в меню UEFI/GPT.]]}}
 
===== Подготовка =====
 
Прежде чем начать , неплохо бы удостовериться, что Вы используете нужный диск для разбивки.  Попробуйте эту комманду и проверьте, что <code>/dev/sda</code> тот самый диск, который Вы желаете разбить:


<console>
<console>
# ##i##fdisk -l /dev/sda
www@www-smw ~/public_html $ ##i##ls
 
COPYING  LocalSettings.php    api.php  ##b##extensions##!b##  index.php  maintenance          redirect.php    skins              thumb_handler.php5
Disk /dev/sda: 640.1 GB, 640135028736 bytes, 1250263728 sectors
CREDITS  README                api.php5  images        index.php5  mw-config            redirect.php5  tests              wiki.phtml
Units = sectors of 1 * 512 = 512 bytes
FAQ      RELEASE-NOTES-1.19    bin      img_auth.php  languages  opensearch_desc.php  redirect.phtml  thumb.php
Sector size (logical/physical): 512 bytes / 512 bytes
HISTORY  StartProfiler.sample  cache    img_auth.php5  load.php   opensearch_desc.php5 resources      thumb.php5
I/O size (minimum/optimal): 512 bytes / 512 bytes
INSTALL UPGRADE              docs      includes      load.php5   profileinfo.php      serialized      thumb_handler.php
Disk label type: gpt
www@www-smw ~/public_html $ ##i##cd extensions/
 
 
#        Start          End   Size Type            Name
  1        2048   1250263694  596.2G  Linux filesyste Linux filesystem
</console>
</console>


Теперь, рекомендуем стереть  существующие таблицы разделов  MBR или GPT,  которые могут помешать BIOS во время загрузки. Мы используем комманду <code>sgdisk</code>:
And here is how you might display a more detailed example of console output, using colors:
{{fancywarning|Это необратимый процесс, который уничтожит все разделы!  Вы предупреждены! Советуем сохранить критические данние перед этим.}}


<console>
{{console|body=
# ##i##sgdisk --zap-all /dev/sda
# ##i##bluetoothctl
 
[##g##NEW##!g##] Controller 00:02:72:C9:62:65 antec [default]
Creating new GPT entries.
##bl##[bluetooth]##!bl### ##i##power on
GPT data structures destroyed! You may now partition the disk using fdisk or
Changing power on succeeded
other utilities.
##bl##[bluetooth]##!bl### ##i##agent on
</console>
Agent registered
 
##bl##[bluetooth]##!bl### ##i##scan on
Не стоит беспокоится об этом сообщении, так как комманда успешно выполнена:
Discovery started
 
##bl##[bluetooth]##!bl### ##i##devices
<console>
Device 00:1F:20:3D:1E:75 Logitech K760
***************************************************************
##bl##[bluetooth]##!bl### ##i##pair 00:1F:20:3D:1E:75
Found invalid GPT and valid MBR; converting MBR to GPT format
Attempting to pair with 00:1F:20:3D:1E:75
in memory.
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: yes
***************************************************************
##r##[agent]##!r## Passkey: 454358
</console>
##r##[agent]##!r## Passkey: ##i##4##!i##54358
 
##r##[agent]##!r## Passkey: ##i##45##!i##4358
===== Разбивка диска =====
##r##[agent]##!r## Passkey: ##i##454##!i##358
 
##r##[agent]##!r## Passkey: ##i##4543##!i##58
Теперь мы используем <code>fdisk</code> для создания таблицы разделов MBR и самих разделов:
##r##[agent]##!r## Passkey: ##i##45435##!i##8
 
##r##[agent]##!r## Passkey: ##i##454358##!i##
<console>
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Paired: yes
# ##i##fdisk /dev/sda
Pairing successful
</console>
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: no
 
##bl##[bluetooth]##!bl### ##i##connect 00:1F:20:3D:1E:75
В консоли <code>fdisk</code>, следуйте следующим шагам:
Attempting to connect to 00:1F:20:3D:1E:75
 
[##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: yes
'''Очистить таблицу разделов''':
Connection successful
 
##bl##[bluetooth]##!bl### ##i##quit
<console>
[##r##DEL##!r##] Controller 00:02:72:C9:62:65 antec [default]
Command (m for help): ##i##o ↵
#
</console>
}}
 
'''Создать раздел 1''' (boot):
 
<console>
Command (m for help): ##i##n ↵
Partition type (default p): ##i##
Partition number (1-4, default 1): ##i##
First sector: ##i##
Last sector: ##i##+128M ↵
</console>
 
'''Создать раздел 2''' (своп):
 
<console>
Command (m for help): ##i##n ↵
Partition type (default p): ##i##
Partition number (2-4, default 2): ##i##
First sector: ##i##
Last sector: ##i##+2G ↵
Command (m for help): ##i##t ↵
Partition number (1,2, default 2): ##i##
Hex code (type L to list all codes): ##i##82 ↵
</console>
 
'''Создать корневой раздел:'''
 
<console>
Command (m for help): ##i##n ↵
Partition type (default p): ##i##
Partition number (3,4, default 3): ##i##
First sector: ##i##
Last sector: ##i##
</console>
 
'''Проверить таблицу разделов:'''
 
<console>
Command (m for help): ##i##p
 
Disk /dev/sda: 298.1 GiB, 320072933376 bytes, 625142448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x82abc9a6
 
Device    Boot    Start      End    Blocks  Id System
/dev/sda1          2048    264191    131072  83 Linux
/dev/sda2        264192  4458495  2097152  82 Linux swap / Solaris
/dev/sda3        4458496 625142447 310341976  83 Linux
</console>
 
'''Записать таблицу разделов на диск:'''
 
<console>
Command (m for help): ##i##w
</console>
 
Ваша новая таблица разделов будет записана на диск.
 
{{Note|Вы завершили создание разделов! Теперь, перейдите к  [[#Создание файловых систем|Создание файловых систем]].}}
 
==== Метод (UEFI/GPT) "Модерн" ====
 
{{Note|Используйте данный метод при загрузке с помощью UEFI,  и если System Rescue CD имеет начальное меню загрузки черно-белого цвета. Если оно было светло-голубого цвета, этот метод не будет работать.}}
 
Комманда <tt>gdisk</tt> используется для создания таблицы разделов GPT .  Измените размеры в соответсвии Вашим требованиям, хотя приведенные ниже размеры будут работать для большинства пользователей. Запустите <code>gdisk</code>:
 
<console>
# ##i##gdisk
</console>
 
В консоли <tt>gdisk</tt>,  следуйте следующим шагам:
 
'''Создайте новую пустую таблицу разделов''' (Это уничтожит данные при сохранении на диск):
 
<console>
Command: ##i##o ↵
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): ##i##y ↵
</console>
 
'''Создайте раздел 1''' (загрузочный):
 
<console>
Command: ##i##n ↵
Partition Number: ##i##1 ↵
First sector: ##i##
Last sector: ##i##+500M ↵
Hex Code: ##i##
</console>
 
'''Создайте раздел 2''' (своп):
 
<console>
Command: ##i##n ↵
Partition Number: ##i##2 ↵
First sector: ##i##
Last sector: ##i##+4G ↵
Hex Code: ##i##8200 ↵
</console>
 
'''Создайте раздел 3''' (корневой):
 
<console>
Command: ##i##n ↵
Partition Number: ##i##3 ↵
First sector: ##i##
Last sector: ##i####!i## (for rest of disk)
Hex Code: ##i##
</console>
 
По пути Вы можете набрать "<tt>p</tt>" и нажать Enter для просмотра текущей таблицы разделов. Если Вы допустили ошибку,  наберите "<tt>d</tt>" для удаления созданного раздела. Если Вы удовлетворены Вашей схемой разделов, наберите "<tt>w</tt>" для записи таблицы на диск:
 
'''Записать таблицу разделов на диск''':
 
<console>
Command: ##i##w ↵
Do you want to proceed? (Y/N): ##i##Y ↵
</console>
 
Таблица разделов будет записана на диск и <tt>gdisk</tt> завершит работу.
 
Теперь  GPT/GUID разделы созданы, и будут показаны как ''блочные утройства'' в Linux:
 
* <tt>/dev/sda1</tt>, будет использоваться  для <tt>/boot</tt>, загрузочный раздел
* <tt>/dev/sda2</tt>, будет использоваться как своп , и
* <tt>/dev/sda3</tt>, корневой раздел.
 
==== Создание файловых систем ====
 
{{Note|Данная часть рассматривает как BIOS ''так и'' UEFI установки. Не пропускайте раздел!}}
 
Before your newly-created partitions can be used, the block devices need to be initialized with filesystem ''metadata''. This process is known as ''creating a filesystem'' on the block devices. After filesystems are created on the block devices, they can be mounted and used to store files.
 
Let's keep this simple. Are you using old-school MBR partitions? If so, let's create an ext2 filesystem on /dev/sda1:
 
<console>
# ##i##mkfs.ext2 /dev/sda1
</console>
 
If you're using new-school GPT partitions for UEFI, you'll want to create a vfat filesystem on /dev/sda1, because this is what UEFI is able to read:
 
<console>
# ##i##mkfs.vfat -F 32 /dev/sda1
</console>
 
Now, let's create a swap partition. This partition will be used as disk-based virtual memory for your Funtoo Linux system.
 
You will not create a filesystem on your swap partition, since it is not used to store files. But it is necessary to initialize it using the <code>mkswap</code> command. Then we'll run the <code>swapon</code> command to make your newly-initialized swap space immediately active within the live CD environment, in case it is needed during the rest of the install process:


<console>
To install, make the following modifications to your skin:
# ##i##mkswap /dev/sda2
# ##i##swapon /dev/sda2
</console>


Now, we need to create a root filesystem. This is where Funtoo Linux will live. We generally recommend ext4 or XFS root filesystems. If you're not sure, choose ext4. Here's how to create a root ext4 filesystem:
<syntaxhighlight lang="css">
--- mediawiki-1.19.1/skins/vector/screen.css    2012-06-13 18:22:39.000000000 +0000
+++ public_html/skins/vector/screen.css 2012-08-27 04:34:47.507912892 +0000
@@ -683,10 +683,47 @@
        list-style-image: url(images/bullet-icon.png);
}
-pre {
-      line-height: 1.3em;
+/* ConsoleOutput.php start */
+
+.shell, pre, code, tt, div.mw-geshi {
+        font-size: 12px;
+        font-family: Consolas, 'andale mono','lucida console', monospace;
+}
+
+.shell, pre, div.mw-geshi {
+        background-color: #F8F8FF;
+        line-height: 15px;
+        padding: 10px;
+        border: none;
+        border-top: 2px solid #C6C9E0;
+        border-bottom: 2px solid #C6C9E0;
+        margin: 0;
+        overflow-x: auto;
+        overflow-y: hidden;
+}
+
+.code {
+        color: #666;
+}
+
+.code_input {
+        color: #000;
}
+.code_red {
+        color: #f00;
+}
+
+.code_blue {
+        color: #00f;
+}
+
+.shell_green {
+        color: #080;
+}
+
+/* ConsoleOutput.php end */
+
/* Site Notice (includes notices from CentralNotice extension) */
#siteNotice {
        font-size: 0.8em;
</syntaxhighlight>


<console>
Then install the following code in your <tt>extensions</tt> directory and include it with a <tt>require_once( "$IP/extensions/ConsoleOutput.php" );</tt> in <tt>LocalSettings.php</tt>:
# ##i##mkfs.ext4 /dev/sda3
</console>


...and here's how to create an XFS root filesystem, if you choose to use XFS:
<syntaxhighlight lang="php">
<?php
$wgExtensionCredits['validextensionclass'][] = array(
    'name' => 'ConsoleOutput',
    'author' => 'Daniel Robbins',
    'url' => 'https://github.com/danielrobbins/mediawiki-consoleoutput',
    'description' => 'This extension allows you to display colorized console output in mediawiki'
);


<console>
if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
# ##i##mkfs.xfs /dev/sda3
        $wgHooks['ParserFirstCallInit'][] = 'consoleOutputSetup';
</console>
} else {
        $wgExtensionFunctions[] = 'consoleOutputSetup';
}


Your filesystems (and swap) have all now been initialized, so that that can be mounted (attached to your existing directory heirarchy) and used to store files. We are ready to begin installing Funtoo Linux on these brand-new filesystems.
function consoleOutputSetup( $data )
{
    global $wgParser;
    $wgParser->setHook('console', 'consoleRender');
    return true;
}


{{fancywarning|1=
function consoleRender($input, $args, $parser)
When deploying an OpenVZ host, please use ext4 exclusively. The Parallels development team tests extensively with ext4, and modern versions of <code>openvz-rhel6-stable</code> are '''not''' compatible with XFS, and you may experience kernel bugs.
{
}}
    if (count($args))
    {
        return "<strong class='error'>" .
              "ConsoleOutput: arguments not supported" .
              "</strong>";
    }


==== Mounting filesystems ====
    # Display < and > as literals, so escape them:


Mount the newly-created filesystems as follows, creating <code>/mnt/funtoo</code> as the installation mount point:
    $input = preg_replace('/>/','&gt;', $input);
    $input = preg_replace('/</','&lt;', $input);


<console>
    # http://www.perlmonks.org/?node_id=518444
# ##i##mkdir /mnt/funtoo
    # See "Matching a pattern that doesn't include another pattern:
# ##i##mount /dev/sda3 /mnt/funtoo
# ##i##mkdir /mnt/funtoo/boot
# ##i##mount /dev/sda1 /mnt/funtoo/boot
</console>
 
Optionally, if you have a separate filesystem for <code>/home</code> or anything else:


<console>
    $input = preg_replace('/##i##((?:(?!##!i##).)*)##!i##/','<span class="code_input">$1</span>', $input);
# ##i##mkdir /mnt/funtoo/home
    $input = preg_replace('/##i##(.*)/','<span class="code_input">$1</span>', $input);
# ##i##mount /dev/sda4 /mnt/funtoo/home
    $input = preg_replace('/##b##((?:(?!##!b##).)*)##!b##/','<b>$1</b>', $input);
</console>
    $input = preg_replace('/##b##(.*)/','<b>$1</b>', $input);
    return "<pre class=\"code\">" . $input . "&lt;/pre>";
}
?>
</syntaxhighlight>


If you have <code>/tmp</code> or <code>/var/tmp</code> on a separate filesystem, be sure to change the permissions of the mount point to be globally-writeable after mounting, as follows:
[[Category:MediaWiki Hacks]]
 
<console>
# ##i##chmod 1777 /mnt/funtoo/tmp
</console>

Revision as of 01:05, January 12, 2015

The ConsoleOutput MediaWiki extension was created by Daniel Robbins to provide highlighting of user input for interactive terminal session blocks. To use it, surround user input with <console> opening and closing tags, and put a ##i## input code immediately before user input on each line. This will cause all text from the ##i## point to the end of the line to be in a darker color. The rest of the text will be in a lighter grey, allowing it to be distinguished more easily from user input. Here are other sequences that can be used:

  • ##b## - highlight the rest of the line in bold.
  • ##b## text here ##!b## - highlight the text between both markers in bold.
  • ##i## text here ##!i## - highlight the text between both markers in a darker color.

This extension can be further extended to add color support, as desired, and some of the CSS for color support can already be found in the code below.

Here are a few examples of the ConsoleOutput extension. First this is how you might typically display ls output, with a particular directory highlighted:

www@www-smw ~/public_html $ ls
COPYING  LocalSettings.php     api.php   extensions   index.php   maintenance           redirect.php    skins              thumb_handler.php5
CREDITS  README                api.php5  images         index.php5  mw-config             redirect.php5   tests              wiki.phtml
FAQ      RELEASE-NOTES-1.19    bin       img_auth.php   languages   opensearch_desc.php   redirect.phtml  thumb.php
HISTORY  StartProfiler.sample  cache     img_auth.php5  load.php    opensearch_desc.php5  resources       thumb.php5
INSTALL  UPGRADE               docs      includes       load.php5   profileinfo.php       serialized      thumb_handler.php
www@www-smw ~/public_html $ cd extensions/

And here is how you might display a more detailed example of console output, using colors:

root # bluetoothctl 
[NEW] Controller 00:02:72:C9:62:65 antec [default]
root ##bl##[bluetooth]##!bl### power on
Changing power on succeeded
root ##bl##[bluetooth]##!bl### agent on
Agent registered
root ##bl##[bluetooth]##!bl### scan on
Discovery started
root ##bl##[bluetooth]##!bl### devices
Device 00:1F:20:3D:1E:75 Logitech K760
root ##bl##[bluetooth]##!bl### pair 00:1F:20:3D:1E:75
Attempting to pair with 00:1F:20:3D:1E:75
[CHG] Device 00:1F:20:3D:1E:75 Connected: yes
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
[CHG] Device 00:1F:20:3D:1E:75 Paired: yes
Pairing successful
[CHG] Device 00:1F:20:3D:1E:75 Connected: no
root ##bl##[bluetooth]##!bl### connect 00:1F:20:3D:1E:75
Attempting to connect to 00:1F:20:3D:1E:75
[CHG] Device 00:1F:20:3D:1E:75 Connected: yes
Connection successful
root ##bl##[bluetooth]##!bl### quit
[DEL] Controller 00:02:72:C9:62:65 antec [default]
root #

To install, make the following modifications to your skin:

--- mediawiki-1.19.1/skins/vector/screen.css    2012-06-13 18:22:39.000000000 +0000
+++ public_html/skins/vector/screen.css 2012-08-27 04:34:47.507912892 +0000
@@ -683,10 +683,47 @@
        list-style-image: url(images/bullet-icon.png);
 }
 
-pre {
-       line-height: 1.3em;
+/* ConsoleOutput.php start */
+
+.shell, pre, code, tt, div.mw-geshi {
+        font-size: 12px;
+        font-family: Consolas, 'andale mono','lucida console', monospace;
+}
+
+.shell, pre, div.mw-geshi {
+        background-color: #F8F8FF;
+        line-height: 15px;
+        padding: 10px;
+        border: none;
+        border-top: 2px solid #C6C9E0;
+        border-bottom: 2px solid #C6C9E0;
+        margin: 0;
+        overflow-x: auto;
+        overflow-y: hidden;
+}
+
+.code {
+        color: #666;
+}
+
+.code_input {
+        color: #000;
 }
 
+.code_red {
+        color: #f00;
+}
+
+.code_blue {
+        color: #00f;
+}
+
+.shell_green {
+        color: #080;
+}
+
+/* ConsoleOutput.php end */
+
 /* Site Notice (includes notices from CentralNotice extension) */
 #siteNotice {
        font-size: 0.8em;

Then install the following code in your extensions directory and include it with a require_once( "$IP/extensions/ConsoleOutput.php" ); in LocalSettings.php:

<?php
$wgExtensionCredits['validextensionclass'][] = array(
    'name' => 'ConsoleOutput',
    'author' => 'Daniel Robbins',
    'url' => 'https://github.com/danielrobbins/mediawiki-consoleoutput',
    'description' => 'This extension allows you to display colorized console output in mediawiki'
);

if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
        $wgHooks['ParserFirstCallInit'][] = 'consoleOutputSetup';
} else {
        $wgExtensionFunctions[] = 'consoleOutputSetup';
}

function consoleOutputSetup( $data )
{
    global $wgParser;
    $wgParser->setHook('console', 'consoleRender');
    return true;
}

function consoleRender($input, $args, $parser)
{
    if (count($args))
    {
        return "<strong class='error'>" .
               "ConsoleOutput: arguments not supported" .
               "</strong>";
    }

    # Display < and > as literals, so escape them:

    $input = preg_replace('/>/','&gt;', $input);
    $input = preg_replace('/</','&lt;', $input);

    # http://www.perlmonks.org/?node_id=518444
    # See "Matching a pattern that doesn't include another pattern:

    $input = preg_replace('/##i##((?:(?!##!i##).)*)##!i##/','<span class="code_input">$1</span>', $input);
    $input = preg_replace('/##i##(.*)/','<span class="code_input">$1</span>', $input);
    $input = preg_replace('/##b##((?:(?!##!b##).)*)##!b##/','<b>$1</b>', $input);
    $input = preg_replace('/##b##(.*)/','<b>$1</b>', $input);
    return "<pre class=\"code\">" . $input . "&lt;/pre>";
}
?>