Run VirtServer as Service

Applies to VirtServer 3.23.0, last modified on November 18, 2024

To run VirtServer as a service, you must create an initial user in VirtServer. If you have not done this yet, do this now. VirtServer will not start until you create a user. You can find information in the Manage VirtServer Users section. Once a user is created, you can start VirtServer as a service and add additional users through the CLI as required.

To configure VirtServer for OIDC, you may need to add an initial user before running it as a service. We recommend you set up VirtServer for OIDC initially and run it as an application to add the required initial users via OIDC.

To see how to set up a connection to the OIDC/Okta service and connect users to VirtServer using their OIDC/Okta credentials, please go to this page.

A possible way to make VirtServer start automatically is to run it as an operating system service on Windows or daemon on Linux and macOS. This way VirtServer can start even if no user is logged in on the computer where it is installed. You can use this approach if you cannot start VirtServer in other ways.

Services (daemons) are a special type of executables. VirtServer is a console application. One possible way to run it as a service (daemon) is to “convert” it to a service with a special utility like nssm. On Windows, a more preferable way is to use a special service executable that is installed as part of the VirtServer installation. On Linux, you can create special configuration files for running VirtServer as a service. See below.

Licensing

Before you start using VirtServer, you need to activate its license. As services (daemons) often run in non-interactive user sessions, you may be unable to activate your VirtServer license normally, since the activation requires that you enter data. You can use any of the following workarounds:

  • Run VirtServer for the first time from the command line to activate the license, and then run VirtServer as a service.

– or –

To run VirtServer as a Service with a SmartBear ID-based license, please activate or deactivate your SmartBear ID-based license using the following commands:

  • java -jar virtserver-cli-1.15.0.jar -s localhost:9090 -activatelicense -licenseserver http://181.72.180.195:40892 - licenseaccesskey 3881e8c2-7898-4d5c-aa6e-2e47fc5e2538 -licenseissuer SLM
  • java -jar virtserver-cli-1.15.0.jar -s localhost:9090 -deactivatelicense -licenseserver http://181.72.180.195:40892 - licenseaccesskey 3881e8c2-7898-4d5c-aa6e-2e47fc5e2538 -licenseissuer SLM

Please enter your own parameter values as appropriate.

  • -licenseserver http://181.72.180.195:40892 - add the SLM license server address and specify port http://40892 is added as default.

  • -licenseaccesskey 3881e8c2-7898-4d5c-aa6e-2e47fc5e2538 - please enter your access key as provided in your onpremise license portal. Access key is required if authentication is configured.

  • -licenseissuer SLM - this is always required if you are using a SmartBear ID-based license.

Windows

The VirtServer installation program offers an option to install VirtServer as a Windows service. Simply select it in the installation wizard:

Service virtualization: Installing VirtServer as a windows Service

Another option you can select is Autostart Service. If you select it, the operating system will run the service automatically on startup.

After you install VirtServer as a service, it is important to change the user account you use to run this service to the account for which your VirtServer license is activated. To do this, open the operating system’s Services list, right-click the VirtServer Service in the list and select Properties from the context menu. In the subsequent dialog, switch to the Log On tab and specify the user account and password there.

Linux

To automate the start of VirtServer, you may use a system configuration. Below is an explanation of how you can do this in RedHat Linux. In other Linux versions the procedure is similar.

  1. Open a text editor and create the following file in the /etc/systemd/system folder.

    Note: To save the file, you will need write permissions for the /etc/systemd/system directory. So, you may need to start the text editor with the sudo command.

    /etc/systemd/system/virtserver.service

    [Unit]
    Description=VirtServer Service
    After=network.target

    [Service]
    Type=simple
    User=user-name
    ExecStart=/home/user-name/SmartBear/VirtServer-3.23.0.0/bin/virtserver.sh
    Restart=on-abort
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=virtserver

    [Install]
    WantedBy=multi-user.target

    Replace user-name with your user name. It is important to specify the user name you used to activate the VirtServer license.

    Also, you may need to correct the VirtServer folder name if you are using a version different from the one we used above.

  2. Run the following command to enable the VirtServer daemon to start automatically on the system startup:

    sudo systemctl enable virtserver.service

  3. Restart your computer. The operating system should run VirtServer as a service (daemon).

    If you want to run the daemon manually, use a command like this one:

    sudo systemctl start virtserver.service

We have updated the process for adding users when starting VirtServer as a service due to reported issues with H2 DB initialization. Previously, users needed to be added before running VirtServer as a service, which was often overlooked. With this update, when you start VirtServer as a service, it will automatically create the database and add a default user. This change ensures that VirtServer can start automatically as a service without requiring manual user setup.

In the example above, the lines starting with StandardOutput, StandardError and SyslogIdentifier command the operating system to output VirtServer’s messages to the syslog using the VirtServer identifier. If you want to log VirtServer messages to a file, then do not enter these three lines. Follow these steps:

  1. Create the following file in /etc/rsyslog.d:

    /etc/rsyslog.d/virtserver.conf

    if $programname == 'virtserver' then /var/log/virtserver.log
    if $programname == 'virtserver' then ~

  2. Run sudo systemctl restart rsyslog to reload the configuration.

Note

Please note that, when running VirtServer as Service and when logged on as local system account, logs will be generated in C:\Windows\.....\logs\. If the logged on user changes to a user account, then logs will be generated in C:\users\...\logs\, based on the logged-in user. You can also use the Diagnostic Log to gather your VirtServer logs and save you having to search your machine. Please see here for how to find and use the diagnostics log.

See Also

Different Ways to Run VirtServer
Admin Tasks

Highlight search results