In the previous tutorial, I showed you how to install OpenShift using Docker and oc tool on macOS, installing OpenShift using these two tools on CentOS has some differences. I will guide you in this tutorial!
First, you need to install the Docker.
For oc tool, you just need to download its latest version at https://github.com/openshift/origin/releases and extract it.
Similar to installing OpenShift on macOS, we need to configure an insecure-registry with 172.30.0.0/16 address in Docker’s daemon.json configuration file.
Please open Terminal and go to /etc/docker/ directory, then open the daemon.json file to configure this 172.30.0.0/16 address, as follows:
1 2 3 4 5 |
{ "insecure-registries": [ "172.30.0.0/16" ] } |
Please restart Docker after running this command:
1 |
sudo service docker restart |
Another thing we need to do to install OpenShift on CentOS using Docker and oc tool is that we need to make sure that the CentOS firewall allows the Docker containers access OpenShift master API (8443/tcp) and DNS (53/udp).
To do this, you need to check the Docker bridge network container subnet by running the following command:
1 |
sudo docker network inspect -f "{{range .IPAM.Config }}{{ .Subnet }}{{end}}" bridge |
The result of this command should be 172.17.0.0/16.
Then you run the following commands to create the firewall zone and assign access to it, to OpenShift master API and DNS ports:
1 |
firewall-cmd --permanent --new-zone dockerc |
1 |
firewall-cmd --permanent --zone dockerc --add-source 172.17.0.0/16 |
1 |
firewall-cmd --permanent --zone dockerc --add-port 8443/tcp |
1 |
firewall-cmd --permanent --zone dockerc --add-port 53/udp |
1 |
firewall-cmd --permanent --zone dockerc --add-port 8053/udp |
1 |
firewall-cmd --reload |
Result:
Now you can run the oc cluster up command.
Please open Terminal and go to the extracted folder of the oc tool and run the following command:
1 |
sudo ./oc cluster up |
Result:
Now you can use the oc tool or web console tool to login to OpenShift!