> ## 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 9.x

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

This document describes the installation of Kubernetes, Docker or Containerd, Mongodb applications on RHEL (Red Hat Enterprise Linux) 9.x operating systems. It can also be applied to Rocky Linux 9.x 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.

Kubernetes, Mongodb and Elasticsearch installation files for Rhel 9.x operating system:
https://fss.apinizer.com/index.php/s/HZztMxazPsJY09P
```

```bash theme={null}
sudo tar xvf K8S-1.31-Rhel9.x-Offline.tar
```

```bash theme={null}
# Firewall is turned off
sudo systemctl stop firewalld
sudo systemctl disable firewalld

# SELinux is disabled to prevent communication problems on servers.
sudo setenforce 0
sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config

# Swap is turned off and the swap line in /etc/fstab file is deleted to prevent it from restarting.
sudo swapoff -a
sudo vi /etc/fstab
```

## 1) Installing Containerd and Required Packages

```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

#starting containerd module
sudo systemctl restart containerd
sudo systemctl enable containerd
systemctl status containerd
```

<Warning>
  **runc conflicts**

  If containerd service is not found after installations are completed, package conflicts can be checked with the following command.

  ```bash theme={null}
  [apinizer@redhat ~]$ sudo rpm -ivh required_rpms/containerd.io-1.6.32-3.1.el8.x86_64.rpm
  warning: required_rpms/containerd.io-1.6.32-3.1.el8.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
  error: Failed dependencies:
          runc conflicts with containerd.io-1.6.32-3.1.el8.x86_64
          runc is obsoleted by containerd.io-1.6.32-3.1.el8.x86_64
  ```

  If there is a package conflict:

  ```bash theme={null}
  sudo yum remove -y runc
  # Installation is done again.
  sudo yum install -y --cacheonly --disablerepo=* required_rpms/*.rpm --skip-broken
  ```
</Warning>

## 2) Installing Kubernetes Packages

```bash theme={null}
sudo modprobe overlay
sudo modprobe br_netfilter
sudo tee /etc/modules-load.d/k8s.conf <<EOF
overlay
br_netfilter
EOF
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
```

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

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

```bash theme={null}
systemctl enable --now kubelet.service
#Kubernetes installation check
kubectl version --client && kubeadm version
```

## 3) Installing Kubernetes Images

```bash theme={null}
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
```

You can decide which package to use for Overlay Network installation and install only that, it is recommended to install flannel by default.

```bash theme={null}
#Flannel packages
sudo ctr --namespace k8s.io images import kube_images/flannel-cni-plugin-v1.6.0.tar
sudo ctr --namespace k8s.io images import kube_images/flannel-v0.26.1.tar

#Calico packages
sudo ctr --namespace k8s.io images import kube_images/calico-kube-controllers-v3.30.2.tar
sudo ctr --namespace k8s.io images import kube_images/calico-cni-v3.30.2.tar
sudo ctr --namespace k8s.io images import kube_images/calico-node-v3.30.2.tar
```

<Info>
  Although Kubernetes uses pause 3.10, containerd stays at 3.8 and this situation may cause the cluster not to start during kubeadm init operation. To fix this, you can change the pause version to 3.10 in the configuration file in `/etc/containerd`.
</Info>

## 4) Kubeadm Init

Since this Node is the first Node in the cluster, it will be selected as Kubernetes Control Plane.

```bash theme={null}
sudo kubeadm init --pod-network-cidr="10.244.0.0/16" --control-plane-endpoint="<MASTER_SERVER_IP_ADDRESS>" --upload-certs --kubernetes-version=v1.31.4
```

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

**To include worker node in cluster:**

You can run the following command on **master node** to get the command to include in cluster as output.

```bash theme={null}
kubeadm token create --print-join-command
```

## 5) Creating Flannel

```bash theme={null}
ls
```

Confirm that kube-flannel.yml coming from the .tar file you downloaded at the beginning of the document is found using the command.

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

## 6) Installing Apinizer Images

```bash theme={null}
sudo tar xvf 2025.01.4.tar
```

```bash theme={null}
sudo ctr --namespace k8s.io images import manager-2025.01.4.tar apinizercloud/manager:2025.01.4
sudo ctr --namespace k8s.io images import worker-2025.01.4.tar apinizercloud/worker:2025.01.4
sudo ctr --namespace k8s.io images import cache-2025.01.4.tar apinizercloud/cache:2025.01.4
sudo ctr --namespace k8s.io images import integration-2025.01.4.tar apinizercloud/integration:2025.01.4
sudo ctr --namespace k8s.io images import portal-2025.01.4.tar apinizercloud/portal:2025.01.4
```

## 7) Installing MongoDB

Performs installations found in **mongo\_rpms** directory.

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

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

## 8) Elasticsearch Installation

```bash theme={null}
sudo mkdir /opt/elasticsearch
# Move the file inside the offline installation folders.
sudo mv elasticsearch/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.

## 9) Apinizer Installation

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