Create a Centos Staging Server

Overview

The CentOS VM will become the staging area for the docker container.

Prerequisites

  1. Virtualbox NatNetwork created (all hosts on it). Virtual Box NAT Config

  2. A webserver running on the NatNetwork that can host the kickstart file.
    • Alternate - you can add an additional host-only adapter and serve the kickstart file from the host machine. See the “Workstation Build Process” Document and the section about the Virtual Machine
  3. Configure a NAT Network on the host OS
VBoxManage natnetwork add --netname natnet1 --network "192.168.7.0/24" --enable

References & Additional Information

  1. Basic Guide
  2. Kickstarter Password handling
    python
    import crypt,getpass; print crypt.crypt(getpass.getpass(), "$6$4egcSVDxHKCc1tpG")
    

Steps

  1. Download the minimal Centos install from http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1804.iso

Centos Mirror

In VirtualBox…

  1. Create a new machine virtualbox (Button in upper left) New Vbox VM
  2. Name the image centos_staging
  3. Set ram to 2048 MB
  4. Create virtual hard disk - VDI - Dynamically allocated - 20G
  5. Configure 2 network adapters on the base image.

    Network Adapter 1

    NAT to get out4

    Network Adapter 2

    NAT NET to communicate with other other devices on the network

    Network Configuration

    VBOX Network Manager Configuration

Note This two adapter configuration may need revisiting. NAT will allow internet, but isolates client devices. NAT Network allows devices on the same network to talk, and to talk to the host, but not to the internet. Additional Reference

  1. Select downloaded CentOS image file

On the temporary server hosting the kickstart file…

  1. Run these shell commands on the server that will host the kickstart file

    cd ~
    mkdir proj
    git clone https://github.com/wbmartin/container_toolbox
    cd /proj/container_toolbox
    ifconfig #(get the IP)
    ls 010*# to get the filenames, kickstart should be 010-CentOS7-cis.ks
    

On the New CentosVM…

  1. Virtually power the machine on and press tab on boot and replace the ks with
     http://[IP]/010-CentOS7-cis.ks in the screenshot below.  The whole line should look like:
    vmlinuz initrd=initrd.img ks=http://192.168.57.1:11111/010-StageServer-CentOS7-cis.ks
    

    Expect: Everything should install, VM should be ~ 7G on disk Tip: You may have trouble connecting to the internet at this point - problem seems to be in the nat network created, using a simple NAT network immediately may let the machine get through the gateway.

  2. Run these shell commands as root on the VM that will create the docker image (staging server)
    yum update -y
    yum install git -y
    cd /opt
    git clone https://github.com/wbmartin/confighub
    git clone https://github.com/wbmartin/project-base
    ./project-base/stagebin/055-StageServer-CentOS-PostInstall.sh # install packages and configure env.
    systemctl start docker # launch docker
    systemctl enable docker #launch docker on startup
    

    Expect: reboot; git installed; container toolbox available; docker running and will

  3. On startup Edit the /etc/hosts/allow to permit the host only adapter to ssh:
    vi /etc/hosts.allow
    #add the following line
    sshd : 192.168.57.1
    
  4. Edit the SSH config to allow extended sessions - Note this should only be extended for protected dev servers.
      vi /etc/ssh/sshd_config
      #update the following value
      ClientAliveInterval 3000