Install Red Hat OpenShift on RHEL 9
This guide provides a step-by-step installation of Red Hat OpenShift Container Platform (OCP) on RHEL 9 using User Provisioned Infrastructure (UPI).
1. Prerequisites
- Minimum 3 RHEL 9 servers
- 16 GB RAM minimum per node
- 4 vCPU minimum per node
- Static IP addresses
- Fully Qualified Domain Names (FQDN)
- DNS configured properly
- Load Balancer configured
- Valid Red Hat subscription
- Internet access
2. Configure Hostname
sudo hostnamectl set-hostname master1.ocp.example.com
3. Configure /etc/hosts
sudo vi /etc/hosts
# Add:
192.168.1.10 api.ocp.example.com
192.168.1.11 master1.ocp.example.com
192.168.1.12 master2.ocp.example.com
192.168.1.13 master3.ocp.example.com
4. Register RHEL System
sudo subscription-manager register
sudo subscription-manager attach --auto
5. Enable Required Repositories
sudo subscription-manager repos \
--enable=rhel-9-for-x86_64-baseos-rpms \
--enable=rhel-9-for-x86_64-appstream-rpms
6. Update the System
sudo dnf update -y
sudo reboot
7. Install Required Packages
sudo dnf install -y wget git vim podman jq
8. Download OpenShift Installer
wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-install-linux.tar.gz
tar -xvf openshift-install-linux.tar.gz
sudo mv openshift-install /usr/local/bin/
9. Download OC Client
wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv oc kubectl /usr/local/bin/
10. Verify Installation Tools
openshift-install version
oc version
kubectl version --client
11. Create OpenShift Installation Directory
mkdir ~/openshift-install
cd ~/openshift-install
12. Generate Install Configuration
openshift-install create install-config
13. Create Cluster
openshift-install create cluster --dir=~/openshift-install --log-level=info
14. Access OpenShift Web Console
https://console-openshift-console.apps.ocp.example.com
15. Login Using OC CLI
oc login -u kubeadmin -p \
https://api.ocp.example.com:6443
16. Verify Cluster Nodes
oc get nodes
oc get pods -A
17. Configure Firewall (Optional)
sudo firewall-cmd --permanent --add-port=6443/tcp
sudo firewall-cmd --permanent --add-port=22623/tcp
sudo firewall-cmd --reload
18. Optional Post Installation Tasks
- Configure storage classes
- Configure ingress
- Install Operators
- Configure monitoring
- Configure authentication
- Create projects and users