Install and configure Swarm on Ubuntu

Swarm is available as a package for Ubuntu 20.04 LTS , 22.04 LTS, and 24.04 LTS. Using distribution packages greatly simplifies the installation, updating, and removal of software, as the tools that manage these packages are aware of the dependencies for each package.

Important

We recommend that the latest stable release of Ubuntu 20.04 LTS, 22.04 LTS, or 24.04 LTS is used.

Important

Swarm does not support Helix Core Servers configured to use P4AUTH, see Centralized authorization server (P4AUTH) in the Helix Core Server Administrator Guide.

Note
  • Swarm can be connected to Helix Core Servers (P4D) and commit servers.
  • To configure Swarm to connect to more than one Helix Core Server (P4D), see Multiple Helix Core Server instances.

    To configure Swarm to connect to a Helix Core Server configured to use commit-edge architecture, see Commit-edge deployment.

  • Swarm must not be connected to Helix Broker, Helix Proxy, Helix Edge, forwarding replica, or read-only replica servers.

Installation

Important
  1. Configure the Perforce package repository, on the server to host Swarm and on the server hosting your Helix Core Server.

    Important

    If the server hosting your Helix Core Server cannot use packages, for example when it is running Windows, skip this step on that server.

    Follow the instructions for your OS distribution:

    • Ubuntu 20.04: As root, create the file /etc/apt/sources.list.d/perforce.list with the following content:

      deb http://package.perforce.com/apt/ubuntu/ focal release

    • Ubuntu 22.04: As root, create the file /etc/apt/sources.list.d/perforce.list with the following content:

      deb http://package.perforce.com/apt/ubuntu/ jammy release

    • Ubuntu 24.04: As root, create the file /etc/apt/sources.list.d/perforce.list with the following content:

      deb http://package.perforce.com/apt/ubuntu/ noble release

  2. Import the Perforce package signing key, on the server to host Swarm and the server hosting your Helix Core Server.

    Important
    • If the server hosting your Helix Core Server cannot use packages, for example when it is running Windows, skip this step on that server.

    • If you are using an older version of OpenSSL that does not support TLSv1.2 or higher, replace 'https' with 'http' in the wget command.

    Run the following commands as root for your OS distribution:

    • Ubuntu 20.04:

      wget -qO - https://package.perforce.com/perforce.pubkey | sudo apt-key add -

      sudo apt-get update

    • Ubuntu 22.04 or 24.04:

      wget -qO - https://package.perforce.com/perforce.pubkey | gpg --dearmor | sudo tee /usr/share/keyrings/perforce.gpg

      sudo apt-get update

    For information about how to verify the authenticity of the signing key, see: https://www.perforce.com/perforce-packages

  3. Install the main Swarm package on the server to host Swarm.

    sudo apt-get install helix-swarm

  4. Important

    When the Swarm installation has completed, you are prompted to run the configure-swarm.sh post-installation script.

    Do not run this script until you have completed the rest of these Installation instructions. Instructions for running the configure-swarm.sh post-installation script are in the Post-Installation configuration section referenced in the final step of the Installation instructions.

  5. Swarm needs to know about some Helix Core Server events to operate correctly. Use Helix Core Server Extensions (recommended) or Helix Core Server Triggers to notify Swarm about these events. The Swarm Helix Core Server extension can be installed automatically by the Swarm configure-swarm.sh post-installation script, but Triggers must be manually installed. To use Helix Core Server Extensions, ignore this step and skip to the next step.

    Trigger installation only (not recommended): Install the Swarm triggers package on the server hosting your Helix Core Server. This might be the server hosting Swarm or elsewhere on your network.

    Important
    • If the server hosting your Helix Core Server cannot use packages, for example when it is running Windows, you need to copy the appropriate Swarm trigger script from /opt/perforce/swarm/p4-bin/scripts to the server hosting your Helix Core Server. The swarm-trigger.pl is for both Linux and Windows systems. Once copied, the trigger script needs to be configured. See Installing Triggers for details.

    • The package installs a config file at /opt/perforce/etc/swarm-trigger.conf that you will need to modify. See Installing Triggers for more details on configuring that file.

    Install the Swarm triggers package on the server hosting your Helix Core Server

    sudo apt-get install helix-swarm-triggers

  6. Optional: Install the Swarm optional package, on the server hosting Swarm.

    While not required, installing this package installs the dependencies required to use the ImageMagick and LibreOffice Swarm modules. These modules provide previews of a variety of image and office documents.

    sudo apt-get install helix-swarm-optional

  7. Complete the Post-installation configuration steps.

Post-installation configuration

Once the helix-swarm package has been installed, additional configuration is required. Perform the following steps:

  1. Use the Swarm post-installation script to configure Swarm on the server hosting Swarm.

    Important
    • If your Helix Core Server is configured for Helix Authentication Service, the Helix Core Server must be temporarily configured to allow fall-back to passwords while you establish a connection to the Helix Core Server. Run the following command on the Helix Core Server to enable fall-back to passwords:

      p4 configure set auth.sso.allow.passwd=1

    • To use Helix Core Server Extensions, make sure that Extensions are installed and configured on your Helix Core Server before running the configuration script. For information about Helix Core Server Extensions , see p4 extension in Helix Core Command-Line (P4) Reference and Extensions overview in Helix Core Extensions Developer Guide.

    Note

    The Swarm post-installation configuration script can be used in a few different ways. The steps below outline the most straightforward configuration using an interactive install, but you can review the options by running:

    sudo /opt/perforce/swarm/sbin/configure-swarm.sh -h

    Run the interactive post-installation configuration script:

    sudo /opt/perforce/swarm/sbin/configure-swarm.sh

    The configuration script displays the following summary:

    ------------------------------------------------------------
    configure-swarm.sh: Thu Aug 26 11:29:49 PDT 2021: commencing configuration of Swarm
    Summary of arguments passed:
    Interactive? [yes]
    Force? [no]
    P4PORT [(not specified, will prompt)]
    Swarm user [(not specified, will prompt, will suggest swarm)]
    Swarm password [(not specified, will prompt)]
    Email host [(not specified, will prompt)] Create depot [(not specified, will prompt)] Bypass Lock [(not specified)] Use Extensions? [(not specified, will prompt)]
    Swarm host [(not specified, will prompt, will suggest myhost)]
    Swarm port [(default (80))]
    Swarm base URL [(default (empty))]
    Create Swarm user? [yes]
    Super user [(not specified, will prompt)]
    Super password [(not specified, will prompt)]
  2. Provide information to the configuration script.

    After the summary, the configuration script prompts for the following information:

    1. Specify a value for P4PORT in the form: my-helix-core-server:1666

      No P4PORT specified

      Swarm requires a connection to a Helix Core Server. Please supply the P4PORT to connect to.

      Helix Core Server address (P4PORT):

      Specify the hostname and port for your Helix Core Server. If defined, the value for P4PORT is used as the default. The configuration script verifies that it can connect:

      -response: [myp4host:1666]
      
      Checking P4PORT [myp4host:1666]...
      -P4 command line to use: [/opt/perforce/bin/p4 -p myp4host:1666]
      Attempting connection to [myp4host:1666]...
      -connection successful:
      Server address: myp4host:1666
      Server version: P4D/LINUX26X86_64/2021.1/2179737 (2021/04/24)
      Server license: 10000 users (support ends 2022/05/16)
      Server license-ip: 192.168.0.1
      Important

      If your Helix Core Server is deployed using the commit-edge architecture, ensure that the Swarm port value points to the commit server.

      For more information, see the Commit-edge chapter in the Helix Core Server Administrator Guide.

    2. Specify the userid and password of a normal user with admin-level privileges in the Helix Core Server.

      Checking Swarm user credentials...
      No Swarm user specified
      Swarm requires a Helix user account with 'admin' rights.
      Please provide a username and password for this account.
      If this account does not have 'admin' rights, it will
      be set for this user.
      Helix username for the Swarm user [swarm]:

      Enter the userid. The default is swarm.

      Note

      To allow users to clean up reviews created by other users when the review is committed, the Helix Core Server user account must have super permissions. See Review cleanup.

      -response: [swarm]

      Helix password or login ticket for the Swarm user (typing hidden):

      Enter the login ticket, or password, for the userid.

      Important

      You must use a long-lived login ticket for the Swarm user.

      Note

      You can obtain a login ticket by running (in another shell):

      p4 -p myp4host:1666 -u userid login -p

      If the login ticket you provide expires in less than a year, you will receive a warning. If you receive this warning, ask your Helix Core Server administrator to make sure the swarm user is in a Helix Core Server group that has the Timeout field set to a year or more. See p4 group in the Helix Core Command-Line (P4) Reference.

      Checking Swarm user credentials...
      -checking if user [swarm] exists in [myp4host:1666]...
      -user exists
      Obtaining Helix login ticket for [swarm] in [myp4host:1666]...
      -login ticket obtained
      Checking user [swarm]'s ticket against [myp4host:1666]...
      -login ticket is good
      Checking user [swarm] has at least access level [admin]...
      -user has maximum access level [admin]
      -user meets minimum access level [admin]
    3. Specify the hostname for the Swarm UI.

      swarm needs a distinct hostname that users can enter into their browsers to
      access Swarm. Ideally, this is a fully-qualified domain name, for example
      'swarm.company.com', but it can be just a hostname, for example 'swarm'.

      Whatever hostname you provide should be Swarm-specific and not shared with
      any other web service on this host.

      Note that the hostname you specify typically requires configuration in your
      network's DNS service. If you are merely testing Swarm, you can add a
      hostname->IP mapping entry to your computer's hosts configuration.

      Hostname for this Swarm server [myhost]:
      Note

      The default is the current hostname. The configuration script does not verify that the hostname actually works (DNS configuration may not exist yet).

    4. Specify a mail relay host or leave empty to use your local mail handler.

      Swarm can use a mail relay host to send email notifications. Leave empty if
      you want to use the local mail handler (for example Sendmail, Postfix etc), or enter a hostname (for example mx.yourdomain.com) to use a relay host. Mail relay host:
      Note

      The configuration script does not verify that the mail relay host you provide actually accepts SMTP connections.

    5. To enable file attachments on comments, Swarm must have a depot location to save the attachment files in. Swarm can create this depot and set the depot protections for you automatically or you can manually set it up later.

      Important

      You must be a user with super user permissions to create the .swarm depot and set protections.

      - checking depot 
      
      Swarm has the ability to store attachments against review comments. To
      do this, it needs to have a depot where they are stored. By default, this is //.swarm. We can create the depot for you automatically, and set the protections on it to the following: list user * * -//.swarm/... admin user swarm * //.swarm/... super user super * //.swarm/... If you want to enable attachments, and for the depot and protections to be set up for you, then say yes here. If you say no, then you can still do this manually later. Do you want to create a .swarm depot and set protections? (y/n) [n]

      When prompted to automatically create the depot, select one of the following:

      • Type y to automatically create the .swarm depot and set protections.

      • Type n skip depot creation. You can create the depot and set the protections manually later if you want to, see Comment attachments.

      If you choose to automatically create the depot, the script will create the depot, set the protections, and report when completed.

      Depot //.swarm successfully created. Protections have been set so
      that only the 'swarm' and 'super' have permissions to access it directly.
    6. Swarm needs to know about the exclusive locks to work with exclusively opened files. To enable exclusive locks, set the filetype.bypasslock to 1. For more information about exclusive locks, see Handling Exclusive Locks.
    7. Tip

      If this setting is not enabled in Helix Core Server, Swarm will report exceptions when working with exclusively opened files similar to Cannot unshelve review (x). One or more files are exclusively open, and that you must have the filetype.bypasslock configurable enabled.

    8. Swarm needs to know about some Helix Core Server events to operate correctly. Use Helix Core Server Extensions (recommended) or Helix Core Server Triggers to notify Swarm about these events. Helix Core Server Extensions are easier to install and maintain than triggers.

      Important

      You must be a user with super user permissions to install and configure Helix Core Server Extensions.

      Do you want to use Swarm's Helix Core server extension?
      Configuring Server extensions requires super user access to the Helix Server.
      If you install the Swarm server extension, do not install the Swarm triggers.
      Server extensions are supported for:
      * Linux: Helix server 19.2 and later.
      * Windows: Helix server 21.2 and later. 
      
      Use server extensions? 

      When prompted to Use server Extensions, choose one of the following:

      • Recommended: Type y to use Helix Core Server Extensions. The configuration script will try and install and configure the Swarm Helix Core Server extension.

      • Type n to use Helix Core Server Triggers. Triggers must be installed manually, Swarm will prompt you to do this when the Swarm configuration script completes.

      Note

      If you choose to install the Swarm Helix Core Server Extensions, the script will:

      • check your Helix Core Server supports Helix Core Server Extensions

      • check if Helix Core Server Extensions are installed and configured on your Helix Core Server. If they are, Swarm does not need to do anything

      • install and configure the Swarm Helix Core Server extension on your Helix Core Server

      If any of these checks fail, Swarm will not install the Swarm Helix Core Server extension and will report the issues on the configuration summary screen.

    9. Once all of the information has been provided, the configuration script configures Swarm. When it has completed the configuration, the configuration summary screen is displayed, for example:

      ...........
      -restarting Apache...
      -Apache restarted
      configure-swarm.sh: Thu Aug 26 11:31:36 PDT 2021: completed configuration of Helix Swarm
      
      ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
      ::
      ::  Swarm is now configured and available at:
      ::
      ::      http://myhost/
      ::
      ::  You may login as the Swarm user [swarm] using the password
      ::  you specified.
      ::
      ::  Ensure that you have configured the Swarm hostname in your
      ::  network's DNS, or have added an IP address-to-hostname
      ::  mapping to your computer's hosts configuration so that you
      ::  can access Swarm.
      :: 
      ::  Server side extensions are installed and configured
      ::  on your P4D server.
      ::
      ::  Documentation for optional post-install configuration, such as
      ::  configuring Swarm to use HTTPS, operate in a sub-folder, or on a
      ::  custom port, is available:
      ::
      ::  https://www.perforce.com/perforce/doc.current/manuals/swarm/setup.post.html
      ::
      ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

  3. Note

    If you have installed Swarm on a host that does not provide other web services, you may wish to disable Apache's default site configuration. Doing so means that regardless of the hostname a user might use to reach the web server hosting Swarm, Swarm would be presented.

    Be aware that disabling Apache's default site configuration could disable existing web services or content.

    Disabling Apache's default site configuration on Ubuntu hosts is easy. Run:

    $ sudo a2dissite 000-default

    To add Swarm as an HTML tab in the Helix Core Visual Client (P4V), see HTML Tabs section in the P4VJS Developer Guide.

  4. The basic Swarm configuration is now complete.

    Important

    If your Helix Core Server is configured for Helix Authentication Service, you can force all of your users to authenticate via your Identity Provider (IdP) by disabling fall-back to passwords. To disable fall-back to passwords on the Helix Core Server, run the following command:

    p4 configure set auth.sso.allow.passwd=0

  5. Do one of the following:

    • If the Swarm Helix Core Server extension was installed by the configuration script: Review the post-install configuration options to customize your Swarm installation, see Post-install configuration options.

    • If the Swarm Helix Core Server extension was not installed, you must install triggers: Configure Helix Core Server for Swarm, see Installing Triggers.

Upgrading

See Upgrading a Ubuntu package installation for details.

Uninstall

  1. Depending on how you have configured your Helix Core Server events, do one of the following:

    • Uninstall the Swarm Helix Core Server extension. To do this, run the following command on your Helix Core Server:

      p4 extension --delete Perforce::helix-swarm --yes

    • Uninstall the Swarm triggers. As a super user, run the p4 triggers command from your Helix Core Server and manually remove all the Swarm trigger code lines.

  2. Uninstall the Swarm main package, the Swarm triggers package, and the Swarm optional package. The following example assumes that the packages are all installed on the same server:

    sudo apt-get remove helix-swarm helix-swarm-triggers helix-swarm-optional

  3. Remove the Swarm trigger scripts from the server hosting your Helix Core Server.

    Important

    If you manually installed the trigger script, perhaps because the server hosting your Helix Core Server cannot use packages (e.g. Windows), manually remove the script.