# Linux

:::tip This section provides the installation steps for the ElastiFlow Unified SNMP Collector. Many users get started using ElastiFlow with the Elastic Stack (Elasticsearch and Kibana). To install and configure the Elastic Stack step-by-step instructions are provided for both **Ubuntu/Debian** and **RedHat/CentOS**. :::

The ElastiFlow Unified SNMP Collector can be installed natively on Linux. Packages are currently provided for and supported on the Linux distributions and versions listed in the following table.

| Distribution  | Versions                        |
| ------------- | ------------------------------- |
| Ubuntu/Debian | 18.04 LTS, 20.04 LTS, 22.04 LTS |
| RHEL/CentOS   | 7.x, 8.x                        |

### Ubuntu/Debian Installation (deb)

The Debian package for the Unified SNMP Collector can be downloaded from [here](https://elastiflow-releases.s3.us-east-2.amazonaws.com/snmp-collector/snmp-collector_6.4.2_linux_amd64.deb). It can be used for installation on most Debian-based systems such as Debian and Ubuntu.

#### Download the `.deb` Package

The package can be easily downloaded using either the `wget` or `curl` command:

```shell
wget https://elastiflow-releases.s3.us-east-2.amazonaws.com/snmp-collector/snmp-collector_6.4.2_linux_amd64.deb
```

```shell
curl https://elastiflow-releases.s3.us-east-2.amazonaws.com/snmp-collector/snmp-collector_6.4.2_linux_amd64.deb --output snmp-collector_6.4.2_linux_amd64.deb
```

#### Verify the Package

**Checksum Verification**

To ensure the downloaded file was fully downloaded and wasn't corrupted or tampered with, you can verify the provided checksum matches.

```shell
# get checksum of the downloaded file:
sha256sum snmp-collector_6.4.2_linux_amd64.deb

# verify the checksum provided from the previous command matches the checksum here:
https://elastiflow-releases.s3.us-east-2.amazonaws.com/snmp-collector/snmp-collector_6.4.2_linux_amd64.deb.sha256
```

**GPG Verification**

ElastiFlow signs the Debian package with a GNU Privacy Guard (GPG) key. To verify the Debian package, download and import the ElastiFlow GPG public key:

```shell
curl -o- https://elastiflow-releases.s3.us-east-2.amazonaws.com/elastiflow.pgp | gpg --import -
```

Next, download the signature file:

```shell
curl -SLO https://elastiflow-releases.s3.us-east-2.amazonaws.com/snmp-collector/snmp-collector_6.4.2_linux_amd64.deb.sig
```

Finally, verify the file with the signature:

```shell
gpg --verify snmp-collector_6.4.2_linux_amd64.deb.sig snmp-collector_6.4.2_linux_amd64.deb
```

#### Ensure that `libpcap-dev` is Installed

The collector requires `libpcap-dev`. Check if the `libpcap-dev` package is installed:

```shell
sudo dpkg-query -l | grep libpcap-dev
```

If installed, the output will look similar to the follow:

```shell
ii  libpcap-dev:amd64      1.9.1-3      amd64      development library for libpcap (transitional package)
```

If it is not present, install it:

```shell
apt install libpcap-dev
```

#### Install the `.deb` Package

There are two methods to install the Unified SNMP Collector package, `apt` or `dpkg`.

**Install with `apt`**

```shell
sudo apt install ./snmp-collector_6.4.2_linux_amd64.deb
```

**Install with `dpkg`**

```shell
sudo dpkg -i snmp-collector_6.4.2_linux_amd64.deb
```

### RedHat/CentOS Installation (rpm)

The RPM package for the Unified SNMP Collector can be downloaded from [here](https://elastiflow-releases.s3.us-east-2.amazonaws.com/snmp-collector/snmp-collector-6.4.2-1.x86_64.rpm). It can be used for installation on most RedHat-based systems such as RHEL and CentOS.

#### Download the `.rpm` Package

The package can be easily downloaded using `wget` or `curl`:

```shell
wget https://elastiflow-releases.s3.us-east-2.amazonaws.com/snmp-collector/snmp-collector-6.4.2-1.x86_64.rpm
```

```shell
curl https://elastiflow-releases.s3.us-east-2.amazonaws.com/snmp-collector/snmp-collector-6.4.2-1.x86_64.rpm --output snmp-collector-6.4.2-1.x86_64.rpm
```

#### Verify the Package

**Checksum Verification**

To ensure the downloaded file was fully downloaded and wasn't corrupted or tampered with, you can verify the provided checksum matches.

```shell
# get checksum of the downloaded file:
sha256sum snmp-collector-6.4.2-1.x86_64.rpm

# verify the checksum provided from the previous command matches the checksum here:
https://elastiflow-releases.s3.us-east-2.amazonaws.com/snmp-collector/snmp-collector-6.4.2-1.x86_64.rpm.sha256
```

**GPG Verification**

ElastiFlow signs the RPM package with a GNU Privacy Guard (GPG) key. To verify the RPM package, download and import the ElastiFlow GPG public key:

```shell
# import public key into gpg keychain
curl -o- https://elastiflow-releases.s3.us-east-2.amazonaws.com/elastiflow.pgp | gpg --import -
# trust the public key
echo "6A2E26EFDE24AA7A634A442ED5C0572E5D212F6B:6:" | gpg --import-ownertrust
# import public key into rpm trust store
rpm --import https://elastiflow-releases.s3.us-east-2.amazonaws.com/elastiflow.pgp
```

Next, download the signature file:

```shell
curl -SLO https://elastiflow-releases.s3.us-east-2.amazonaws.com/snmp-collector/snmp-collector-6.4.2-1.x86_64.rpm.sig
```

Finally, verify the file with the signature:

```shell
gpg --verify snmp-collector-6.4.2-1.x86_64.rpm.sig snmp-collector-6.4.2-1.x86_64.rpm
```

#### Ensure that `libpcap-dev` is Installed

The Unified SNMP Collector package can be installed using `yum`. The collector requires that `libpcap-devel` also be installed.

**Install `libpcap` & `libpcap-devel` on RHEL/CentOS 7.x**

```shell
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libpcap-1.5.3-12.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libpcap-devel-1.5.3-12.el7.x86_64.rpm
```

```shell
sudo yum install -y ./libpcap-1.5.3-12.el7.x86_64.rpm
sudo yum install -y ./libpcap-devel-1.5.3-12.el7.x86_64.rpm
```

**Install `libpcap` & `libpcap-devel` on RHEL/CentOS 8.x**

```shell
sudo dnf --enablerepo=powertools install libpcap -y
sudo dnf --enablerepo=powertools install libpcap-devel -y
```

#### Install/Upgrade the `.rpm` Package

If installing the Unified SNMP Collector package for the first time, i.e. NOT upgrading, run the following:

```shell
sudo yum install -y snmp-collector-6.4.2-1.x86_64.rpm
```

If upgrading from a previously installed Unified SNMP Collector package, run the following:

```shell
sudo rpm -Uhv snmp-collector-6.4.2-1.x86_64.rpm
```

### Configuration

The Unified SNMP Collector will be installed to run as a daemon manged by `systemd`. Configuration of the collector is provided via environment variables and, depending on the enabled options, via various configuration files which by default are located within `/etc/elastiflow`.

To configure the environment variables, edit the file `/etc/systemd/system/snmpcoll.service.d/snmpcoll.conf`. For details on all of the configuration options, please refer to the Configuration Reference.

:::tip At a minimum the Unified SNMP Collector must point to a valid data store. The most common installation uses Elasticsearch and Kibana as the data store.

To install and configure the Elastic Stack step-by-step instructions are provided for both **Ubuntu/Debian** and **RedHat/CentOS**. :::

### Running the Collector

To start the collector, execute the follow commands:

```shell
sudo systemctl daemon-reload && sudo systemctl start snmpcoll.service
```

To ensure the collector has started and is running, execute:

```shell
sudo systemctl status snmpcoll.service
```

The collector can be stopped using:

```shell
sudo systemctl stop snmpcoll.service
```

If you want the collector to be started automatically when the system is booted, it must be enabled:

```shell
sudo systemctl enable snmpcoll.service
```
