Installing and running PCMS

Introduction

PCMS is a configuration management systems (CMS) based on GNU Make. It is still in development.

Prologue

  1. Log in as root on tty1.

Can’t copy and paste from here into the terminal?

Depending whether you are installing a physical machine, virtual machine or a container, you may or may not be able to copy content from here and paste it directly into the console. This section explains how to get the ssh server running so that the commands can then be run from a remote location.

  1. Install ssh by running:
    apt -y install openssh-server
    echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
    systemctl restart ssh
    ip addr     # note the IP address into which to ssh
    

    but beware that, later, pcms must be run from the console (because it can change the system’s IP address).

  2. VirtualBox VMs only: Click “Settings”, then “Network”, then “Advanced”, then “Port Forwarding” and add a rule:
    • Name: ssh
    • Protocol: TCP
    • Host IP: <leave-blank>
    • Host port: <22-or-something-else-as-you-like>
    • Guest IP: <guest-ip-as-noted-above>
    • Guest Port: 22

    and click “OK” twice.

  3. Try ssh-ing into the VirtualBox server, which should be redirected/NAT-ed/masqueraded through to the guest OS.

Installing a released version of PCMS

  1. Download the svn-cache-passwd script as follows:
    apt -y install wget
    cd /tmp
    wget https://svn.pasta.freemyip.com/main/smalltools/trunk/bin/svn-cache-passwd
    chmod 755 svn-cache-passwd

    (More details about this script can be found here.)

  2. Insert the password for the Subversion repository hosting the PCMS module into the plain-text password store by running:
    /tmp/svn-cache-passwd https://svn.pasta.freemyip.com/private/
    
  3. Install PCMS’s dependencies and then PCMS by running:
    cd /tmp
    wget https://repo.pasta.freemyip.com/debian/pool/miniade_latest_all.deb
    wget https://repo.pasta.freemyip.com/debian/pool/ade_latest_all.deb
    wget https://repo.pasta.freemyip.com/debian/pool/pcms_latest_all.deb
    #  next line usually only needed on debian-testing but safe to run everywhere
    apt -y update
    dpkg -i --force-depends *.deb
    apt -y --fix-broken install
    

Installing the development version of PCMS

I changed apt-get calls to apt calls. It may be that apt doesn’t support --fix-broken, in which case it should be reverted where needed.

  1. Download the svn-cache-passwd script as follows:
    apt -y install wget
    cd /tmp
    wget https://svn.pasta.freemyip.com/main/smalltools/trunk/bin/svn-cache-passwd
    chmod 755 svn-cache-passwd

    (More details about this script can be found here.)

  2. Insert the password for the Subversion repository hosting the PCMS module into the plain-text password store by running:
    /tmp/svn-cache-passwd https://svn.pasta.freemyip.com/main/
    /tmp/svn-cache-passwd https://svn.pasta.freemyip.com/private/
    
  3. Run:
    #  install ADE and ADE's prerequisites
    wget https://repo.pasta.freemyip.com/debian/pool/miniade_latest_all.deb
    wget https://repo.pasta.freemyip.com/debian/pool/ade_latest_all.deb
    dpkg -i --force-depends *.deb
    apt -y --fix-broken install
    
    #  install PCMS's prerequisites (from pcms.debian/control)
    apt -y install make bridge-utils debfoster gnupg debconf apt subversion \
                       git libeatmydata1 iputils-ping lsb-release pciutils \
                       network-manager file nmap
    
    #  compile PCMS from source
    mkdir -p /usr/local/opt
    cd /usr/local/opt
    svn co -q https://svn.pasta.freemyip.com/main/pcms/trunk pcms
    make -C pcms
    
    #  use the example pcms.conf file as the real pcms.conf file
    mkdir -p /etc/pcms
    cp pcms/doc/examples/pcms.conf /etc/pcms/
  4. Run the PCMS development shell, setting some environment variables so that the later switch to a non-development version will be smoother:
    export PCMS_ETC_PREFIX=/etc/pcms
    export PCMS_STATE_PREFIX=/var/lib/pcms
    /usr/local/opt/pcms/bin/pcmsdevsh

Adding a new host to the site-specific PCMS configuration module

  1. Download the site-specific PCMS configuration module by running:
    mkdir -p /etc/pcms
    svn co -q https://svn.pasta.freemyip.com/private/pcms-config/trunk \
        /etc/pcms/pcms-config
    ln -s pcms-config /etc/pcms/site-config
    

    and following the prompts (if any).

  2. Run:
    apt -y install vim
  3. Set up a minimal by running:
    echo -e 'syntax on\nset paste\nset background=dark\nset nois' > ~/.vimrc
  4. Edit /etc/pcms/site-config/hosts/gen-facility-local and add the host.

Running PCMS

  1. Verify that PCMS can find all its components by running:
    pcms -h > /dev/null

    Any output is an error in PCMS or this documentation.

  2. Run PCMS as follows:
    pcms --no-update-os -- -n > /dev/null
    
  3. If the previous command produced an error then modify the site-specific PCMS configuration module and rerun this test command.
  4. Make sure you are logged in on the console (optional instructions above mean you may have connected by ssh) and that, if you you are running the development version of PCMS that you have set any necessary environment variables.
  5. Then run it for real as follows:
    pcms -v
  6. Remember to commit your edits to the site-specific PCMS configuration module!

See also