Step-by-Step Guide to Installing and Configuring OpenShift Origin PaaS on Ubuntu 18.04

OpenShift is a free and open-source Platform-as-a-Service developed by Red Hat. It is used to develop, host, and scale applications in a cloud environment. OpenShift supports a wide range of languages such as Java EE6, Ruby, PHP, Python, Perl, MongoDB, MySQL, and PostgreSQL. It has become a leading cloud and enterprise Kubernetes application platform, trusted by over 1,000 companies. OpenShift allows customization and deployment of applications according to specific needs.

In this tutorial, we will walk through how to install a single-node OpenShift Origin on an Ubuntu 18.04 LTS server.

Requirements

  • A server with Ubuntu 18.04, at least 2 GB RAM.
  • The server must have a root password configured.

Getting Started

Before beginning, update your system to the latest stable versions. Execute the following commands:

apt-get update -y
apt-get upgrade -y

After updating, restart your server to incorporate all the configuration changes.

Install Docker CE

OpenShift runs on Docker containers, so Docker CE needs to be installed. The latest Docker CE version is unavailable in the default Ubuntu 18.04 repository. Therefore, you must add the Docker CE repository to your system first.

Begin by downloading and adding the Docker GPG key with this command:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -

Then, add the Docker CE repository with:

add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Next, update your package index again and install Docker CE:

apt-get update -y
apt-get install docker-ce -y

Verify Docker CE’s status using:

systemctl status docker

The expected output should confirm Docker is active and running.

Install OpenShift

First, download the latest stable OpenShift version from its Git repository. Use the following command:

cd /opt
wget https://github.com/openshift/origin/releases/download/v3.9.0/openshift-origin-client-tools-v3.9.0-191fece-linux-64bit.tar.gz

Once downloaded, extract the file:

tar -zvxf openshift-origin-client-tools-v3.9.0-191fece-linux-64bit.tar.gz

Change to the extracted directory and move the oc binary to /usr/local/bin:

cd openshift-origin-client-tools-v3.9.0-191fece-linux-64bit
cp oc /usr/local/bin/

Verify the installed version with:

oc version

You should see the version details for oc.

Next, modify the Docker daemon to add an insecure registry:

nano /etc/docker/daemon.json

Insert the following lines:

{
    "insecure-registries" : [ "172.30.0.0/16" ]
}

Save and close the file. Restart Docker to apply changes:

systemctl restart docker

Start OpenShift Cluster

Start your OpenShift cluster by specifying an IP address or hostname:

oc cluster up --public-hostname=YOUR_IP_ADDRESS

On successful start, the output will confirm that OpenShift is running and accessible via web console.

Replace YOUR_IP_ADDRESS with your actual server IP. Log in as the administrator:

oc login -u system:admin

The command will show the accessible projects and allow switching between them.

Create a Test Project on OpenShift

With OpenShift installed, log in with the developer user:

oc login

Supply the username and password as developer and log in. Create a new test project:

oc new-project dev --display-name="test - Dev" --description="Test Project"

To build a Ruby application within this project, use:

oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git

Check the current project’s status:

oc status

Access OpenShift Web Console

Open your web browser and go to https://your-server-ip:8443. Log in with your credentials to access the OpenShift dashboard.

OPENSHIFT Login

Navigate through projects and view deployed applications as needed.

Congratulations! You have successfully installed and configured OpenShift on an Ubuntu 18.04 server. You can now create and deploy your applications. Please note that this setup is not recommended for production use. Visit OpenShift’s official documentation for more information.

FAQ

What is OpenShift?
OpenShift is an open-source Platform-as-a-Service (PaaS) that allows developers to build, host, and scale applications in a cloud environment.
What are the hardware requirements for OpenShift on Ubuntu 18.04?
A minimum of 2 GB RAM is required.
Is Docker CE necessary for OpenShift?
Yes, OpenShift operates on Docker containers, making Docker CE essential.
Can OpenShift be used in a production environment?
The setup in this guide is meant for learning and testing purposes. For production use, it is recommended to refer to the official OpenShift documentation.
How can I access the web console of OpenShift?
The web console can be accessed via https://your-server-ip:8443 in a web browser.