架设mediawiki服务器续--安装VisualEditor编辑器

原创
2017/08/15 16:45
阅读数 1.5K

1、安装nodejs

wget https://nodejs.org/dist/v6.11.1/node-v6.11.1.tar.gz
tar xvf node-v6.11.1.tar.gz
yum install gcc-c++ -y
cd node-v6.11.1
./configure
make
make install
[root@localhost node-v6.11.1]# node -v
v6.11.1
[root@localhost node-v6.11.1]# npm -v
3.10.10
yum install -y policycoreutils-python
npm install -g cnpm --registry=https://registry.npm.taobao.org

2、安装parsoid

cd /opt
git clone https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid
cd parsoid/
cnpm install

2.1、安装parsoid服务

touch /opt/parsoid/parsoid.env

cat /opt/parsoid/parsoid.env
PORT=8000
NODE_PATH=/opt/parsoid/node_modules

touch /usr/lib/systemd/system/parsoid.service
cat /usr/lib/systemd/system/parsoid.service
[Unit]
Description=Mediawiki Parsoid web service on node.js
Documentation=http://www.mediawiki.org/wiki/Parsoid
Wants=local-fs.target network.target
After=local-fs.target network.target

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
User=nobody
Group=nobody
WorkingDirectory=/opt/parsoid
EnvironmentFile=-/opt/parsoid/parsoid.env
ExecStart=/usr/local/bin/node /opt/parsoid/bin/server.js
KillMode=process
Restart=on-success
PrivateTmp=true
StandardOutput=syslog

systemctl start parsoid.service
systemctl status parsoid.service
● parsoid.service - Mediawiki Parsoid web service on node.js
   Loaded: loaded (/usr/lib/systemd/system/parsoid.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2017-08-14 05:23:45 EDT; 6s ago
     Docs: http://www.mediawiki.org/wiki/Parsoid
 Main PID: 69022 (node)
   CGroup: /system.slice/parsoid.service
           ├─69022 /usr/local/bin/node /opt/parsoid/bin/server.js
           └─69032 /usr/local/bin/node /opt/parsoid/node_modules/_service-runner@2.3.0@service-runner/service-runner.js

systemctl enable parsoid.service

3、安装VisualEditor

cd extensions
git clone -b REL1_29 https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git
cd VisualEditor
git submodule update --init

4、修改LocalSettings.php

wfLoadExtension( 'VisualEditor' );

// Enable by default for everybody
$wgDefaultUserOptions['visualeditor-enable'] = 1;

// Optional: Set VisualEditor as the default for anonymous users
// otherwise they will have to switch to VE
// $wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";

// Don't allow users to disable it
$wgHiddenPrefs[] = 'visualeditor-enable';

// OPTIONAL: Enable VisualEditor's experimental code features
#$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;

5、效果

编辑器使用参考连接:https://www.mediawiki.org/wiki/Help:VisualEditor/User_guide/zh

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部