What OS should I use for spark-server?

What operating systems are being used for running the spark-server? I’ve tried installing it on both Ubuntu Server 14.0.4 and Windows 7, but one of the Node.js dependencies needed, ursa, fails to install correctly. I’m going to try Fedora next. I’m just wondering what operating systems others have used.

@brett13, I also had this issue with Windows 7, but installed ursa manually and the problem is solved. Another point it to run in Administrator account.

I have installed both in Windows 7 and Raspberry Pi and are working fine.

1 Like

@krvarma, That’s for the quick reply. I’ll try installing ursa manually in Windows 7.

I did try installing manually in Ubuntu and still got the same error (as non-manual install), so I didn’t try to manually install for Windows 7.

@brett we’ve run it on Ubuntu and other platforms, if you run into issues installing ursa, I bet googling the error codes will get you a solution

@zach I spent several fruitless hours yesterday on Google (trying to get ursa installed for Ubuntu) before posting to the forum. I’m running a stripped down version of Ubuntu Server 14.0.4 (I’ve removed many packages since I’m running it as a Virtual Machine). So, I probably removed some package that ursa needs.

Fedora 20 KDE
I threw up a VM with Fedora 20 KDE last evening. After installing git, nodejs, and npm, I then followed the Quick Install for the Spark-Server and it worked perfectly!

Windows 7 64-bit
This morning I worked on getting ursa installed for my Windows 7 machine. The install scripts all seem to be set up for a 32-bit build, but I have Node.js for 64-bit, which obviously conflicted. It was a little painful trying to get ursa to build for 64-bit, but I got it to work. I then followed the Quick Install for the Spark-Server and got my local server to run! Just in case anyone else has issues, I’ll share latter what I did.

1 Like

Thanks @brett13, good to know! If you’d be willing to boil down your learnings into a tutorial of sorts, I’d love to add it to support.spark.io

1 Like

@zach I’m working on it now :). I was planning on just posting it here. Do you have something else in mind?

Before starting, I’d like to say it is much easier to install the Spark-Server on a Linux virtual machine than Windows. But, I wasn’t satisfied with not getting it to work on Windows.

I present here how I got the Spark-Server to install for Windows 7 64-bit. (it seems installing for 32-bit is probably easier – see https://community.spark.io/t/tutorial-local-cloud-on-windows-25-july-2014/5949).
First off, I previously installed git and node.js using the 64-bit MSI installers easy found on the Internet. The node.js installer should also install npm.

The hard part about installing the Spark-Server is installing a single pesky node.js package named ursa because ursa is a native package (must be built from source since it is platform dependent). The correct MS C++ compiler must be used in order for the ursa normal install scripts to work. Getting this set up can be harder than advertised. I tried following the instructions to uninstall all old compilers, install Visual Studio C++ 2010 Express, and update compilers with Windows SDK 7.1. Still when trying to install, ursa would crash and burn with the wrong compiler.

Thanks to a tip from @krvarma I decided to build ursa manually. My first attempt was to followed the instructions on the ursa-npm webpage (on how to build for Windows from source), but it still didn’t build. So I took building manually a step further – down to the bones. I certainly hope there is a better solution than the one I’ve come up with, but it is a solution to build ursa (which allows me to install what I really want - Spark-Server) for 64-bit node.js. I’ve tried to break down the steps into small pieces to error on the side of verbosity.

Hopefully this will help someone in the future.

Here’s what worked:

  1. Install Python 2.7 (64-bit)
  2. Add python to PATH if not installed in C:\Python27
  3. Install Win64 OpenSSL v1.0.1j
  4. Add openssl to PATH if not installed in C:\OpenSSL-Win64\bin
  5. Open Windows command prompt with ‘Run as administrator’
  6. Traverse to location of ‘npm node_modules’ - my path was C:\Program Files\nodejs\node_modules\npm\ node_modules
  7. Download node-gyp source > git clone https://github.com/TooTallNate/node-gyp.git
  8. Create file named ‘binding.gyp’ with the following text:
        "targets": [
                "target_name": "binding",
                "sources": [ "build/binding.sln" ]

Copy file into /npm/node_modules/node-gyp.
9. Run node-gyp configure (this should create /node-gyp/build)
10. Run node-gyp build
11. Traverse back to /npm/node_modules/
12. Downloaded the ursa source > git clone https://github.com/Medium/ursa.git
13. Traverse to /npm/node_modules /ursa
14. Run npm install. It errors out, but it creates the /ursa/build directory which is needed to create the Visual Studio solution
15. Downloaded Visual Studio 2013 Express
16. Opened the solution /ursa/build/binding.sln in VS 2013
17. Restart VS 2013 restart in privileged mode (prompted by VS 2013)
18. Upgraded the VC++ Compiler and Libraries used by the solution (prompted by VS 2013)
19. Build the solution in Release mode x64 (creates /build/Release/ursaNative.node)
20. Create folder ursa\bin
21. Copy file ursaNative.node from /ursa/build/Release to /ursa/bin
22. Run npm test to verify build (from top level /ursa)
NOTE: Now ursa has been successfully built!
(The command prompt no longer needs to be run in administrator mode. Also the location of the spark-server source can be anywhere – as long as you follow steps 24-25)
23. Download spark-server source > git clone https://github.com/spark/spark-server.git
24. Create folder /spark-server/js/node_modules
25. Copy the entire /npm/node_modules/ursa folder into /spark-server/js/node_modules
26. Follow the Quick Install for Spark-Server
27. Next time just use a Linux VM :smile: only step 26 is required)


Thanks for sharing!

If you would like, send a PR to https://github.com/kennethlimcp/book-rpi-lc, i’ll be happy to merge it!

The tutorial is meant for Rpi but we can always add in appendix for Windows ^^