DEV Community

Ken Moini
Ken Moini

Posted on

Lightweight DevOps Host with Red Hat Enterprise Linux

I am exceptionally bad at this 100 Days of Code thing.

Not that I haven't been coding most of these days, but it just hasn't been fun, or sexy, or something to share. NO ONE WANTS TO READ ABOUT A DMARC MICROSERVICE, TRUST ME I'VE TRIED.

Booooooring

Anywho, here I am today in a new series that should hopefully be good for my own documentation as well. I'm in the process of deploying a new educational platform and it's all containerized, based on microservices deployed into a Kubernetes cluster, with sprinkles on top, and blah blah.

Thing is, I'm building this out in my home lab to avoid spending an extra hundred dollars in the cloud. So if you've got some hardware and time and want to do the same, I'll take you from Zero to Hero with this whole DevOps thing.

The Metal

So you can probably run this on anything really, but I'm going to start with a dedicated host and turn it into a container and virtualisation host. It's a simple Dell R620 with never enough Cores or RAM. The host sits on my internal network behind a pfSense router. It's got a static IP of 192.168.42.10 and we'll give it a hostname of thebus.kemo.labs.

Note that kemo.labs is not a valid TLD - that's ok. I have that domain resolved and routed via my pfSense router, you could do the same with DNSMASQ or BIND.

RHEL, RHEL, RHEL, we meet again

So this time I decided against going with Proxmox for the container/VM host to get closer to what my intended production environment will be like, which will be a Kubernetes/OpenShift cluster running CentOS/Red Hat Universal Basic Image (UBI) containers.

So some might want to just grab CentOS, which of course would work, but why not get your own free copy of Red Hat Enterprise Linux? How does one procure one of these free copies? Why, wouldn't you like to know...

Ok, so simply enough, one just needs to register with the Red Hat Developers site, and grab your very own yearly Red Hat Developer Suite subscription. It expires yearly, but it's still just a free renewal and gives you access to Red Hat Enterprise Linux, the Middleware offerings, and more.

So grab your subscription, download the ISO (I'll be using RHEL 7), and get it installed - so far that's the easy part.

Basic Provisioning

Now that we've got our Red Hat Enterprise Linux (RHEL) host set up, you're staring at the log in terminal, jumped into your privileged user, and are now at a shell. Let's bless this mess a scootch...

# Elevate to root
sudo -i

# In case you need to still register/attach a subscription
subscription-manager register
subscription-manager attach --auto-attach

# Enable repos
subscription-manager repos --enable=rhel-7-server-supplementary-rpms --enable=rhel-7-server-rpms --enable=rhel-7-server-optional-rpms --enable=rhel-7-server-ansible-2.9-rpms --enable=rhel-7-server-extras-rpms

# Update system and reboot to pull in new kernels
yum update -y
systemctl reboot

# Install needed packages
yum install -y wget curl git nano ca-certificates cockpit cockpit-dashboard cockpit-docker cockpit-machines cockpit-packagekit cockpit-shell ansible docker docker-selinux libvirt-client

# Install Docker Compose
curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

# Set Firewall Options
firewall-cmd --add-service=ssh
firewall-cmd --add-service=cockpit

# Set services
systemctl enable cockpit && systemctl start cockpit
systemctl enable docker && systemctl start docker

So with alllll of that, we've done a few things:

  1. Logged in, elevated to root
  2. Used subscription-manage to register the system and attach your subscription.
  3. Enabled the needed repositories, updated packages, and rebooted
  4. Installed a few things:
    • Base system packages such as curl, git, and nano
    • Ansible, Docker, and the virsh (via libvirt-client)
    • Cockpit and some modules for Cockpit - it's a Web UI that'll make your life sooooo much easier
  5. Installed Docker Compose
  6. Set firewall options for SSH access and Cockpit (exposed on port 9090)
  7. Enabled and started Cockpit and Docker

And now with that, we have our own RHEL host that is ready to run a bunch of Containers, Virtual Machines, and Web UI with Cockpit to manage it all!

Great success

Join me in the next part of this series where I show how to install GitLab in a VM and Minio in a Docker container for local S3-compatible storage.

Top comments (3)

Collapse
 
mjraadi profile image
Mohammadjavad Raadi

I use proxmox on a daily basis and it's been great. I'd love to read and learn more about this setup and what you can do with OpenShift. Thanks

Collapse
 
kenmoini profile image
Ken Moini

Yeah, Proxmox is great! Have used it for years in my home lab. I'll be sure to post some more OpenShift articles, I use it daily in my job so I'll be happy to share if you're interested!

Collapse
 
mjraadi profile image
Mohammadjavad Raadi

would love that.