SELinux and Parosid
To run the Visualeditor and parsoid in a centos7-server, you need to do the following.
The requirement is a working MediaWiki (min. v1.25.x) Setup. (Crate a LAMP setup on CentOS 7, RHEL 7, Fedora, or scientific Linux 7)
1) become root:
-
Code:select All
-
su -
Enter the root password
2) Install node. js, NPM, Vim, Git and the SELinux policy Python utilities:
-
Code:select All
-
yum install nodejs npm vim-enhanced git policycoreutils-python
Confirm with "Y" if asked
4) Make sure is at Roots home directory:
-
Code:select All
-
cd ~
5) Download The latest parsoid form the Git:
-
Code:select All
-
git clone https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid
6) Copy the paroid to/opt:
-
Code:select All
-
cp -rv ~/parsoid /opt/
7) Go To/opt/parsoid/
-
Code:select All
-
cd /opt/parsoid/
8) Install parsoid in node. JS:
-
Code:select All
-
npm install
9) Create the file/opt/parsoid/api/localsettings.js:
-
Code:select All
-
vim /opt/parsoid/api/localsettings.js
Press the "Insert" key and copy the following settings:
-
Code:select All
-
‘use strict‘;
exports.setup = function(parsoidConfig) {
parsoidConfig.setMwApi(‘yourwiki‘, { uri: ‘http://base-url-of-your-wiki.com/api.php‘ });
};
The change of the Yourwiki to a identifier this is a unique for your Wiki. You'll need this key later.
Change base-url-of-your-wiki.com to the base URL, the the users use in the browser.
Press "ESC" followed by ": wq!" and "Enter" to save and close vim.
One) Go to/opt/
-
Code:select All
-
cd ..
) Set File system rights:
-
Code:select All
-
chown -Rv root:root parsoid
...
chmod -Rv u+rw,g+r,o+r parsoid
...
May check With:ls-l
Set SELinux Labels on filesystem:
-
Code:select All
-
chcon -Rv --type=system_u:object_r:usr_t:s0 parsoid
May check With:ls-z
Open Port 8000 in the firewall:
-
Code:select All
-
firewall-cmd --permanent --zone=public --add-port=8000/tcp
firewall-cmd --reload
May check With:firewall-cmd--list-all | grep "Ports"
Allow Apache to use port 8000:
-
Code:select All
-
semanage port -m -t http_port_t -p tcp 8000
May check With:semanage port-l | grep http_port_t
Allow apace use of the network to contact Parsoid:
-
Code:select All
-
setsebool httpd_can_network_connect 0
My Check With:getsebool httpd_can_network_connect (should be "off")
() Create a systemd-daemon for parsoid:
-
Code:select All
-
vi /etc/systemd/system/parsoid.service
Press the "Insert" key and copy the following settings:
-
Code:select All
-
[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=root
Group=root
WorkingDirectory=/opt/parsoid
# EnvironmentFile=-/etc/parsoid/parsoid.env
ExecStart=/usr/bin/node /opt/parsoid/api/server.js
KillMode=process
Restart=on-success
PrivateTmp=true
StandardOutput=syslog
Press "ESC" followed by ": wq!" and "Enter" to save and close vim.
Start the Parsoid-daemon:
-
Code:select All
-
systemctl start parsoid.service
If the is no error message, everything should are OK.
Test, if Parsoid is Working:go to a users computer and open in a browser http://base-url-of-your-wiki.com:8000/_wikit ext/. (Replace base-url-of-your-wiki.com to the base URL, the the users use in the browser.)
You should now is able to enter some wiki-code in the form and parsoid should render in to a correct html-page after a CLI CK on "Send data".
Make sure your is at Roots home directory:
-
Code:select All
-
cd ~
Download the Visualeditor:
-
Code:select All
-
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git
Download the Universallanguageselector:
-
Code:select All
-
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/UniversalLanguageSelector.git
Copy the Visualeditor to the extensions directory of your MediaWiki:
-
Code:select All
-
cp -rV VisualEditor /var/www/your-mediawiki-installation/extensions/
Replace media/var/www/your-mediawiki-installation with the real path.
Copy the Universallanguageselector to the extensions directory of your MediaWiki:
-
Code:select All
-
cp -rV UniversalLanguageSelector /var/www/your-mediawiki-installation/extensions/
Replace media/var/www/your-mediawiki-installation with the real path.
Edit the Settings of your MediaWiki:
-
Code:select All
-
vim /var/www/your-mediawiki-installation/LocalSettings.php
Replace media/var/www/your-mediawiki-installation with the real path.
Go to the end of the file and enter:
-
-
Code:select All
-
# Universallanguageselector
Require_once "$IP/extensions/universallanguageselector/universallanguageselector.php";
#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 ';
Optional:enable Visualeditor ' s experimental Code features
# $wgDefaultUserOptions [' visualeditor-enable-experimental '] = 1;
URL to the Parsoid instance
Must not end of a slash due to parsoid bug
Use port 8142 If your use of the Debian package
$wgVisualEditorParsoidURL = ' http://base-url-of-your-wiki.com:8000 ';
interwiki prefix to pass to the Parsoid instance
Parsoid'll be called as $url/$prefix/$pagename
$wgVisualEditorParsoidPrefix = ' Yourwiki ';
# Namespces for VE
$wgVisualEditorNamespaces = Array_merge (
$wgContentNamespaces,
Array (*)
);
# Timeout for HTTP requests to parsoid in seconds
$wgVisualEditorParsoidTimeout = 200;
The change of the Yourwiki to a identifier this is a unique for your Wiki. You must use the same identification the Step 9!
Change base-url-of-your-wiki.com to the base URL, the the users use in the browser.
Press "ESC" followed by ": wq!" and "Enter" to save and close vim.
Enable the Parsoid-daemon to start on boot time:
-
Code:select All
-
systemctl enable parsoid.service
Should answer with: "Ln-s '/etc/systemd/system/parsoid.service"/etc/systemd/system/multi-user.target.wants/ Parsoid.service ' "
That ' s it!
It should work on CentOS 7, RHEL 7, Fedora, or scientific Linux 7 ...
-
Thomei
Installed a few days of wiki visualeditor plug-in did not succeed, Baidu Google found a lot of information has not been done, inadvertently found this post, feel very good, although still not successful, but others according to this method success, may be my own problem. Because the article is hard to come by, it must be collected.
Centos Install Parosid