Difference between revisions of "Visual Editor Install"
(Tag: Visual edit) |
(Tag: Visual edit) |
||
Line 122: | Line 122: | ||
4. Edit MediaWiki <code>LocalSettings.js</code> | 4. Edit MediaWiki <code>LocalSettings.js</code> | ||
+ | |||
+ | <nowiki>#</nowiki> Add more configuration options below. | ||
+ | |||
+ | <nowiki>#</nowiki>VisualEditor | ||
+ | |||
+ | require_once "$IP/extensions/VisualEditor/VisualEditor.php"; | ||
+ | |||
+ | // Enable by default for everybody | ||
+ | |||
+ | $wgDefaultUserOptions['visualeditor-enable'] = 1; | ||
+ | |||
+ | // Don't allow users to disable it | ||
+ | |||
+ | <nowiki>#</nowiki>$wgHiddenPrefs[] = 'visualeditor-enable'; | ||
+ | |||
+ | $wgVirtualRestConfig['modules']['parsoid'] = array( | ||
+ | |||
+ | // URL to the Parsoid instance | ||
+ | |||
+ | // Use port 8142 if you use the Debian package | ||
+ | |||
+ | 'url' => '<nowiki>http://wiki.ssdcougars.tv:8000'</nowiki>, | ||
+ | |||
+ | // Parsoid "domain", see below (optional) | ||
+ | |||
+ | 'domain' => 'wiki.ssdcougars.tv', | ||
+ | |||
+ | // Parsoid "prefix", see below (optional) | ||
+ | |||
+ | 'prefix' => 'localhost' | ||
+ | |||
+ | ); |
Revision as of 07:33, 19 August 2016
Mediawiki's Visual Editor is not included with Mediawiki. It is an external add-on that requires a LOT of work to get working.
After you have MediaWiki installed (to a users' account NOT /var/www/mediawiki
and working, do the following
- Get the Package
-
cd extensions
-
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git
-
cd VisualEditor
-
git submodule update --init
-
- Run This as Root from within the base wiki directory
curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
- Next we need to install Parsiod
-
cd /opt
-
mkdir src
-
cd src
-
clone https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid
-
cp -rv ~/parsoid /opt/
-
cd /opt/parsoid/
-
npm install
-
nano config.example.yaml
- FIND and EDIT below:
-
mwApis: # This is the only required parameter, # the URL of you MediaWiki API endpoint. uri: 'http://wiki.ssdcougars.tv/api.php' # The "domain" is used for communication with Visual Editor # and RESTBase. It defaults to the hostname portion of # the `uri` property below, but you can manually set it # to an arbitrary string. domain: 'wiki.ssdcougars.tv' # optional # To specify a proxy (or proxy headers) specific to this prefix # (which overrides defaultAPIProxyURI). Alternatively, set `proxy` # to `null` to override and force no proxying when a default proxy # has been set. #proxy: # uri: 'http://my.proxy:1234/' # headers: # optional # 'X-Forwarded-Proto': 'https'
CTL+X, Y, and rename the file to config.yaml
Next we need to add a parsoid user and group.
groupadd parsoid
useradd -gparsoid parsoid
cd /opt/
chown -Rv parsoid:parsoid parsoid
chmod -Rv u+rw,g+r,o+r parsoid
chcon -Rv --type=system_u:object_r:usr_t:s0 parsoid
Port 8000 should already be open on the hosted server, so we'll continue.
Create init.d service
cd /etc/init.d/
nano parsoid
paste the following:
#! /bin/bash # # parsoid start # # chkconfig: 345 86 14 # description: parsoid # ### BEGIN INIT INFO # Provides: $parsoid ### END INIT INFO # Source function library. . /etc/init.d/functions rc=0 # See how we were called. case "$1" in start) echo starting parsoid cd /opt/parsoid /sbin/runuser parsoid -s /bin/bash -c "nohup node /opt/parsoid/bin/server.js > /dev/null 2>&1 &" $0 status ;; stop) process=`ps -ef | grep 'node /opt/parsoid/bin/server.js'| grep -v grep | awk '{print $2}'` if [ "${process}" != '' ] then echo stopping parsoid killall -9 node fi $0 status ;; status) proc_find=`ps -ef | grep 'node /opt/parsoid/bin/server.js'| grep -v grep` if [ "${proc_find}" = '' ] then echo parsoid is not running else echo parsoid is running: ${proc_find} fi ;; restart|reload) cd "$CWD" $0 status $0 stop $0 start ;; *) echo $"Usage: $0 {start|stop|restart|reload|status}" exit 1 esac exit $rc
CTRL+X, Y, Enter
chown parsoid parsoid
chmod 0755 parsoid
/etc/init.d/parsoid start
Navigate to http://wiki.ssdcougars.tv:8000 and you should see a webpage loaded with links about Parsoid.
4. Edit MediaWiki LocalSettings.js
# Add more configuration options below.
#VisualEditor
require_once "$IP/extensions/VisualEditor/VisualEditor.php";
// Enable by default for everybody
$wgDefaultUserOptions['visualeditor-enable'] = 1;
// Don't allow users to disable it
#$wgHiddenPrefs[] = 'visualeditor-enable';
$wgVirtualRestConfig['modules']['parsoid'] = array(
// URL to the Parsoid instance
// Use port 8142 if you use the Debian package
'url' => 'http://wiki.ssdcougars.tv:8000',
// Parsoid "domain", see below (optional)
'domain' => 'wiki.ssdcougars.tv',
// Parsoid "prefix", see below (optional)
'prefix' => 'localhost'
);