# Installation

Before you install the software, make sure you meet the following requirements:

* you have at least a few GB of storage for the data.
* your networking environment does not block TCP connections between components.

The installation procedure covers the server and the agents.&#x20;

## Server

The server binary is distributed as both `deb` and `rpm` packages. First of all, you need to [download](https://cdn.flopsar.com/) the server installation package for [your platform and architecture](https://docs.flopsar.com/6.0/overview/supported-platforms-and-requirements#server). If you want to serve the workstation application from the Flopsar server, download `flopsar-workstation.zip` file too. For Debian based distributions you can install it by executing the following command:

```shell-session
# dpkg -i flopsar-server-<VER>.<arch>.deb
```

For Red Hat based distributions you can install it by executing one of the following commands:

```shell-session
# rpm -ih flopsar-server-<VER>.<arch>.rpm
# zypper install flopsar-server-<VER>.<arch>.rpm
# yum install flopsar-server-<VER>.<arch>.rpm
```

In both cases, the installation procedure performs the following operations:

* installs `flopsar-server` binary
* creates a `flopsar` user, which is used to run the server
* adds a `flopsar` `systemd` service
* creates a global configuration at `/etc/flopsar`

### Environment Installation

When the server is installed, next you need to create a new Flopsar environment where the data will be stored. You have two options at your disposal, either bundled environment or separated one.

{% tabs %}
{% tab title="Workstation Included" %}
Copy `flopsar-workstation.zip` to your destination machine. Now, you need to create a new Flopsar environment by executing the following command:

```shell-session
$ flopsar-server create --app flopsar-workstation.zip <server_home>
```

where `<server_home>` is a path to the location where the server home directory will be created. If the command executes successfully, it will create a new directory at the specified path.&#x20;
{% endtab %}

{% tab title="Workstation Excluded" %}
You need to create a new Flopsar environment by executing the following command:

```shell-session
$ flopsar-server create <server_home>
```

where `<server_home>` is a path to the location where the server home directory will be created. If the command executes successfully, it will create a new directory at the specified path.&#x20;

Note, since the workstation application is not served from the Flopsar server in this case, you need to download the `flopsar-workstation.zip` file and install it on your own web server.&#x20;

For example, in nginx web server you should add the following <mark style="color:red;">`location`</mark> sections to your <mark style="color:red;">`server`</mark> configuration:

{% code title="nginx.conf" lineNumbers="true" %}

```nginx
server {
  .....

  location / {
    try_files $uri $uri/ =404;
  }
  location /api/ {
    proxy_pass http://localhost:9443;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $host;
  }
 
  ....
}
```

{% endcode %}

The example above assumes that the Flopsar server listens to requests on `localhost:9443` socket address and the Flopsar server has its `ssl.enable` configuration option value set to `false`. Obviously, you should adjust the <mark style="color:red;">`proxy_pass`</mark> option to your own needs according to the [server configuration](https://docs.flopsar.com/6.0/server#ui).
{% endtab %}
{% endtabs %}

{% hint style="warning" %}
If you start the server using `systemd`, note that it will run it as `flopsar` user by default. Make sure this user has read/write permissions to the environment directory.
{% endhint %}

### Server Configuration

The server stores its [configuration](https://docs.flopsar.com/6.0/server#configuration) globally in `/etc/flopsar/settings.yml` file. You must edit this file to make at least two changes. The first one is required and you must accept the [EULA](https://cdn.flopsar.com/#/eula) by setting option `eula: true` otherwise, you will not be able to run the server. The second one is to set the `data` option, which points to you environment directory.

{% hint style="info" %}
This new environment will be created with some default settings. Adjust these settings to your needs accordingly. Please, refer to the [server configuration](https://docs.flopsar.com/6.0/server#configuration) for more details.
{% endhint %}

### Running the Server

Finally, you can start the server by executing the following command:

```shell-session
# systemctl start flopsar
```

If you installed the workstation application bundled with the Flopsar Server, then you can access the application at the address specified at the [server configuration](https://docs.flopsar.com/6.0/server#ui). If you installed the workstation application outside the Flopsar server, you can access it at the address specified in your web server configuration. In either case, you should be able to access the workstation application login page at the address: `https://<YOUR_IP>:9443`

<figure><img src="https://content.gitbook.com/content/n6Lfo4f68T0T3131ZgV5/blobs/sIqSPFayE6XN76SHxn9D/Screenshot%202024-04-04%20at%2015.39.16.png" alt=""><figcaption><p>Workstation Login Page</p></figcaption></figure>

{% hint style="info" %}
Default credentials are: `admin/flopsar`
{% endhint %}

### Docker Image

Alternatively, you can use a Docker image which has preinstalled the server along with the workstation. The image is shipped for two architectures: `amd64` and `aarch64`. All you need to do is pull the image. For `amd64` architecture:

<pre class="language-shell-session"><code class="lang-shell-session"><strong>$ docker pull flopsar/server:6.0.0 --platform linux/amd64
</strong></code></pre>

or for `aarch64`:

<pre class="language-shell-session"><code class="lang-shell-session"><strong>$ docker pull flopsar/server:6.0.0 --platform linux/arm64
</strong></code></pre>

#### Quick start

Next, run the server by executing the following command:

```shell-session
$ docker run -d -p 9443:9443 -p 9000:9000 -p 4137:4137 -p 4138:4138 flopsar/server:6.0.0
```

or if you use `podman`:

```shell-session
$ podman run -d -p 9443:9443 -p 9000:9000 docker.io/flopsar/server:6.0.0
```

{% hint style="info" %}
Please note, if the server is run in this way, the EULA is accepted automatically.
{% endhint %}

#### External storage

Alternatively, if you want to store the Flopsar data outside the container execute the following command:

```shell-session
$ docker run -d --name flopsar -p 9443:9443 -p 9000:9000 -p 4137:4137 -p 4138:4138 \\
    -v /your/directory:/opt/flopsar flopsar/server:6.0.0
```

{% hint style="info" %}
The Flopsar server is run by `flopsar` user (`uid=999`), so make sure they have write access to `/your/directory`.
{% endhint %}

### Quick Sample Installation

This section presents a sample, quick installation of the Flopsar server. First download the installation package along with the workstation application. Next, execute the following command:

```shell-session
$ sudo dpkg -i flopsar-server-6.0.0.amd64.deb
```

or if you use `rpm` package:

```shell-session
$ sudo rpm -i flopsar-server-6.0.0.x86_64.rpm
```

Next, let's create a new Flopsar environment at `/opt` directory:

```shell-session
$ sudo flopsar-server create --app flopsar-workstation.zip /opt/flopsar
```

If the environment has been created successfully, the following output should be displayed:

<pre><code><strong> Creating a new Flopsar Server environment...
</strong> Unpacking Flopsar Workstation application...
 Flopsar Server environment created successfully.
</code></pre>

Next, change the ownership of the environment directory to `flopsar` user:

```shell-session
$ sudo chown -R flopsar /opt/flopsar
```

Next, open the `/etc/flopsar/settings.yml` file:

{% code lineNumbers="true" %}

```yaml
eula: false
name: my environment
data: /change/me
max_ext_size: 1MiB
agent:
  server_ip: 0.0.0.0
  server_port: 9000
ui_srv:
  server_ip: 0.0.0.0
  server_port: 9443
  ssl: false
otlp:
  enable: true
  http:  
    server_ip: 0.0.0.0
    server_port: 4318
  grpc:
    server_ip: 0.0.0.0
    server_port: 4317
    ssl: false
ssl:
  cert: server.crt
  key: server.pem
logger:
  backend: Local
  max_size: 50MiB
  max_files: 5
archive:
  enable: false
  policy: purge
  start_at: 03:00:00.0
  retention: 3days
pass_policy:
  enable: false 
  min_len: 8
  digits: false 
  special_chars: false
  capital_letters: false
  forbidden_chars: ''
```

{% endcode %}

and make changes in both `eula` and `data` options (line 1 and 3):

{% code lineNumbers="true" %}

```yaml
eula: true
name: my environment
data: /opt/flopsar
max_ext_size: 1MiB
agent:
  server_ip: 0.0.0.0
  server_port: 9000
ui_srv:
  server_ip: 0.0.0.0
  server_port: 9443
  ssl: false
otlp:
  enable: true
  http:  
    server_ip: 0.0.0.0
    server_port: 4318
  grpc:
    server_ip: 0.0.0.0
    server_port: 4317
    ssl: false
ssl:
  cert: server.crt
  key: server.pem
logger:
  backend: Local
  max_size: 50MiB
  max_files: 5
archive:
  enable: false
  policy: purge
  start_at: 03:00:00.0
  retention: 3days
pass_policy:
  enable: false 
  min_len: 8
  digits: false 
  special_chars: false
  capital_letters: false
  forbidden_chars: ''
```

{% endcode %}

And finally, start the server:

```shell-session
$ sudo systemctl start flopsar
```

Now, you should be able to access the workstation application at [https://localhost:9443](https://localhost:9443/)

## Agent

To install the Flopsar agent, follow carefully the instructions below:

1. select the agent library file for your platform and architecture.
2. copy the agent library to your server machine.
3. configure the agent.
4. restart your application.

## OpenTelemetry Agents

To install OpenTelemetry agents, please refer to [OpenTelemetry documentation](https://opentelemetry.io/docs/getting-started/ops/) and the [server section](https://docs.flopsar.com/6.0/server#opentelemetry).
