Installation

Using SVR.JS installer for GNU/Linux (installer packages made in April 5, 2024 and later)

The command for SVR.JS installation is available in the SVR.JS home page. First off, press the GNU/Linux button, then copy the command below the tab into the terminal. The command looks something like this: sudo bash -c "$(curl -fsSL https://downloads.svrjs.org/installer/svr.js.installer.linux.20240509.sh)". After starting the installer, you will be prompted to select the type of SVR.JS installation. After selecting the type, SVR.JS installer will install Node.JS, SVR.JS and create SVR.JS service. During installation, you may be prompted for the installation of dependencies. Once the installation is done, the server is started at http://localhost.

File structure will look like this:

  • /usr/lib/svrjs - SVR.JS installation directory
  • /var/log/svrjs - SVR.JS logs
  • /var/www/svrjs - SVR.JS web root
  • /etc/svrjs-config.json - SVR.JS configuration file (SVR.JS config.json)

SVR.JS installer will also install these commands:

  • svrjs-loghighlight - SVR.JS log highlighter
  • svrjs-logviewer - SVR.JS log viewer
  • svrpasswd - SVR.JS user management tool
  • svrjs-updater - SVR.JS updater

Using SVR.JS installer for GNU/Linux (installer packages made before April 5, 2024)

SVR.JS now has a brand new installer for GNU/Linux. First, download SVR.JS installer, then unpack your SVR.JS installer zip archive. After unpacking the installer, download SVR.JS zip archive (not installer), copy it to the installer directory and rename it to “svrjs.zip”. Then run SVR.JS installer using sudo bash installer.sh. After starting the installer, you will be prompted to select the type of OS (type of GNU/Linux distribution). After selecting the type, SVR.JS installer will install Node.JS, SVR.JS and create SVR.JS service. During installation, you may be prompted for the installation of dependencies. Once the installation is done, restart your server OS or type systemctl start svrjs or /etc/init.d/svrjs start to start SVR.JS and get a web server on http://localhost.

File structure will look like this:

  • /usr/lib/svrjs - SVR.JS installation directory
  • /var/log/svrjs - SVR.JS logs
  • /var/www/svrjs - SVR.JS web root
  • /etc/svrjs-config.json - SVR.JS configuration file (SVR.JS config.json)

SVR.JS installer will also install these commands:

  • svrjs-loghighlight - SVR.JS log highlighter
  • svrjs-logviewer - SVR.JS log viewer
  • svrpasswd - SVR.JS user management tool

Using SVR.JS installer for Windows Server

The command for SVR.JS installation is available in the SVR.JS home page. First off, press the Windows Server button, then copy the command below the tab into the command prompt. The command looks something like this: powershell -c "irm https://downloads.svrjs.org/installer/svr.js.installer.windows.20241204.ps1 | iex". After starting the installer, you will be prompted to select the type of SVR.JS installation. After selecting the type, SVR.JS installer will install Node.JS, SVR.JS and create SVR.JS service. During installation, you may be prompted for the installation of dependencies. Once the installation is done, the server is started at http://localhost.

File structure will look like this:

  • %SystemDrive%\svrjs\svrjs - SVR.JS installation directory
  • %SystemDrive%\svrjs\wwwroot - SVR.JS web root

Using create-svrjs-server tool

To install SVR.JS using create-svrjs-server, first install the utility using npm install -g svrjs. Then create a directory, which will contain SVR.JS. Change your working directory to a new one, and run one of those commands:

  • create-svrjs-server lts - Latest SVR.JS LTS version
  • create-svrjs-server latest - Latest SVR.JS version
  • create-svrjs-server 3.6.1 - SVR.JS 3.6.1 (replace 3.6.1 with your desired version)

If you are using Deno versions older than 2.1.2, create the svr.cjs file with these contents:

require("./svr.js");

Repeat the process with logviewer.cjs, loghighlight.cjs, and svrpasswd.cjs files, replacing svr.js with corresponding script names with .js extension.

After downloading and installing SVR.JS to your working directory, run node svr.js for SVR.JS 3.x or node svr_new.js for earlier versions or bun run svr.js if you’re using Bun instead of Node.JS, or deno run -A --unstable-delect-cjs svr.js if you’re using Deno 2.1.2 or newer, or deno run -A svr.cjs if you’re using older versions of Deno.

You will then see the message similar to this:

Decompressing modules...
Deleting SVR.JS stub...
Decompressing SVR.JS...
Restart SVR.JS to get server interface.

After running this command again, you’ll get a web server on http://localhost.

Using Docker

To install SVR.JS via Docker, first pull the image using docker pull svrjs/svrjs command, or docker pull svrjs/svrjs:lts command, if you wish to install LTS version of SVR.JS. Then create and start the Docker container using docker run --name mysvrjs -d -p 80:80 --restart=always svrjs/svrjs command (replace mysvrjs with desired Docker container name). The file structure is the same, as it would be installed via SVR.JS installer. Once the installation is done, the server is started at http://localhost.

Manual installation

To install SVR.JS manually, first unpack your SVR.JS zip archive you downloaded from SVR.JS download page. Then change your working directory to one containing SVR.JS script stub.

If you are using Deno versions older than 2.1.2, create the svr.cjs file with these contents:

require("./svr.js");

Repeat the process with logviewer.cjs, loghighlight.cjs, and svrpasswd.cjs files, replacing svr.js with corresponding script names with .js extension.

Run node svr.js for SVR.JS 3.x or node svr_new.js for earlier versions or bun run svr.js if you’re using Bun instead of Node.JS, or deno run -A --unstable-delect-cjs svr.js if you’re using Deno 2.1.2 or newer, or deno run -A svr.cjs if you’re using older versions of Deno.

You will then see the message similar to this:

Decompressing modules...
Deleting SVR.JS stub...
Decompressing SVR.JS...
Restart SVR.JS to get server interface.

After running this command again, you’ll get a web server on http://localhost, which looks like this:

SVR.JS console

After installation

When you visit localhost, the page will look like this:

SVR.JS running for first time

If you see this page, then SVR.JS installation is successful. You can now replace default server pages (index.html, tests.html, licenses, serverSideScript.js) with custom ones, and remove default mods! If you don’t see this page, then there was a problem when installing SVR.JS.