# Bareos Centos Rhel Prerequisites

This document describes CentOS / RHEL-specific prerequisites for a BareOS PMK cluster.

## Install the Operating System and Update Packages

Install the latest version of RHEL or CentOS 7.9 and run the following command to update all installed packages.

{% tabs %}
{% tab title="Bash" %}

```bash
yum update
```

{% endtab %}
{% endtabs %}

## [Manual Prerequisite](https://platform9.com/docs/v5.3/kubernetes/bareos-centos-rhel-prerequisites#manual-prerequisite)

The steps below are completed automatically by the [PMK CLI](https://github.com/platform9/pcd-docs-gitbook/blob/main/kubernetes/pmk-cli-overview/README.md). If you would like to complete the prerequisites manually, follow the steps below.

## [Disable firewalld](https://platform9.com/docs/v5.9/kubernetes/bareos-centos-rhel-prerequisites#disable-firewalld)

Users need to disable firewalld, as there is a known incompatibility between firewalld and docker’s use of iptables. You can find more information on this issue on [GitHub](https://github.com/docker/docker/issues/16137). Run the following command to disable firewalld.

{% tabs %}
{% tab title="Bash" %}

```bash
systemctl stop firewalld
systemctl disable firewalld
```

{% endtab %}
{% endtabs %}

## [Disable any other incompatible networking services](https://platform9.com/docs/v5.3/kubernetes/bareos-centos-rhel-prerequisites#disable-any-other-incompatible-networking-services)

Ensure that there is no other external / incompatible networking software running on the node, as it can interfere with docker and Kubernetes networking services.

## [Prepare Docker Storage](https://platform9.com/docs/v5.3/kubernetes/bareos-centos-rhel-prerequisites#prepare-docker-storage)

On CentOS/RHEL 7, docker uses the *devicemapper* storage driver, by default, to manage container images and disk layers. For production, the storage driver must be configured to use *direct-lvm* mode (The *loop-lvm* mode is acceptable for testing but is not supported for production deployments). The *direct-lvm* mode requires one free block device (a disk or a partition).

Follow the steps given below to prepare docker storage on your node.

{% hint style="warning" %}
**Warning**

If docker is currently installed and running on this node, this procedure will result in resetting of container storage for docker. As a result it will end up deleting all existing docker images and containers on the node
{% endhint %}

### [Choose an Existing Block Device or Create a New Block Device](https://platform9.com/docs/v5.3/kubernetes/bareos-centos-rhel-prerequisites#choose-a-existing-block-device-or-create-a-new-block-device)

See the [auto$](https://github.com/platform9/pcd-docs-gitbook/blob/main/kubernetes/kubernetes-cluster-pre-requisites/README.md) for recommendations on the size of the disk or partition.

If a free block device is available on the node, note the path of the block device, e.g., /dev/sdb for a disk, /dev/sdc1 for a partition. You will need to specify it later during creation of the LVM thin pool.

If a free block device is not available, create a new block device, then note the block device path. You can create a block device either by attaching a new disk to the node, or creating a new partition on an existing disk. To create a new partition on a disk, use fdisk (man 8 fdisk) and set the partition type to 8e (Linux LVM). See the [Linux Partition HOWTO](http://tldp.org/HOWTO/Partition/fdisk_partitioning.html) page for more detailed information on creating disk partitions on RHEL/CentOS systems.

### [Create LVM thin pool on the Block Device](https://platform9.com/docs/v5.3/kubernetes/bareos-centos-rhel-prerequisites#create-lvm-thin-pool-on-the-block-device)

Once a free block device is available, follow the steps provided below to create an LVM thin pool on the block device.

#### Step 1.

Ensure that LVM is installed on the host:

{% tabs %}
{% tab title="Bash" %}

```bash
yum list installed lvm2
```

{% endtab %}
{% endtabs %}

#### Step 2.

The *lvm2* package should be listed as installed. If it is not installed, run the following command to install the *lvm2* package.

{% tabs %}
{% tab title="Bash" %}

```bash
yum install lvm2
```

{% endtab %}
{% endtabs %}

#### Step 3.

Download the bash script to create an LVM thin pool from GitHub:

{% tabs %}
{% tab title="Bash" %}

```bash
wget https://raw.githubusercontent.com/platform9/support-locker/master/pmk/bd2tp.sh
```

{% endtab %}
{% endtabs %}

#### Step 4.

Change the file permissions to make the script executable:

{% tabs %}
{% tab title="Bash" %}

```bash
chmod +x bd2tp.sh
```

{% endtab %}
{% endtabs %}

#### Step 5.

Run the script with the path of the free block device chosen or created above and the name of the volume group:

{% tabs %}
{% tab title="Bash" %}

```bash
./bd2tp.sh block_device_name docker-vg
```

{% endtab %}
{% endtabs %}
