Building and Installing the MicroShift RPMs

Building and installing the MicroShift RPMs for local development

Building the RPMs

MicroShift binary with systemd unit file and the required SELinux submodule can be built as an RPM using make on an RPM-based distribution.

Install the MicroShift build dependencies and the RPM specific build-time packages.

sudo dnf install -y git golang rpm-build selinux-policy-devel container-selinux

Clone the repository and cd into it:

git clone -b 4.8.0-microshift-2022-04-20-141053 https://github.com/openshift/microshift.git
cd microshift

Build the SELinux and MicroShift RPMs with:

make rpm

RPMs will be placed in ./packaging/rpm/_rpmbuild/RPMS/. There are two RPMs that will be required to install:

packaging/rpm/_rpmbuild/RPMS/noarch/microshift-selinux-*
packaging/rpm/_rpmbuild/RPMS/x86_64/microshift-*

Installing the RPMs

Enable the CRI-O repository:

command -v subscription-manager &> /dev/null \
    && subscription-manager repos --enable rhocp-4.8-for-rhel-8-x86_64-rpms

sudo dnf module enable -y cri-o:1.21

sudo dnf module enable -y cri-o:1.21

Install the MicroShift and the SELinux policies:

sudo dnf localinstall -y packaging/rpm/_rpmbuild/RPMS/noarch/microshift-selinux-*
sudo dnf localinstall -y packaging/rpm/_rpmbuild/RPMS/x86_64/microshift-*

Running the RPMs

Start CRI-O and MicroShift services:

sudo systemctl enable crio --now
sudo systemctl enable microshift --now

To install OpenShift and Kubernetes clients, follow Getting Started: Install Clients.

To configure the kubeconfig, follow Getting Started: Copy Kubeconfig.

It is now possible to run oc or kubectl commands against the MicroShift environment.

Verify that MicroShift is running:

oc get pods -A

You can stop MicroShift service with systemd:

sudo systemctl stop microshift

Check MicroShift with

sudo podman ps
sudo critcl ps

For more on running MicroShift, refer to the user documentation