From bea84e881bf75fd8e2021723e2aac98b4a0fb3fe Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Wed, 7 Feb 2018 16:52:31 -0500 Subject: [PATCH] docs in progress --- .../docs/manual/cakelampvm_guide_v002.html | 260 ++++++++++-------- 1 file changed, 143 insertions(+), 117 deletions(-) diff --git a/production/sites/cakelampvm.com/docs/manual/cakelampvm_guide_v002.html b/production/sites/cakelampvm.com/docs/manual/cakelampvm_guide_v002.html index cedbdad1..71db45c8 100644 --- a/production/sites/cakelampvm.com/docs/manual/cakelampvm_guide_v002.html +++ b/production/sites/cakelampvm.com/docs/manual/cakelampvm_guide_v002.html @@ -1,7 +1,7 @@ - + Cake LAMP VM Documentation @@ -11,7 +11,7 @@ Koeritz
feisty meow® concerns ltd.

Vintage: cakelampvm v002    - Updated: 2018-1-7 (rev. i)

+ Updated: 2018-2-7 (rev. j)

The cakelampvm project provides a Virtualbox VM that acts as an "internet in a bottle", serving up your web sites securely and only to your local host.  The virtual machine provides DNS services (gnome display manager

  • Main VM User: developer (password distributed separately)
  • -
  • Database Access: mysql root account, password: (password distributed - separately)
  • +
  • Database Access: mysql root account (password distributed separately)
  • How to set up virtualbox for your host PC

      @@ -134,6 +133,8 @@ nat net config

    Starting up the VM and Connecting to It

    +

    ★ This section requires that the VM is already configured properly for + Host-Only and NAT networks.

    Using the Virtualbox interface, you should now be able to start your virtual machine.  Virtualbox will complain if it detects any remaining configuration problems in the VM.  The Linux boot sequence @@ -153,15 +154,35 @@ with:

    ssh developer@10.28.42.20
    # or perform the equivalent connection with your ssh client.

    And then provide the password to log in.

    -

    Once the DNS services are set up (discussed in detail below), you will be - able to run the much friendlier command:

    +

    + +

    +

    + + ★ It is very important that the ssh connection is working properly before + proceeding to other configuration steps.  If ssh is not working, try + pinging the host:

    +
    ping 10.28.42.20
    +

    If the ping is also failing, then please re-check the two network + configuration sections above (for Host-Only networking and NAT + networking).  These are both required for the VM's network to + function as designed.

    +

    Optional: Once the DNS services are set up (discussed in detail below), + you will be able to run the much friendlier command:

    ssh developer@cakelampvm.com

    Key Forwarding to the VM

    It is important to set up ssh key forwarding to enable your use of git repositories while logged into the VM.  Key forwarding should be enabled for the VM's two fake host identities:

    cakelampvm.com
    10.28.42.20
    +

    The details of configuring ssh key forwarding vary for each ssh + client.  For Linux ssh, the ~/.ssh/config file might contain + this information:

    +
    Host cakelampvm.com 10.28.42.20
      ForwardAgent yes
    +

    Updating cakelampvm to the Latest Model

    +

    ★ This section requires that the VM is already configured and is + accessible via ssh.

    The cakelampvm v002 is released with the intention that it not need to be released again.  Version 001 was not built with that explicit intention, which then required the release of Version 002.  But we @@ -169,12 +190,13 @@

    There is an update feature built into the VM that is quite easy to use.  The updates are driven by the feisty meow script repository in conjunction with a local scripted command.  To activate the "update - process" for your VM, run the following commands on the VM:

    + process" for your VM, run the following commands on the VM, logged in as + the developer user:

    # update to the latest version of feisty meow.
    rpuffer $FEISTY_MEOW_APEX; regenerate
    # enact any configuration changes needed, such as permissions and account setup. revamp_cakelampvm

    These two commands can be run at any time to patch up your VM to the - latest.

    + latest configuration.

    Recent versions of feisty meow support a new "get_feisty" command, which will behave the same as the first line above.  Once you have run the "puffer..." command above for the first time (on @@ -189,7 +211,9 @@ revamp_cakelampvm gone astray, especially for problems with permissions.

    First Tasks as the Developer User

    -

    Here are some first steps that will make the vm your own:

    +

    ★ This section requires that the VM is already configured and is + accessible via ssh.

    +

    Here are some first steps that will make the vm your own.

    1. Change your password for the developer account.  (This may eventually be required and automatic.)  First, log into the VM with @@ -240,6 +264,8 @@ meow

      (The feisty meow codebase is already configured for the developer account on the cakelampvm virtual machine.)

      Using the guest VM's DNS services

      +

      ★ This section requires that the VM is already configured and is + accessible via ssh.

      The cakelampvm has been set up to provide a DNS server which will answer name lookup requests on any of the sites that the cakelampvm is hosting for you.  It will also serve as a general DNS server for any other @@ -397,6 +423,114 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com describes how to set up Cygwin to run X server, which enables X11 forwarding to your local display.

      ...{insert that info}...

      +

      Handy Techniques for Using cakelampvm

      +

      Assorted Guides and Cheat-Sheets

      +

      A Cheat sheet for the Vim editor (there are many of these available): https://vim.rtorr.com/

      +

      A git branching model that seems to work well: http://nvie.com/posts/a-successful-git-branching-model/

      +

      This is a basic guide to the Google Developer Console and API Key + management: Google + API Docs 

      +

      Using the "meld" Tool to Compare Files & Directories

      +

      Meld is a great comparison tool that displays differences between two + files or directories or directory trees in a graphical view.  Meld is + pre-installed on the VM.  This tool can be launched either in the + VM's X Windowing System (on the console) or if X11 forwarding is enabled.

      +

      To run meld, just type this command:

      +
      meld A B
      +

      where A and B are either both file names or they are both directory + names.  If A and B are directories, meld will compare the entire tree + structure between the two directories.  It allows one to copy from + one side to the other, even if the item that needs to be copied is an + entire subdirectory.

      +

      Get the network address on the guest vm

      +

      Run this command:

      +
      ifconfig
      +

      In the results, look for "inet addr".  + There may be more than one, if there are multiple network interfaces.

      +

      The standard IP address is 10.28.42.20 for the cakelampvm.

      +

      How to cleanly reboot or shut down the guest VM

      +

      When you've got the DNS and everything integrated, these commands will + manage the vm's state:

      +

      First, log into the guest VM:

      +
      ssh developer@cakelampvm.com
      +

      Then, to reboot the guest VM:

      +
      sudo reboot
      +

      Or, to halt the guest VM:

      +
      sudo shutdown -h now
      +

      Using these commands is kinder to the VM than just cycling the power from + the Virtualbox control panel.

      +

      Gritty Details of the Nitty Variety

      +

      This is the lowest level of plumbing for your VM.  Hopefully you + will not need to engage with this section.  The most useful doc + section here is the one below about the "Virtualbox guest additions", + which you will probably need at some future point.  Oracle releases + updates to the guest additions fairly regularly.

      +

      Configuring the guest VM

      +

      The guest VM should already be set up appropriately.  These steps + are provided for reference and updates.

      +

      Set up Virtualbox guest additions for the VM

      + This procedure is needed if the guest provides an older or incompatible + version of the guest additions (which have already been installed on the + guest vm).  It may also be necessary when a new version of the guest + additions becomes available. +
        +
      1. To install the guest additions, open the guest VM and have its window + in focus.
      2. +
      3. Choose the "Devices" menu and select "Insert Guest Additions CD + Image".  This will mount the CD's ISO image on the VM.
      4. +
      5. On the guest VM, it may be necessary to mount the CD image that's now + available:
        +
        sudo mount /dev/sr0 /media/cdrom
        +

        Linux will mention that the device is mounted "read-only".

        +
      6. +
      7. Since the VM currently has no windowing system installed, one must + start the Guest Additions install manually:
        +
        cd /media/cdrom
        sudo sh VBoxLinuxAdditions.run
        +
      8. +
      9. The latest Virtualbox guest additions should now be installed.
      10. +
      +

      Set up network adapters on guest VM

      +

      The network interfaces should already be configured on the guest within + the Virtualbox configuration.  This is available by clicking on the + VM in the Virtualbox manager and selecting "Settings".  These are the + configuration settings used:

      + Adapter 1:
      +   Attached to: Host-only Adapter
      +   Name: vboxnet0 
      +

      Adapter 2:
      +   Attached to: Nat Network
      +   Name: NatNetwork

      +

      On the guest VM itself, the network settings are specified in a file + called /etc/network/interfaces.  Here are the current contents of + that file:

      +
      source /etc/network/interfaces.d/*

      auto lo
      iface lo inet loopback

      auto enp0s3
      iface enp0s3 inet static
        address 10.28.42.20
        netmask 255.255.255.0
        network 10.28.42.0
        broadcast 10.28.42.255
        dns-domain cakelampvm.com
        dns-search cakelampvm.com
        dns-nameservers 127.0.0.1 8.8.8.8
      +
      auto enp0s8
      +
      iface enp0s8 inet dhcp
      +

      +

      Compacting the VM Disk Image

      +

      To minimize the size used for the disk image, there are three major + steps.

      +

      1. While running the VM, run this command:

      +
      sudo apt clean
      +

      This throws away any cached data from the apt tool, which can be + substantial.

      +

      If there are other junk files you know of that can be removed, delete + those now also.

      +

      2. Reboot the VM to the gparted ISO image (available at the gparted + site) and run the following command:

      +
      sudo zerofree /dev/sda
      +

      This sets all free space to the zero byte, enabling Virtualbox to free + that space in the next step.

      +

      3. Shut the vm down after zerofree is complete and run this command on + the host PC (this is the Linux version of the command):

      +
      VBoxManage modifyhd --compact ~/cake_lamp_vm/cake-lamp-vm-hd.vdi
      +

      Replace the ~/cake_lamp_vm + path with the real VM storage path.  This command compacts the root + (and only) partition of the VM.

      +

      After these steps are complete, the VM should be its minimal size.

      Adding a new website and domain on the guest VM

      Note: these instructions, even the quick approaches below, pale in comparison to the ease of use of the "standup" command in feisty meow's @@ -515,114 +649,6 @@ href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com for any error messages that can be corrected.  The log files are stored in "/var/log/apache2" and are named after the website (if configured through the above process).

      -

      Handy Techniques for Using cakelampvm

      -

      Assorted Guides and Cheat-Sheets

      -

      A Cheat sheet for the Vim editor (there are many of these available): https://vim.rtorr.com/

      -

      A git branching model that seems to work well: http://nvie.com/posts/a-successful-git-branching-model/

      -

      This is a basic guide to the Google Developer Console and API Key - management: Google - API Docs 

      -

      Using the "meld" Tool to Compare Files & Directories

      -

      Meld is a great comparison tool that displays differences between two - files or directories or directory trees in a graphical view.  Meld is - pre-installed on the VM.  This tool can be launched either in the - VM's X Windowing System (on the console) or if X11 forwarding is enabled.

      -

      To run meld, just type this command:

      -
      meld A B
      -

      where A and B are either both file names or they are both directory - names.  If A and B are directories, meld will compare the entire tree - structure between the two directories.  It allows one to copy from - one side to the other, even if the item that needs to be copied is an - entire subdirectory.

      -

      Get the network address on the guest vm

      -

      Run this command:

      -
      ifconfig
      -

      In the results, look for "inet addr".  - There may be more than one, if there are multiple network interfaces.

      -

      The standard IP address is 10.28.42.20 for the cakelampvm.

      -

      How to cleanly reboot or shut down the guest VM

      -

      When you've got the DNS and everything integrated, these commands will - manage the vm's state:

      -

      First, log into the guest VM:

      -
      ssh developer@cakelampvm.com
      -

      Then, to reboot the guest VM:

      -
      sudo reboot
      -

      Or, to halt the guest VM:

      -
      sudo shutdown -h now
      -

      Using these commands is kinder to the VM than just cycling the power from - the Virtualbox control panel.

      -

      Gritty Details of the Nitty Variety

      -

      This is the lowest level of plumbing for your VM.  Hopefully you - will not need to engage with this section.  The most useful doc - section here is the one below about the "Virtualbox guest additions", - which you will probably need at some future point.  Oracle releases - updates to the guest additions fairly regularly.

      -

      Configuring the guest VM

      -

      The guest VM should already be set up appropriately.  These steps - are provided for reference and updates.

      -

      Set up Virtualbox guest additions for the VM

      - This procedure is needed if the guest provides an older or incompatible - version of the guest additions (which have already been installed on the - guest vm).  It may also be necessary when a new version of the guest - additions becomes available. -
        -
      1. To install the guest additions, open the guest VM and have its window - in focus.
      2. -
      3. Choose the "Devices" menu and select "Insert Guest Additions CD - Image".  This will mount the CD's ISO image on the VM.
      4. -
      5. On the guest VM, it may be necessary to mount the CD image that's now - available:
        -
        sudo mount /dev/sr0 /media/cdrom
        -

        Linux will mention that the device is mounted "read-only".

        -
      6. -
      7. Since the VM currently has no windowing system installed, one must - start the Guest Additions install manually:
        -
        cd /media/cdrom
        sudo sh VBoxLinuxAdditions.run
        -
      8. -
      9. The latest Virtualbox guest additions should now be installed.
      10. -
      -

      Set up network adapters on guest VM

      -

      The network interfaces should already be configured on the guest within - the Virtualbox configuration.  This is available by clicking on the - VM in the Virtualbox manager and selecting "Settings".  These are the - configuration settings used:

      - Adapter 1:
      -   Attached to: Host-only Adapter
      -   Name: vboxnet0 
      -

      Adapter 2:
      -   Attached to: Nat Network
      -   Name: NatNetwork

      -

      On the guest VM itself, the network settings are specified in a file - called /etc/network/interfaces.  Here are the current contents of - that file:

      -
      source /etc/network/interfaces.d/*

      auto lo
      iface lo inet loopback

      auto enp0s3
      iface enp0s3 inet static
        address 10.28.42.20
        netmask 255.255.255.0
        network 10.28.42.0
        broadcast 10.28.42.255
        dns-domain cakelampvm.com
        dns-search cakelampvm.com
        dns-nameservers 127.0.0.1 8.8.8.8
      -
      auto enp0s8
      -
      iface enp0s8 inet dhcp
      -

      -

      Compacting the VM Disk Image

      -

      To minimize the size used for the disk image, there are three major - steps.

      -

      1. While running the VM, run this command:

      -
      sudo apt clean
      -

      This throws away any cached data from the apt tool, which can be - substantial.

      -

      If there are other junk files you know of that can be removed, delete - those now also.

      -

      2. Reboot the VM to the gparted ISO image (available at the gparted - site) and run the following command:

      -
      sudo zerofree /dev/sda
      -

      This sets all free space to the zero byte, enabling Virtualbox to free - that space in the next step.

      -

      3. Shut the vm down after zerofree is complete and run this command on - the host PC (this is the Linux version of the command):

      -
      VBoxManage modifyhd --compact ~/cake_lamp_vm/cake-lamp-vm-hd.vdi
      -

      Replace the ~/cake_lamp_vm - path with the real VM storage path.  This command compacts the root - (and only) partition of the VM.

      -

      After these steps are complete, the VM should be its minimal size.

      Notes on building the Cake Lamp VM

      This is all work that should already have been done.  It is mentioned here just as breadcrumbs for a future vm builder.

      -- 2.34.1