{"id":1475,"date":"2016-10-03T11:05:06","date_gmt":"2016-10-03T09:05:06","guid":{"rendered":"http:\/\/blog.rabahi.net\/?page_id=1475"},"modified":"2016-10-19T17:59:19","modified_gmt":"2016-10-19T15:59:19","slug":"srv-mediawiki","status":"publish","type":"page","link":"https:\/\/blog.rabahi.net\/?page_id=1475","title":{"rendered":"mediawiki"},"content":{"rendered":"<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">Contents<\/p><ul class=\"toc_list\"><li><a href=\"#Installation\"><span class=\"toc_number toc_depth_1\">1<\/span> Installation<\/a><\/li><li><a href=\"#Configure_extensions\"><span class=\"toc_number toc_depth_1\">2<\/span> Configure extensions<\/a><ul><li><a href=\"#VisualEditor\"><span class=\"toc_number toc_depth_2\">2.1<\/span> VisualEditor<\/a><ul><li><a href=\"#Parsoid_installation\"><span class=\"toc_number toc_depth_3\">2.1.1<\/span> Parsoid installation<\/a><\/li><li><a href=\"#LocalSettingsphp_enable_extension\"><span class=\"toc_number toc_depth_3\">2.1.2<\/span> LocalSettings.php, enable extension<\/a><\/li><\/ul><\/li><li><a href=\"#SyntaxHighlight_GeSHi\"><span class=\"toc_number toc_depth_2\">2.2<\/span> SyntaxHighlight_GeSHi<\/a><\/li><li><a href=\"#UniversalLanguageSelector\"><span class=\"toc_number toc_depth_2\">2.3<\/span> UniversalLanguageSelector<\/a><ul><li><a href=\"#Installation-2\"><span class=\"toc_number toc_depth_3\">2.3.1<\/span> Installation<\/a><\/li><li><a href=\"#Configuration_LocalSettingsphp\"><span class=\"toc_number toc_depth_3\">2.3.2<\/span> Configuration LocalSettings.php<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/div>\n<h1><span id=\"Installation\">Installation<\/span><\/h1>\n<pre class=\"bash\" style=\"font-family:monospace;\"><ol><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\">#!\/bin\/bash<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\">##################################################<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\">#      PARAMETERS <\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\">##################################################<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #007800;\">database_name<\/span>=mediawiki<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #007800;\">database_username<\/span>=mediawiki<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #007800;\">database_password<\/span>=mediawiki<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\">##################################################<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\">#             INSTALL MEDIAWIKI<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\">##################################################<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;install prerequistes&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">dnf <span style=\"color: #660033;\">-y<\/span> <span style=\"color: #c20cb9; font-weight: bold;\">install<\/span> php-mbstring php-xml php-intl php-gd texlive php-mysqli php-xcache<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;create database <span style=\"color: #007800;\">$database_name<\/span>, user\/password <span style=\"color: #007800;\">$database_username<\/span>\/<span style=\"color: #007800;\">$database_password<\/span>&quot;<\/span>:<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">mysql <span style=\"color: #660033;\">--user<\/span>=root <span style=\"color: #660033;\">--password<\/span>=root <span style=\"color: #660033;\">-e<\/span> <span style=\"color: #ff0000;\">&quot;CREATE USER '<span style=\"color: #007800;\">$database_username<\/span>'@'localhost' IDENTIFIED BY '<span style=\"color: #007800;\">$database_password<\/span>';&quot;<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">mysql <span style=\"color: #660033;\">--user<\/span>=root <span style=\"color: #660033;\">--password<\/span>=root <span style=\"color: #660033;\">-e<\/span> <span style=\"color: #ff0000;\">&quot;CREATE DATABASE IF NOT EXISTS <span style=\"color: #007800;\">$database_name<\/span>;&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">mysql <span style=\"color: #660033;\">--user<\/span>=root <span style=\"color: #660033;\">--password<\/span>=root <span style=\"color: #660033;\">-e<\/span> <span style=\"color: #ff0000;\">&quot;use <span style=\"color: #007800;\">$database_name<\/span>; GRANT ALL PRIVILEGES ON <span style=\"color: #007800;\">$database_name<\/span>.* TO '<span style=\"color: #007800;\">$database_username<\/span>'@'localhost' WITH GRANT OPTION;&quot;<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;download mediawiki&quot;<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">cd<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>tmp<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">wget<\/span> http:<span style=\"color: #000000; font-weight: bold;\">\/\/<\/span>releases.wikimedia.org<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mediawiki<span style=\"color: #000000; font-weight: bold;\">\/<\/span><span style=\"color: #000000;\">1.26<\/span><span style=\"color: #000000; font-weight: bold;\">\/<\/span>mediawiki-1.26.4.tar.gz<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">tar<\/span> xvfz mediawiki-1.26.4.tar.gz<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">mv<\/span> mediawiki-1.26.4 <span style=\"color: #000000; font-weight: bold;\">\/<\/span>var<span style=\"color: #000000; font-weight: bold;\">\/<\/span>www<span style=\"color: #000000; font-weight: bold;\">\/<\/span>html<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mediawiki<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;restart httpd&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">systemctl restart httpd.service<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #007800;\">myip<\/span>=<span style=\"color: #000000; font-weight: bold;\">`<\/span><span style=\"color: #c20cb9; font-weight: bold;\">hostname<\/span> -I<span style=\"color: #000000; font-weight: bold;\">`<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;Now meet you here: http:\/\/<span style=\"color: #007800;\">$myip<\/span>\/mediawiki\/&quot;<\/span><\/div><\/li><\/ol><\/pre>\n<h1><span id=\"Configure_extensions\">Configure extensions<\/span><\/h1>\n<h2><span id=\"VisualEditor\">VisualEditor<\/span><\/h2>\n<p>The visualeditor extension can be found here : https:\/\/www.mediawiki.org\/wiki\/Extension:VisualEditor<\/p>\n<h3><span id=\"Parsoid_installation\">Parsoid installation<\/span><\/h3>\n<pre lang=\"bash\">\r\n# install required packages:\r\nyum -y install nodejs npm git\r\n\r\n# get parsoid:\r\ncd \/opt\r\nnpm install parsoid\r\n\r\ncat > \/opt\/node_modules\/parsoid\/localsettings.js << \"EOF\"\r\n'use strict';\r\nexports.setup = function(parsoidConfig) {\r\n  parsoidConfig.setMwApi({ uri: 'http:\/\/srv-intranet\/mediawiki\/api.php', domain: 'localhost', prefix: 'localhost'  });\r\n};\r\nEOF\r\n\r\n# open port 8000:\r\nfirewall-cmd --permanent --zone=public --add-port=8000\/tcp\r\nfirewall-cmd --reload\r\n\r\n# add parsoid service:\r\ncat > \/etc\/systemd\/system\/parsoid.service << \"EOF\"\r\n[Unit]\r\nDescription=Mediawiki Parsoid web service on node.js\r\nDocumentation=http:\/\/www.mediawiki.org\/wiki\/Parsoid\r\nWants=local-fs.target network.target\r\nAfter=local-fs.target network.target\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n\r\n[Service]\r\nType=simple\r\nUser=root\r\nGroup=root\r\nWorkingDirectory=\/opt\/node_modules\/parsoid\r\nExecStart=\/opt\/node_modules\/parsoid\/bin\/server.js\r\nKillMode=process\r\nRestart=on-success\r\nPrivateTmp=true\r\nStandardOutput=syslog\r\nEOF\r\n\r\nsystemctl enable parsoid.service\r\nsystemctl start parsoid.service\r\n\r\n<\/pre>\n<p><b>Test<\/b><br \/>\nTest, if Parsoid is working: Go to a users computer and open in a browser http:\/\/srv-intranet:8000\/_wikitext\/.<br \/>\nYou should now be able to enter some Wiki-code in the form and Parsoid should render in to a correct HTML-page after a click on \"Send data\".<br \/>\nhttps:\/\/www.centos.org\/forums\/viewtopic.php?f=47&t=53223&p=225372#p225372<\/p>\n<h3><span id=\"LocalSettingsphp_enable_extension\">LocalSettings.php, enable extension<\/span><\/h3>\n<p>In your LocalSettings.php add this :<\/p>\n<pre lang=\"php\">\r\nrequire_once \"$IP\/extensions\/VisualEditor\/VisualEditor.php\";\r\n\r\n\/\/ Enable by default for everybody\r\n$wgDefaultUserOptions['visualeditor-enable'] = 1;\r\n\r\n\/\/ Optional: Set VisualEditor as the default for anonymous users\r\n\/\/ otherwise they will have to switch to VE\r\n\/\/ $wgDefaultUserOptions['visualeditor-editor'] = \"visualeditor\";\r\n\r\n\/\/ Don't allow users to disable it\r\n$wgHiddenPrefs[] = 'visualeditor-enable';\r\n\r\n\/\/ OPTIONAL: Enable VisualEditor's experimental code features\r\n#$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;\r\n\r\n\/\/ Linking with Parsoid\r\n$wgVirtualRestConfig['modules']['parsoid'] = array(\r\n  \/\/ URL to the Parsoid instance\r\n  'url' => 'http:\/\/srv-intranet:8000',\r\n  \/\/ Parsoid \"domain\", see below (optional, must be se same as \/opt\/node_modules\/parsoid\/localsettings.js)\r\n  'domain' => 'localhost',\r\n  \/\/ Parsoid \"prefix\", see below (optional, must be se same as \/opt\/node_modules\/parsoid\/localsettings.js)\r\n  'prefix' => 'localhost'\r\n);\r\n\r\n<\/pre>\n<h2><span id=\"SyntaxHighlight_GeSHi\">SyntaxHighlight_GeSHi<\/span><\/h2>\n<p>In LocalSettings.php:<\/p>\n<pre lang=\"php\">\r\nwfLoadExtension( 'SyntaxHighlight_GeSHi' );\r\n<\/pre>\n<p>And install python-pygments :<\/p>\n<pre lang=\"bash\">\r\nyum install python-pygments\r\n<\/pre>\n<h2><span id=\"UniversalLanguageSelector\">UniversalLanguageSelector<\/span><\/h2>\n<h3><span id=\"Installation-2\">Installation<\/span><\/h3>\n<pre lang=\"bash\">\r\ncd \/var\/www\/html\/mediawiki\/extensions\r\ngit clone https:\/\/gerrit.wikimedia.org\/r\/p\/mediawiki\/extensions\/UniversalLanguageSelector.git\r\n<\/pre>\n<h3><span id=\"Configuration_LocalSettingsphp\">Configuration LocalSettings.php<\/span><\/h3>\n<pre lang=\"php\">\r\nrequire_once \"$IP\/extensions\/UniversalLanguageSelector\/UniversalLanguageSelector.php\";\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Contents1 Installation2 Configure extensions2.1 VisualEditor2.1.1 Parsoid installation2.1.2 LocalSettings.php, enable extension2.2 SyntaxHighlight_GeSHi2.3 UniversalLanguageSelector2.3.1 Installation2.3.2 Configuration LocalSettings.php Installation Configure extensions VisualEditor The visualeditor extension can be found here : https:\/\/www.mediawiki.org\/wiki\/Extension:VisualEditor Parsoid installation # install required packages: yum -y install nodejs npm git # get parsoid: cd \/opt npm install parsoid cat > \/opt\/node_modules\/parsoid\/localsettings.js \/etc\/systemd\/system\/parsoid.service &#8216;http:\/\/srv-intranet:8000&#8217;, \/\/ Parsoid [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":328,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1475","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/1475","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1475"}],"version-history":[{"count":31,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/1475\/revisions"}],"predecessor-version":[{"id":1815,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/1475\/revisions\/1815"}],"up":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/328"}],"wp:attachment":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}