svrjs-nextjs-website/pages/docs/getting-started/installation.md

5.1 KiB

title
Installation

Installation

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

The command for SVR.JS installation is available in the SVR.JS home page. First off, switch to GNU/Linux tab, then copy the command below the tab into the terminal. The command looks something like this: curl -fsSL https://downloads.svrjs.org/installer/svr.js.installer.linux.20240509.sh > /tmp/installer.sh && sudo bash /tmp/installer.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 (installer packages made before April 5, 2024; GNU/Linux only)

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 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)

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.

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, and 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.

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.