Lab template: CentOS 7.2

Recently I’ve been working in a couple of different / disconnected labs. This means I’m managing a couple copies of all my templates manually. Sometimes its hard to find the right section of my notes depending on when/where I’m working on the lab, so I decided to post a couple quick blog posts so I can always find them. The following notes are for creating a template based on CentOS 7.2, and include notes on setting a static IP and joining to the domain with pbis-open (formerly likewise-open).

Special thanks to http://www.tecmint.com/things-to-do-after-minimal-rhel-centos-7-installation/… which showed me how to get ifconfig in my minimal install. I’m not sure who decides what makes the cut for minimal installations, but ifconfig and nslookup seem like they should be in to me.

Install CentOS 7.2 Minimal install from ISO image (http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso), accepting all defaults. Create an administrator account named hostadmin during the install.

Once the install is complete, login as hostadmin. Switch to root and set a password for the root user.

sudo su -
passwd

In my testing, the VM did not get an IP address from DHCP, even though DHCP was available and working. To get online I had to change ONBOOT=no to ONBOOT=yes in the file:

vi /etc/sysconfig/network-scripts/ifcfg-eno16777984

I then restarted networking to bring the interface back up with an IP:

service network restart

Now that I have an IP, I update/upgrade my installation and install some handy/useful packages:

yum update && yum upgrade
yum install net-tools bind-utils nano ntp wget -y

Get the template ready for PowerBroker Identity Services (formerly likewise-open) domain joins:

rpm --import http://repo.pbis.beyondtrust.com/yum/RPM-GPG-KEY-pbis
wget -O /etc/yum.repos.d/pbiso.repo http://repo.pbis.beyondtrust.com/yum/pbiso.repo
yum clean all
yum install pbis-open

At this point, I shutdown the VM and convert it to a template. When I’m ready to use the VM, I deploy a copy from template and follow the remaining steps.

If needed, set a static IP by updating the following file… this is the same file we edited earlier to enable DHCP:

nano /etc/sysconfig/network-scripts/ifcfg-eno16777984

For Static IP, remove bootproto=dhcp, and add the following

IPADDR="192.168.0.101"
PREFIX="24"
GATEWAY="192.168.0.1"
DNS1="192.168.0.20"
SEARCH="lab.enterpriseadmins.org"

Verify that the hostname is properly set:

nano /etc/hostname

Join the Linux VM to the domain and create a DNS record:

domainjoin-cli join lab.enterpriseadmins.org adminbw
/opt/pbis/bin/config AssumeDefaultDomain true
/opt/pbis/bin/config LoginShellTemplate /bin/bash
/opt/pbis/bin/config HomeDirTemplate %H/%U
/opt/pbis/bin/config RequireMembershipOf "lab\\domain^users"
/opt/pbis/bin/update-dns

Once I reach this point, I kick off a quick reboot (just to make sure the domain join took) and am now free to use the VM.

This entry was posted in Virtualization. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Notify me of followup comments via e-mail. You can also subscribe without commenting.