Installing the Klocwork Server package on Linux

This page provides instructions for installing the Klocwork Server package using the installer.

Before you begin

Upgrading? See Upgrading from a previous version.

Where do I get the software?

Download the packages the Perforce Community Portal. Typically, only one or two users in an organization have access to the Klocwork technical support portal. If you don't have access, you can register for a new account.

You need a license. See Get a license if you don't already have one.

Running two versions of the Klocwork Servers

If you will be running two sets of the Klocwork Servers, for example to test the Klocwork 2023.3 Servers while users continue to access your existing servers, you must run them on different projects_root directories.

Check the system requirements

Refer to the System requirements for a list of required packages and dependencies.

Installation notes

  • ulimit -n must be 2048 in order to run the Klocwork Server.
  • Ensure that the downloaded .sh file is executable. Use the chmod command to set the appropriate permissions:chmod 755 <kw-installer.sh>
  • To control permissions when you are installing Klocwork, change the value of umask.
  • Install Klocwork software as a non-root user.
  • Ensure that the path in which you install the product is the same path from which users invoke the product. For example, the local path to the installation might be /local/tools/klocwork, but users on other machines have to use the NFS path /opt/tools/klocwork to invoke the product. Therefore, to ensure that users can invoke the product, use the /opt/tools/klocwork path during installation.
  • Due to issues with file locking, user home directories should not be located on NFS. See Failed to lock file or directory: No locks available.
  • The installer uses the environment variable 'TMPDIR'.
  • For some Linux installations, if you want to run the Klocwork Server, you may be required to install additional third-party libraries. For example: libaio1, libaio, or libaio.x86_64.
  • If you are installing on Linux and the target machine has 6 GB or more of memory, the memory settings configuration will be increased to improve performance.
  • The Klocwork Server and Database Server need to be running on the same machine.

Do not locate the projects_root directory on NFS to avoid issues with file locking.

Running the installation package

Run the following command:

kw-server-installer.23.3.x.x.<platform>.sh [options] <install_directory> [<component ...>]

where

  • <platform> is linux.
  • [<options>] are any of the options listed in Command-line options for the Server package.
  • <install_directory> specifies the directory in which you want to install Klocwork. Do not specify a subdirectory of the projects_root directory. Note that if the chosen directory is not empty, you will not be able to continue with the installation.
  • [<component ...>] is any of the arguments from Arguments for Server components. Separate multiple components with spaces. If you do not specify one or more components, the entire package will be installed. You can also see a list of arguments for the various components with the --list option.

Command-line options for the Server package

Name Short name Description
--agree -a Agree to license terms and do not display license agreement.
--database-port <port_number>   Specify the port number that you will use to run the Database Server. Default: 3306. This option is equivalent to specifying the port number with kwservice.
--debug   Print debug information
--force -f Install without integrity checks
--help -h Display this help and exit
--klocwork-port <port_number>   Specify the port number that you will use to run the Klocwork Server. Default: 8080. This option is equivalent to specifying the port number with kwservice.
--license-port <port_number>   Specify that the License Server will be run locally, but on a non-default port. Default: 27000. This option is equivalent to specifying the port number with kwservice.
--license-server <host>[:<port>]   Specify a remote License Server host. The host argument is required; the port argument is optional. Default: localhost:27000. This option is equivalent to specifying the host and port with kwservice.
--list -l List available features (components)
--projects-root <directory> -p Specify the complete path to a non-default projects_root directory. Default: <install_directory>/projects_root. The directory you specify must meet one of the following conditions:
  • it does not yet exist
  • it is empty
  • it is a valid projects_root directory created previously. Do not specify the same directory as the root Klocwork installation directory you have specified. Do not install Klocwork in a subdirectory of the projects_root directory.
IMPORTANT: If you are upgrading, specify the old projects_root directory that you want to migrate.
--version -v display the version of Klocwork software and exit

Arguments for Server components

To install this Server component (feature)... ...enter the argument...
License Server LicenseServer
Klocwork Server KlocworkServer

Add Klocwork to your PATH

On Linux, we recommend adding <klocwork_install>/bin to your PATH. Otherwise, you need to execute commands from <klocwork_install>/bin.

Copy the license file

Copy your license file to the following location:

<projects_root>/licenses

The license file must have the extension .lic.

See Customizing licensing for licensing options such as using your organization's license server.

Start the servers

Start the servers with kwservice start:

kwservice --projects-root <projects_root> start 

where <projects_root> is the projects_root directory you specified during installation

Example

kwservice --projects-root /space/klocwork/projects_root start 

You see messages indicating that the servers have been started, showing the server host name and port number and the path to the projects_root. For example:

Using projects root: /space/klocwork/projects_root Local Host is: serverxyz.com [13.1.1.142]
Starting License Server [started on serverxyz.com:27000] (projects root is /space/klocwork/projects_root) 
Starting Database Server [started on serverxyz.com:3306] (projects root is /space/klocwork/projects_root) 
Starting Klocwork Server [started on serverxyz.com:8080] (projects root is /space/klocwork/projects_root)

Important: If you create a script to start the Klocwork servers automatically, do not name your script 'klocwork' as it will interfere with existing processes.

Log in to Klocwork Static Code Analysis

After starting the Klocwork servers, Klocwork Static Code Analysis is accessible from a browser using the URL of the Klocwork server hostname and the Klocwork server port chosen during the install (for example, server21:8080). By default, the person who installed Klocwork is set as the Klocwork administrator, and is given the Projects root admin role. Initially, the Basic Authentication access control method is used, so no password is needed to log in. For example, if the user account used during the installation was ‘jsmith’, to log in to Static Code Analysis with the administrator role, use the credentials:
username: jsmith
password: <empty>

For more information about security and authentication methods, see Security and permissions.