User:MarkJurgens/ParsoidSetupFromScratch

= A Successful attempt to install Parsoid and VE = Note: I had some help from MarkAHershberger, as part of our combined efforts to make Parsoid & VE available to the novice. 'Lower the Bar' as Mark put it. Hope it helps!

So, I don't know much, but I know I want to use Mediawiki and VE and Parsoid for my next web project. After over a year of quietly, and sometimes not so quietly watching VE take shape, I'm taking another desperate run at installing it, with little knowledge, and some coaching from documentation and kind responses from the WMF folks. I hope it actually works this time, or that some kind soul takes pity on me and helps me out.

'''Note: If these instructions seem overly simplistic, it's because I'm a virtually a beginner at back-end work. I have a Graphic/Web design degree from a decade ago, but I work on front end design, not the back end server level setup. '''Forward the Foundation! (A very geeky statement)

Steps:

1. After GabrielWicke's suggestion (trust the guy who's last name sounds like wiki), I purchased a cheap VPS from HostHatch, I have a vps running, but it just wasn't working, and I felt like I needed a fresh start, possibly trying out a different linux OS at the suggestion of Mah

2. So, I installed Fedora 20 (Logged in into my control panel for the site, chose Federa from a list of options. Easy Enough)

3. THEN, I logged into my brand spanking new server using PUTTY.

4. Then I found this page

https://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Fedora

And installed Mediawiki by typing And then: Actually, I think don't think I typed the #
 * 1) yum install mediawiki

5. THEN, I tried to see my install online, so I typed in my IP, but got a default fedora welcome page, which thankfully told me to put files in var/www/html or I wouldn't see them.

SO, I copied my mediawiki installation (which was installed into my /www directory) into the /html/wiki directory

to do this I used this handy document:

http://www.itcs.umich.edu/itcsdocs/s4148/#renamedir

and typed

6. THEN I decided I wanted to try and get parsoid running first, because I know how to install mediawiki, it's parsoid that's the problem.

So, I looked at this document: https://www.mediawiki.org/wiki/Parsoid/Setup#Get_the_code

and tried to 'get the code' for parsoid, but I realised I didn't have git installed, so I went here: http://git-scm.com/download/linux

then I typed:

Actually, I didn't type the $

And then I had git!

7. THEN I tried again to get the parsoid code but using the clone function and steps outlined here:

https://www.mediawiki.org/wiki/Parsoid/Setup#Get_the_code

I ran this: git clone https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid And then I had the code on my server.

8. THEN I installed node.js referring to my previous attempt documented here: www.mediawiki.org/wiki/User:MarkJurgens/VESetup by typing:

and node.js was installed.

9. Then I *tried to run the parsoid server and got:  Error: Cannot find module 'yargs' 

So I went here: https://www.versioneye.com/nodejs/yargs/1.3.1

and installed yargs, whatever it is, by typing:

10. Then I found my parsoid directory, which was installed in var/www/parsoid/ and ran this:

.. and I got an error, it still could not find the 'yargs' module. So..

11. So, I thought maybe the module didn't get installed, so for no reason in particular, except that I had seen it somewhere in the documentation, I typed

And 135 things got updated and verified, it was a little scary.

12. Then I remembered to look at the original documentation and setup the JS dependencies

By running this command in the Parsoid directory: npm install And a lot of text and installing happend, again, slightly scary and mostly fascinating.

13. I went to var/www/parsoid/api and copied localsettings.js.example to localsettings.js

by typing:

14. I edited localsettings.js to point to my webserver by replacing a similar line with:

15. Then I went to my parsoid/api directory, took a deep breath, and typed

and then I had a parsoid server running!!!!

16. Feeling slightly heady, I navtigated to www.mysite.com:8000, clicked on the test links and saw that Parsoid was indeed translating wiki to html and back again. :)

17. Then I killed the workers temporarily by using

Then, because I was feeling bold, I went back to my previous web server, which has Cpanel and all the easy bells and whistles and I created a new database, installed mediawiki 1.24wmf20,

Downloaded the latest snapshot of mediawiki 1.24wmf20 here: https://tools.wmflabs.org/snapshots/#!/mediawiki-core/wmf/1.24wmf20

Downloaded the Visual Editor Master here: https://www.mediawiki.org/wiki/Special:ExtensionDistributor/VisualEditor

Quietly bit my lip when 1.24 made me download my own skin here: https://www.mediawiki.org/wiki/Skin:Vector

Uploaded all that to my server, installed everything,

Changed my local settings to include:

And went back to my website, ... and VE was running.

Incredible.

18. After some testing, I noticed some weird error where VE blanked my existing page and put cached content from another page I had edited in its place. This made VE useless on that install. There were no error messages and I'll have to ask someone about it. It all happened when I tried to insert an image from Mediawiki Commons, and it gave me the image and two headers with information about that image. Odd.

19. So, I went back to my previous 1.23.3 install of Mediawiki in another directory, copied the identical settings into that wiki's localsettings.php, crossed my fingers, and ...

VE worked perfectly.

Oh my oh. It feels like a brand new day. :)

Running Parsoid 'Forever'
The next thin I noticed is that whenever I logged out of my putty terminal, the parsoid service died.

To fix this, I'm going to try and install https://github.com/nodejitsu/forever

Useful Commands Line Commands:
When the parsoid server is running, you find yourself in a blank screen, watching the messages come up as the node.js server parses your wikitext.

Killing the Parsoid process:
To get out of that screen, type   and you get "Master Shutting Down, killing workers. This just stops the parsoid servers workers completely. (I think)

Putting the Parsoid process into the background:
To get out of the process/message screen without shutting the workers down, type:  and you get

THEN type  and you get   Which I think means it's running in the background.

Note: You'll still see parsing messages popup like this:

Just hit ENTER and move on with whatever you're doing

Other things to consider (mostly for my documentation)

Security Issues:

With my low end server, I started seeing a notice every time I logged in saying that "since my last login, there were 4325 unsuccessful login attempts". This was slightly unsettling so I followed advice to change the port settings.

I did this by following a few guides on how to change the port: http://linuxlookup.com/howto/change_default_ssh_port

and changed this file   from port 22 to something else

But I couldn't do this command (step 3)

Most likely because Hosthatch uses systemd (as I discovered when reading a README file in the /etc/init.d/ directory, so I looked here: https://wiki.archlinux.org/index.php/systemd

Then I ran this:

While I was at it, I did try different things, so I also installed semanage as part of this but checking:

/usr/sbin/semanage

and then typing

And ran this command but nothing happened. Hope it didn't hurt anything. and after that, that IP from China stopped trying to get in. Yeesh.

Helpful Unix Commands
Like I said, I'm new at this:

find / -name filename where filename=what you want to find.