> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation on RHEL 8.x

> This document describes the installation of Kubernetes, Docker or Containerd, Mongodb applications on RHEL (Red Hat Enterprise Linux) 8.4, 8.6 and 8.9 operating systems.

This document describes the installation of Kubernetes, Docker or Containerd, Mongodb applications on RHEL (Red Hat Enterprise Linux) 8.4, 8.6 and 8.9 operating systems. It can also be applied to Rocky Linux 8.4, 8.6 and 8.9 distributions.

<Warning>
  If possible, always use the latest version of your chosen operating system and install the latest versions of servers and packages to be installed with internet access.
</Warning>

## File to Download

```bash theme={null}
Please contact us at support@apinizer.com email address for the download link of Apinizer images' latest version.

For installation of Kubernetes, Docker, Mongodb and Elasticsearch applications on Rhel 8.4 and 8.6 operating systems:
File name: offlineApinizerInstallation-RedHat86.tar (1.61 GB)
Download link: https://drive.google.com/file/d/1nTcklCjpmVhPRjSiPMo-XK7nsTNtHv5o

For installation of Kubernetes, Containerd, Mongodb and Elasticsearch applications on Rhel 8.9 operating system:
File name: offlineApinizerInstallation-RHEL89.tar (1.4 GB)
Download link: https://fss.apinizer.com/index.php/s/uOXiPzhsEB8DQXJ
```

<Info>
  The instructions found in the next steps are also available in the relevant files and are shared here clearly for servers that may have limited internet access.

  We can use `tar xvzf dosyaAdi.tar` or `tar xf dosyaAdi.tar` commands to extract files.
</Info>

First, to avoid automatic subscription error, go to the following line and set **enabled 0**.

```bash theme={null}
vim /etc/yum/pluginconf.d/subscription-manager.conf
enabled=0
```

net-tools package is installed only on Rhel-8.4 or Rhel-8.6.

```bash theme={null}
cd offlineApinizerInstallation-RedHat86
yum install -y --cacheonly --skip-broken --disablerepo=* *.rpm
```

### Apinizer user is created

```bash theme={null}
adduser apinizer
usermod -aG wheel apinizer
passwd apinizer
```

### Firewall is turned off

```bash theme={null}
sudo systemctl stop firewalld
sudo systemctl disable firewalld
```

### SELinux is turned off

Let's disable SELinux to prevent communication problems on servers.

```bash theme={null}
sudo setenforce 0
sudo sed -i 's/^SELINUX=enforcing$/SELINUX=disabled/' /etc/selinux/config
```

### Swap is disabled

Let's disable **swap** to prevent communication problems on nodes. For this, the following steps are done. and the swap line in **/etc/fstab** file is deleted.

```bash theme={null}
sudo swapoff -a
sudo vi /etc/fstab
```

### IP Tables setting

Then close the vi file (:wq).

```bash theme={null}
sudo vi /etc/sysctl.d/k8s.conf
```

Add the following content:

```
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward=1
net.ipv4.tcp_max_syn_backlog=40000
net.core.somaxconn=40000
net.core.wmem_default=8388608
net.core.rmem_default=8388608
net.ipv4.tcp_sack=1
net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_fin_timeout=15
net.ipv4.tcp_keepalive_intvl=30
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_moderate_rcvbuf=1
net.core.rmem_max=134217728
net.core.wmem_max=134217728
net.ipv4.tcp_mem=134217728 134217728 134217728
net.ipv4.tcp_rmem=4096 277750 134217728
net.ipv4.tcp_wmem=4096 277750 134217728
net.core.netdev_max_backlog=300000
```

### Changes are saved

```bash theme={null}
sudo modprobe br_netfilter
sudo sysctl --system
```

### br\_netfilter Module is Loaded (→ Reboot)

```bash theme={null}
sudo lsmod | grep br_netfilter
sudo reboot
```

## Docker Installation (Only in RHEL 8.4 and 8.6 installations)

<Warning>
  Before starting Docker installation, the following packages need to be deleted.

  ```bash theme={null}
  yum remove podman* -y
  yum remove buildah* -y
  ```
</Warning>

```bash theme={null}
cd <InstallationDirectory>/docker
rpm -ivh --replacefiles --replacepkgs *.rpm

# Create required directories
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo mkdir -p /etc/docker

# Create daemon json config file
sudo tee /etc/docker/daemon.json <<EOF
{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2",
  "storage-opts": ["overlay2.override_kernel_check=true"]
}
EOF

# Start and enable Services
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl enable docker
sudo usermod -aG docker apinizer
```

## Containerd Installation (Only in RHEL 8.9 installation)

```bash theme={null}
sudo yum install -y --cacheonly --disablerepo=* required_rpms/*.rpm --skip-broken
```

```bash theme={null}
#containerd module settings
sudo mkdir -p /etc/containerd
sudo containerd config default | sudo tee /etc/containerd/config.toml
sudo sed -i 's/SystemdCgroup = false/SystemdCgroup = true/g' /etc/containerd/config.toml

#initializing and starting the containerd module
sudo systemctl restart containerd
sudo systemctl enable containerd
systemctl status containerd
```

## Kubernetes Installation

Go to apinizerOffline/kubernetes folder and run rpms.

```bash theme={null}
cd apinizerOffline/kubernetes
rpm -ivh --replacefiles --replacepkgs *.rpm
```

**(On Master and Worker Servers)**

Kubernetes images in .tar format are loaded to docker.

```bash theme={null}
#If you are using RHEL 8.4 or 8.6
docker load < kube-apiserver_v1.18.20.tar
docker load < kube-proxy_v1.18.20.tar
docker load < kube-controller-manager_v1.18.20.tar
docker load < kube-scheduler_v1.18.20.tar
docker load < pause_3.2.tar
docker load < etcd_3.4.3-0.tar
docker load < coredns.tar
docker load < flannel_v0.13.1-rc2.tar
docker load < rancher.tar
docker load < rancher2.tar
docker load < metricserver.tar

#If you are using RHEL 8.9
sudo ctr --namespace k8s.io images import kube_images/kube-apiserver-v1.31.4.tar
sudo ctr --namespace k8s.io images import kube_images/kube-controller-manager-v1.31.4.tar
sudo ctr --namespace k8s.io images import kube_images/kube-scheduler-v1.31.4.tar
sudo ctr --namespace k8s.io images import kube_images/kube-proxy-v1.31.4.tar
sudo ctr --namespace k8s.io images import kube_images/pause-3.10.tar
sudo ctr --namespace k8s.io images import kube_images/etcd-3.5.15-0.tar
sudo ctr --namespace k8s.io images import kube_images/coredns-v1.11.3.tar
sudo ctr --namespace k8s.io images import kube_images/flannel-cni-plugin-v1.6.2.tar
sudo ctr --namespace k8s.io images import kube_images/flannel-v0.26.4.tar
```

```bash theme={null}
systemctl enable kubelet && systemctl start kubelet
```

**(On Master Node)**

```bash theme={null}
#If you are using RHEL 8.4 or 8.6
sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=<MASTER_SERVER_IP_ADDRESS> --kubernetes-version=v1.18.20

#If you are using RHEL 8.9
sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=<MASTER_SERVER_IP_ADDRESS> --kubernetes-version=v1.31.4
```

**(On Master Node)**

```bash theme={null}
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown -R $(id -u):$(id -g) $HOME/.kube
```

```bash theme={null}
kubectl apply -f kube-flannel.yml
```

## Loading Apinizer Images to Kubernetes (On Worker nodes)

```bash theme={null}
cd apinizerOffline/apinizerImages

#If you are using RHEL 8.4 or 8.6
docker load < manager_<APINIZER_VERSION>.tar
docker load < worker_<APINIZER_VERSION>.tar
docker load < cache_<APINIZER_VERSION>.tar
docker load < integration_<APINIZER_VERSION>.tar
docker load < portal_<APINIZER_VERSION>.tar

#If you are using RHEL 8.9
sudo ctr --namespace k8s.io images import manager-<APINIZER_VERSION>.tar apinizercloud/manager:<APINIZER_VERSION>
sudo ctr --namespace k8s.io images import worker-<APINIZER_VERSION>.tar apinizercloud/worker:<APINIZER_VERSION>
sudo ctr --namespace k8s.io images import cache-<APINIZER_VERSION>.tar apinizercloud/cache:<APINIZER_VERSION>
sudo ctr --namespace k8s.io images import integration-<APINIZER_VERSION>.tar apinizercloud/integration:<APINIZER_VERSION>
sudo ctr --namespace k8s.io images import portal-<APINIZER_VERSION>.tar apinizercloud/portal:<APINIZER_VERSION>
```

## MongoDB Installation

```bash theme={null}
sudo yum install -y --cacheonly --skip-broken --disablerepo=* <MONGODB_RPM_DIRECTORY>/*.rpm
rpm -ivh --replacefiles --replacepkgs <MONGODB_RPM_DIRECTORY>/*.rpm
```

You can continue from [MongoDB Installation on Red Hat Operating System](/en/setup/mongodb/rhel-mongodb) document for MongoDB configurations after installation.

## Elasticsearch Installation

Elasticsearch package is extracted to target folder.

```bash theme={null}
sudo mkdir /opt/elasticsearch
# Move the file inside the offline installation folders.
sudo mv <ELASTICSEARCH_DIRECTORY>/elasticsearch-7.9.2-linux-x86_64.tar.gz /opt/elasticsearch/
cd /opt/elasticsearch
sudo tar -xzf elasticsearch-7.9.2-linux-x86_64.tar.gz
```

After moving the installation file from its directory to /opt/elasticsearch/ folder, you can perform configurations from [Elasticsearch Installation on Red Hat Operating System](/en/setup/elasticsearch/rhel-elasticsearch) page.

## Apinizer Installation

You can perform Apinizer installation from [Apinizer Installation and Configuration](/en/setup/apinizer/apinizer) page.
