# 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/5.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/5.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/5.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/5.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/5.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://2268302518-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRRwSLM5GTvsX7vYPRXpo%2Fuploads%2FxW1C7nwsFrmyeUmBUkOp%2Flogin_window.png?alt=media&#x26;token=6f047505-6a9a-4aef-b0bc-e02ba843e360" alt=""><figcaption><p>Workstation Login Page</p></figcaption></figure>

{% hint style="info" %}
Default credentials are: `admin/flopsar`
{% 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-5.0.0.amd64.deb
```

or if you use `rpm` package:

```shell-session
$ sudo rpm -i flopsar-server-5.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
data: /change/me
agent:
  server_ip: 0.0.0.0
  server_port: 9000
ui:
  server_ip: 0.0.0.0
  server_port: 9443
ssl:
  enable: true
  cert: ssl/server.crt
  key: ssl/server.pem
logger:
  max_size: 50.00 MiB
  max_files: 5
archive:
  enable: false
  policy: purge
  start_at: 03:00:00.0
  retention: 3days

```

{% endcode %}

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

{% code lineNumbers="true" %}

```yaml
eula: true
data: /opt/flopsar
agent:
  server_ip: 0.0.0.0
  server_port: 9000
ui:
  server_ip: 0.0.0.0
  server_port: 9443
ssl:
  enable: true
  cert: ssl/server.crt
  key: ssl/server.pem
logger:
  max_size: 50.00 MiB
  max_files: 5
archive:
  enable: false
  policy: purge
  start_at: 03:00:00.0
  retention: 3days

```

{% 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 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. create a directory (we call this directory a Flopsar home directory) and `ext` subdirectory for the agent data.
4. configure the agent.
5. optionally put all your agent plugins into the `ext` directory.
6. restart your application.
