c7base.home

Drew Sears edited this page Mar 4, 2017 · 14 revisions

Build instructions for the c7base.home VirtualBox base image.

Allocate a static IP and DNS entry for the template on my home network.

Cloning the current version

  • In VirtualBox, choose the latest snapshot and then clone
  • Set machine name
  • Re-initialize MAC addresses
  • Linked clone
  • Start -> Headless

SSH in to the template IP as "user".

Set the hostname and IP:

./bootstrap.sh

Delete bootstrap script and reboot

rm bootstrap.sh && sudo reboot

VirtualBox config

New machine in VirtualBox:

  • c7base.home
  • Linux
  • Red Hat (64-bit)
  • 512MB memory
  • 80GB thin provisioned disk
  • Bridged adapter
  • Mount the CentOS 7 ISO

CentOS 7 installation

  • Set full FQDN and static IP
  • Use Google public DNS
  • Use my home LAN zone as the search domain
  • Create root:root and user:user

Snapshot as v1.

Initial update

Full update, March 2017:

yum update

Snapshot as v2.

Base configuration

sudo visudo and allow passwordless sudo for wheel.

%wheel        ALL=(ALL)       NOPASSWD: ALL

Put SELinux in permissive mode.

sudo sed -i s/SELINUX=enforcing/SELINUX=permissive/g /etc/selinux/config

Stop and mask firewalld:

sudo systemctl stop firewalld.service && sudo systemctl mask firewalld.service

Edit /etc/ssh/sshd_config and set PermitRootLogin no.

Add ~/bootstrap.sh:

#!/bin/bash
OLD_HOSTNAME=`hostname`
echo "Old FQDN: ${OLD_HOSTNAME}"
read -p "New FQDN: " NEW_HOSTNAME
sudo hostnamectl set-hostname $NEW_HOSTNAME
echo "Hostname: ${NEW_HOSTNAME}"
ping -c 1 $NEW_HOSTNAME > /tmp/ping.out
OLD_IP="$(head -2 /tmp/ping.out | tail -1 | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}')"
echo "Old IP: ${OLD_IP}"
NEW_IP="$(head -1 /tmp/ping.out | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}')"
echo "New IP: ${NEW_IP}"
sudo sed -i s/IPADDR=${OLD_IP}/IPADDR=${NEW_IP}/g /etc/sysconfig/network-scripts/ifcfg-enp0s3
cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
hostname

Set executable:

chmod +x ~/bootstrap.sh

Halt and set the VM description to the URL of this page.

Snapshot as v3.2.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.