Centos install Parosid

來源:互聯網
上載者:User

標籤:

SELinux and Parosid


To run the VisualEditor and Parsoid on 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 22, 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 you are 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

10) 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‘ });
};
Change the yourwiki to a identifier that is unique for your Wiki. You‘ll need this key later.
Change base-url-of-your-wiki.com to the base url that the users use in the browser.
Press "ESC" followed by ":wq!" and "Enter" to save and close vim.
11) Go to /opt/
CODE: SELECT ALL
cd ..

12) 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
13) Set SELinux labels on filesystem:
CODE: SELECT ALL
chcon -Rv --type=system_u:object_r:usr_t:s0 parsoid
May check with: ls -Z
14) 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"
15)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
16) Allow Apace use 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")
17) create a systemd-daemon for Parsoid:
CODE: SELECT ALL
vi /etc/systemd/system/parsoid.service

18) 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.
19) Start the Parsoid-daemon:
CODE: SELECT ALL
systemctl start parsoid.service
If the is no error message, everything should be OK.
20) Test, if Parsoid is working: Go to a users computer and open in a browser http://base-url-of-your-wiki.com:8000/_wikitext/. (Replace base-url-of-your-wiki.com to the base url that the users use in the browser.)
You 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".
21) make sure you are at roots home directory:
CODE: SELECT ALL
cd ~

22) Download the VisualEditor:
CODE: SELECT ALL
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git

23) Download the UniversalLanguageSelector:
CODE: SELECT ALL
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/UniversalLanguageSelector.git

24) 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.
25) 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.
26) 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.
27) 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 in a slash due to Parsoid bug
// Use port 8142 if you use the Debian package
$wgVisualEditorParsoidURL = ‘http://base-url-of-your-wiki.com:8000‘;
// Interwiki prefix to pass to the Parsoid instance
// Parsoid will 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;
Change the yourwiki to a identifier that is unique for your Wiki. You must use the same identification the in step 9!
Change base-url-of-your-wiki.com to the base url that the users use in the browser.
Press "ESC" followed by ":wq!" and "Enter" to save and close vim.
28) 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 22, or Scientific Linux 7...
thomei
 

裝了幾天的wiki VisualEditor 外掛程式沒成功,百度Google找了很多資料都沒搞定,無意中發現了這篇文章,覺得很不錯,雖然還是沒成功,但是人家按這方法成功了,可能是我自己的問題。 由於文章來之不易,必須收藏下。

Centos install Parosid

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.