> Source: https://docs.cyberelements.io/saas/sl/HybridDeployment/FromScratch/InstallEdgeGateway/

# Installation of the Edge Gateway from scratch

This page describes the installation of an Edge Gateway on a Debian 13 machine that you install yourself, then its pairing with your CyberElements platform. The Mediation Controller, the system console and the database of your platform are operated by CyberElements: only the Edge Gateway is installed on your side. Deploying [from a virtual appliance](https://docs.cyberelements.io/saas/sl/HybridDeployment/VirtualAppliance/Introduction/) spares you the preparation of the system.

> **Advanced hardening to be carried out**
>
> An Edge Gateway installed from scratch offers the same CyberElements features as one deployed from the virtual appliance, but the hardening of its system is up to you: apply the recommendations of the [security hardening guide](https://docs.cyberelements.io/saas/sl/Security/SecurityHardening/) once the installation is complete.

> **Note**
>
> As a reminder, switching to `root` on Debian machines must be done with the following command:
>
> ```
> 1
> ```

## Prerequisites

The CPU, RAM, network flow and certificate prerequisites are common to all Edge Gateways: see [Prerequisites of the Edge Gateways](https://docs.cyberelements.io/saas/sl/HybridDeployment/EdgeGatewayPrerequisites/). The flows towards your platform (`<tenant>.cyberelements.io` and the SSL Router of your platform, TCP 443) are required for pairing and operation.

### Machine and operating system

Both physical and virtual machines can be used. The product does not perform any virtualization, so the embedded virtualization option does not need to be enabled for virtual machines.

The Edge Gateway 4.7 runs on 64-bit Debian 13 (Trixie) machines; it no longer runs on Debian 12 (Bookworm).
It is recommended to use machines without a graphical interface and to limit the installed components to the SSH server: in the software selection screen of the Debian installer, keep only `SSH server` checked (`standard system utilities` is checked by default).

> **Recommendation**
>
> The security hardening guide details the minimal Debian installation, the follow-up of the Debian version and of its security maintenance, and the removal of the packages installed by default: see [R1](https://docs.cyberelements.io/saas/sl/Security/SystemHardening/SystemInstallation/#r1), [R2](https://docs.cyberelements.io/saas/sl/Security/SystemHardening/SystemInstallation/#r2) and [R4](https://docs.cyberelements.io/saas/sl/Security/SystemHardening/SystemInstallation/#r4).

### Disk partitioning

We recommend partitioning the disk using LVM to provide greater flexibility if the machine's size needs to be revised during use.

The Edge Gateway server will experience increased volume in the following directories:

- `/var/log/`: directory containing the various system logs.
- `/var/lib/ipdiva/carerecord/recording/`: directory containing archives currently being recorded; this is therefore a temporary storage directory.
- `/var/lib/ipdiva/carerecord/archives/`: default directory containing the product's graphic archives.
- `/var/ipdiva/care/sshrecord/`: default directory containing the product's non-graphic (SSH) archives.

Isolating the different directories in different partitions is not mandatory but recommended. You can follow these instructions:

| Mount point | Options | Minimum size (GB) |
|---|---|---|
| `/boot` | nosuid,nodev,noexec | 1 |
| `/opt` | nosuid,nodev | 2 |
| `/tmp` | nosuid,nodev | 4 |
| `/srv` | nosuid,nodev | 1 |
| `/home` | nosuid,nodev,noexec | 6 |
| `/usr` | nodev | 6 |
| `/var` | nosuid,nodev | 5 |
| `/var/log` | nosuid,nodev,noexec | 5 |
| `/var/tmp` | nosuid,nodev,noexec | 2 |
| `swap` | No option | Depending on RAM (half less) |
| `/` | No option | 2 GB or more depending on the available disk space |

> **Example**
>
> For a server with 4 GB of RAM (which requires 2 GB of `swap`), the disk space required with the previous partitioning is a minimum of 36 GB.

However, it is strongly recommended to allocate more disk space for temporary or long-term graphic archives with the `/var` mount point unless [the archives are outsourced](https://docs.cyberelements.io/saas/sl/Usage/Configuration/EdgeGateway/OutsourcingArchiveStorage/).

> **Recommendation**
>
> The security hardening guide proposes a reference partitioning with its mount options, which differs on some points from the table above: see [R3](https://docs.cyberelements.io/saas/sl/Security/SystemHardening/SystemInstallation/#r3).

## Values used on this page

The following value is used in several commands and configuration files of this page. Enter it here: the commands displayed on this page are updated as you type.
A value used by a single command is entered in a table placed just before that command.

| Value | Variable | Definition |
|---|---|---|
|  | `IP_GW` | IP address of the Edge Gateway server. |

## Downloading the mirror and necessary tools

The Bastion mirror and the Systancia repository signature key for Debian 13 can be downloaded from this link (requires the creation of a customer account): [Systancia Marketplace](https://www.systancia.com/en/my-systancia/marketplace/systancia-cleanroom/downloads-cleanroom/)

In addition to the mirror and key, third-party tools will be required for the installation process:

- An SSH client (on Windows, you can use [PuTTY](https://putty.org/))
- An SCP client (on Windows, the [WinSCP](https://winscp.net/eng/index.php) or [FileZilla](https://filezilla-project.org/) tools can be used)

Use the SSH client to connect remotely to your server.

Use the SCP client to transfer files to your remote machine.

## Preparing for installation

### Configuration of the network

It is highly recommended to define a static network address for the Edge Gateway server. To do this, you first need to retrieve the name of your machine's network interface and its MAC address. Run the following command as `root`:

```
1
```

This command displays the name of the network interface, its status, its MAC address, and the interface settings.

> **Example**
>
> After the command is executed, the following output is displayed:
>
> ```
> 1
> ```
>
> The name of the network interface is `ens192` and its MAC address is `00:50:56:a1:56:9f`.

Once the network interface name and MAC address have been obtained, it is now possible to edit the machine's network configuration.
Edit the `/etc/network/interfaces` file to modify it using the following template:

| Value | Variable | Definition |
|---|---|---|
|  | `INTERFACE_NAME` | Name of the network interface, retrieved with the previous command. |
|  | `MAC_ADDRESS` | MAC address of the network interface, retrieved with the previous command. |
|  | `NETMASK` | Network mask associated with the IP addresses. |
|  | `NETWORK_GATEWAY` | Default network gateway. |
|  | `IP_DNS_1` | IP address of the DNS server. |
|  | `IP_DNS_2` | IP address of a second DNS server (optional: left empty, it disappears from the configuration). |
|  | `DNS_SUFFIX` | DNS suffix to use; without a suffix, delete the `dns-search` line. |

```
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
```

> **Example**
>
> ```
>  1
>  2
>  3
>  4
>  5
>  6
>  7
>  8
>  9
> 10
> 11
> 12
> 13
> 14
> 15
> 16
> 17
> 18
> 19
> 20
> 21
> 22
> ```

Before applying the configuration, there are three more steps to complete.

The first is to install packages `resolvconf` and `bridge-utils` so that the DNS configuration specified in the previous file can be applied and the `br0` interface can be used:

```
1
```

The second is to check the configuration of the `/etc/hosts` file with regard to the machine's primary IP address (`IP_GW`).
To do this, edit the `/etc/hosts` file: after the Debian installation, its second line holds the address `127.0.1.1` followed by the machine name. Replace this address with `IP_GW`, so that the second line is in the following format:

| Value | Variable | Definition |
|---|---|---|
|  | `FQDN` | Fully qualified name of the machine (name and domain); without a domain, delete it from the line. |
|  | `MACHINE_NAME` | Short name of the machine. |

```
2
```

> **Example**
>
> If the machine is named `EDGE-GATEWAY` without belonging to a domain and its IP address `IP_GW` is `172.16.10.10`, then the file would be completed as follows:
>
> ```
> 2
> ```
>
> If the machine belongs to the `DOMAIN.LOCAL` domain, then the file would be completed as follows:
>
> ```
> 2
> ```

> **Attention!**
>
> An incorrect configuration of the file may cause an error when installing the `collectd` package.

All that remains is to restart the server:

```
1
```

### Configuring the APT package manager

Upload the files downloaded from the Systancia Marketplace to the `/tmp/` directory on the server using an SCP client:

- `systancia.gpg`
- `cleanroom-4.7.0-build75.1097.D13-full_auto.tgz`

Log in to the server as `root`, then run the following commands to unzip the Systancia repository, configure its use in APT, and authenticate it.

```
1
2
3
4
5
6
```

We strongly recommend disabling the installation of unnecessary packages when running `apt` commands. To do so, run the following command:

```
1
```

Then update the Debian packages already installed on the server:

```
1
2
```

> **Recommendation**
>
> The security hardening guide details the integrity check of the packages and of the APT repositories, and the automation of Debian security updates: see [R6](https://docs.cyberelements.io/saas/sl/Security/SystemHardening/SystemInstallation/#r6) and [R7](https://docs.cyberelements.io/saas/sl/Security/SystemHardening/SystemInstallation/#r7).

## Installation of the Edge Gateway

### Installation of basic components

Start installing the components using the following command as `root`:

```
1
```

After downloading all dependencies, a window will open asking you to select the server type. Select `gateway`:

![](https://docs.cyberelements.io/saas/img/cyberelements/CYE_Install_IpdivaBase_HostKind_Gateway.png)

The values entered are recorded in `/etc/ipdiva.conf`. Check them:

```
1
```

> **What should I do if there is an error?**
>
> If there is an error in the information you entered, continue installing the `ipdiva-base` package and then use the following command to reconfigure the server:
>
> ```
> 1
> ```

### Installation of Edge Gateway components

Next, start the installation of the Edge Gateway-specific components using the following command:

```
1
```

The Edge Gateway server components are now installed. All that remains is to restart the machine so that the newly installed components can initialise:

```
1
```

## Pairing with your platform

The `ipdiva-gateway-setup` package installed above provides the pairing script. Pairing connects the Edge Gateway instance to your CyberElements platform:

1. [Generate a pairing token](https://docs.cyberelements.io/saas/sl/Usage/Configuration/AdminConsole/CreatePairingTokenForEdgeGateway/) in the administration console.
2. On the Edge Gateway, as `root`, run the pairing script as described in [Connecting an Edge Gateway using the pairing mechanism](https://docs.cyberelements.io/saas/sl/Usage/Configuration/EdgeGateway/ConnectAnEdgeGatewayWithPairingToken/), giving the DNS name of your CyberElements tenant with the `-s` option.

> **Example**
>
> For a tenant named `my-tenant` and the token `TCGX-091U-AIBW-EWF7-T7XW-1VLK-LPS8-2DWS`, the command to run is the following:
>
> ```
> 1
> ```

Once paired, the Edge Gateway appears in the administration console.

## Configuring an NTP time server

It is recommended to set up a time server to keep the system clock up to date. The necessary steps are described [on the NTP configuration page](https://docs.cyberelements.io/saas/sl/Usage/Configuration/EdgeGateway/ConfigureAnNTPServer/).
