# Installation Procedure

This document provides the steps required to install a new Clarity LIMS v6.3 instance to Oracle Linux/RedHat Enterprise Linux v8.10.

The installation procedure includes adding the Clarity LIMS repository, installing the Clarity LIMS RPM through yum commands, and configuring the installation through a series of configuration scripts.

## Prerequisites

* Your system meets the requirements listed in [technical-requirements](https://help.connected.illumina.com/clarity-lims/clarity-lims-v6.3-and-lablink-v2.5/technical-overview/technical-requirements "mention").
* You have installed and configured the required components. For more information, see [pre-installation-requirements](https://help.connected.illumina.com/clarity-lims/clarity-lims-v6.3-and-lablink-v2.5/on-premise-deployments/pre-installation-requirements "mention").
* You have a database user and two empty schemas on your database server. The schemas are populated during configuration.
* You have received the appropriate repository files from the Clarity LIMS Support team.
* All standard **OS security updates** have been applied.
* All instances of Clarity LIMS must have a purchased SSL/TLS certificate installed. Purchase the certificate before installation or upgrade. For instructions on installing purchased SSL/TLS certificates, see [install-a-purchased-ssl-tls-certificate](https://help.connected.illumina.com/clarity-lims/clarity-lims-v6.3-and-lablink-v2.5/on-premise-deployments/pre-installation-requirements/install-a-purchased-ssl-tls-certificate "mention").

With the Oracle Linux/RedHat Enterprise Linux server, the following error messages can display when you perform the **yum** commands used to install Clarity LIMS:

```
Failed loading plugin "product-id": No module named 'urllib3'
```

```
Failed loading plugin "subscription-manager": No module named 'urllib3'
```

```
Failed loading plugin "upload-profile": No module named 'urllib3'
```

These messages do not affect the installation of Clarity LIMS. You can resolve these error messages by running the following command:

```
pip3 install urllib3==1.24.2
```

## Step 1: Add the Clarity LIMS Repository

1. Using scp/sftp, WinSCP, FileZilla, PSCP, or similar, copy the repository to the following location: **/etc/yum.repos.d.**
2. Test the repo file with this command:

   ```
   yum --enablerepo=GLS_Clarity63 install ClarityLIMS-App
   ```

## Step 2: Install Clarity LIMS

1. Run the install command:

   ```
   yum --enablerepo=GLS_Clarity63 install ClarityLIMS-App
   ```
2. Type `y` to download and install the Clarity LIMS RPM core components.

   **NOTE**: The installation of Clarity LIMS creates 3 operating system users:

   * **glsai** - User created to run the Automation Worker node
   * **glsftp** - User to access the SFTP file store
   * **glsjboss** - Runs the application server

   These users are created by the RPM installation process, and should not be created before starting the installation steps. The user home directories are created in the directory **/opt/gls/clarity/users**

   The operating system passwords for each of the above users should be set by the **root** user.

   The generated SSH key must be in PEM encoded **RSA private key** format for Automation scripts that require **glsai** user to access to another server instance using SSH key. The SSH public key file should begin with:

   ```
   -----BEGIN OPENSSH PRIVATE KEY-----
   ....key content...
   ```

## Step 3: Run Configuration Scripts

1. As the **glsjboss** user, change directory to **/opt/gls/clarity/config/pending** with the following command:

   ```
   cd /opt/gls/clarity/config/pending
   ```
2. Run the first script listed sequentially in the directory listing with the following bash command:

   ```
   bash /opt/gls/clarity/config/pending/05_configure_claritylims_secretutil.sh
   ```

   This script configures the Secret Utility password management tool so that secrets and passwords are accessible. It is recommended that you store application secrets in vault. If that is not possible, the configuration script supports file-based storage. For more information about the prompts, see [#configuration-script](https://help.connected.illumina.com/clarity-lims/clarity-lims-v6.3-and-lablink-v2.5/guide-to-secret-management#configuration-script "mention").
3. Run the following script:

   ```
   bash /opt/gls/clarity/config/pending/20_configure_claritylims_platform.sh
   ```
4. Run the next script to initialize the database and overwrite any existing data:

   ```
   bash /opt/gls/clarity/config/pending/26_initialize_claritylims_tenant.sh
   ```
5. If your database server is standalone or remote, update the **/opt/gls/clarity/tomcat/current/lib/activity-management-ui-config.groovy** file with the following code snippet.

   ```
   hibernate {
       isis {
           template {
               url="jdbc:postgresql://<Replace me: Remote DB IP>:<Replace me: Remote DB Port>/{0}"
           }
       }
   }
   ```
6. Change to the **root** user, and then run the following script to configure RabbitMQ:

   ```
   bash /opt/gls/clarity/config/pending/32_root_configure_rabbitmq.sh
   ```
7. As the **root** user, install the Apache proxy with the following script:

   ```
   bash /opt/gls/clarity/config/pending/40_root_install_proxy.sh
   ```

## Step 4: Install Lablink

LabLink v2.5 is compatible with Clarity LIMS v6.3.

Before installing LabLink v2.5, make sure that a database named LabLink is created with the same database user as the Clarity LIMS database.

1. Stop all Clarity LIMS services using the following command:

   ```
   /opt/gls/clarity/bin/run_clarity.sh stop
   ```
2. Install the LabLink RPM with the following yum command. Make sure that you have the correct repo enabled:

   ```
   yum --enablerepo=GLS_Clarity63 install ClarityLIMS-LabLink
   ```
3. As the glsjboss user, run the pending initialization script using the following command:

   ```
   bash /opt/gls/clarity/config/pending/60_initialize_lablink.sh
   ```
4. Restart all Clarity LIMS services using the following command:

   ```
   /opt/gls/clarity/bin/run_clarity.sh start
   ```
5. Make sure that LabLink is accessible at `https://<your-Clarity-FQDN>/lablink`

## Step 5: Start the System

Clarity LIMS includes the **run\_clarity.sh** script. This script starts (or stops) all Clarity LIMS services (Elasticsearch, RabbitMQ, Search Indexing, Tomcat, httpd/Apache proxy, Automation Worker) in the required order, with one command.

Run the following script as the **root** user:

```
/opt/gls/clarity/bin/run_clarity.sh (start|stop|restart)
```

If an error occurs starting any service, subsequent services will not be started. Stop all services before trying to start them again.

Start the system as follows.

1. Switch to the **root** user.
2. Make sure that no Clarity LIMS services are running.
3. Run the script with the following **start** command:

   ```
   /opt/gls/clarity/bin/run_clarity.sh start
   ```
4. After the script has completed, all Clarity LIMS services should be ready for use.

If any services are running, the script exits and provides a list of services to stop. In this scenario, complete the following steps:

1. Use the script with **stop** command to stop services.
2. Open a supported browser window and make sure that you can access the Clarity LIMS client at the following URL: `https://<your-Clarity-FQDN>/`
