Installing JXCore

Published on: Tue, Nov 4, 2014 at 2:35 am EST
Linux Guides Node.js Programming
Archived content

The upstream software is no longer maintained.

JXCore is a fork of Node.js that introduces better performance and multi-threading. Despite it being in beta, JXCore is fast and stable enough for many applications to be used. It can also bring additional features, functions, and an encrypted package system to help protect your code from preying eyes. In the future, JXCore could possibly bring LLVM into the mix as a replacement for the Google Chrome V8 Engine. This tutorial will show you how to install JXCore onto your linux server. We cover both Ubuntu, CentOS, and possibly any custom OS installed with the Vultr "Custom ISO" feature.

Warning

JXCore is still in beta, and many applications may not be compatible, like they would be with standalone Node.js. If you come across any issues, please report them here. Any issues reported can surely help increase the stability of JXCore.

Update Server

Run the following command to make sure your server is fully up to date, and to have one essential tool installed.

CentOS:

yum update
yum install unzip

Ubuntu/Debian:

apt-get update
apt-get dist-upgrade
apt-get install unzip

Install JXCore

Automatically

The JXCore Team has provided a simple script for anyone to use which installs JXCore onto their system. It has been tested and works perfectly for Ubuntu, Debian, CentOS 7, and FreeBSD. To install JXCore, run the following command:

curl http://jxcore.com/xi.sh | bash

If you did not get an error, then you may proceed to the next step.

Manually

If for some reason the script doesn't work, or you wish to install it manually, then you will have to first download JXCore for your system. Please note this tutorial assumes 64-bit. If you are using 32-bit, you may need to check and make sure there is one available for your architecture and replace 64 with 32.

Ubuntu:

wget https://s3.amazonaws.com/nodejx/jx_ub64.zip

Debian:

wget https://s3.amazonaws.com/nodejx/jx_deb64.zip

CentOS:

wget https://s3.amazonaws.com/nodejx/jx_rh64.zip

You will now want to extract the file that you have downloaded and move the jx executable file to /usr/local/bin. Depending on which file you downloaded, replace XX with ub for Ubuntu, deb for Debian, rh for CentOS.

unzip jx_XX64.zip
cd jx_XX64
mv jx /usr/local/bin

If you decide to move the jx binary to a different location, then please make sure to create a link to /usr/local/bin, or add your own path to the PATH variable on your system.

Verify Installation

To verify a successful installation, run the following command:

jx -e "console.log('Hello World!');"

If you see Hello World!, then JXCore has been successfully installed. If you wish to test the server usage, create a file called server.js and populate it with the following:

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337);
console.log('Server running on port 1337');

Once done, save the file and run jx server.js. Next, in your web browser, navigate to http://0.0.0.0:1337 (replace the IP accordingly) and you will see Hello world.

If you wish to take advantage of one JXCore's multi-threaded feature, run the following:

jx mt-keep:2 server.js 

This will spawn two processes on your server, which take advantage of 2 virtual CPUs. Note that if your server only has one CPU, then using the multi-threaded feature will not be beneficial. On the other hand, if your server has more than 2 virtual CPUs, you can increase the value of 2 to match the virtual CPU count.

Want to contribute ?

You could earn up to $300 by adding new articles