+ <h2>Handy Techniques for Using cakelampvm</h2>
+ <h3>Assorted Guides and Cheat-Sheets</h3>
+ <p>A Cheat sheet for the Vim editor (there are many of these available): <a
+ target="_blank" title="vim commands" href="https://vim.rtorr.com/">https://vim.rtorr.com/</a></p>
+ <p>A git branching model that seems to work well: <a target="_blank" title="release and patch process"
+ href="http://nvie.com/posts/a-successful-git-branching-model/">http://nvie.com/posts/a-successful-git-branching-model/</a></p>
+ <p>This is a basic guide to the Google Developer Console and API Key
+ management: <a target="_blank" title="apis and creds at google" href="https://feistymeow.org//feisty_meow/documentation/google_apis/google_apis_and_credentials.pdf">Google
+ API Docs</a> </p>
+ <h3>Using the "meld" Tool to Compare Files & Directories</h3>
+ <p>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.</p>
+ <p>To run meld, just type this command:</p>
+ <pre><span style="font-weight: bold;">meld A B</span></pre>
+ <p>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.</p>
+ <h3>Get the network address on the guest vm</h3>
+ <p>Run this command:</p>
+ <pre><span style="font-weight: bold;">ifconfig</span></pre>
+ <p>In the results, look for "<span style="font-family: monospace;">inet addr</span>".
+ There may be more than one, if there are multiple network interfaces.</p>
+ <p>The standard IP address is 10.28.42.20 for the cakelampvm.</p>
+ <h3>How to cleanly reboot or shut down the guest VM</h3>
+ <p>When you've got the DNS and everything integrated, these commands will
+ manage the vm's state:</p>
+ <p>First, log into the guest VM:</p>
+ <pre><span style="font-weight: bold;">ssh developer@cakelampvm.com</span></pre>
+ <p>Then, to reboot the guest VM:</p>
+ <pre><span style="font-weight: bold;">sudo reboot</span></pre>
+ <p>Or, to halt the guest VM:</p>
+ <pre><span style="font-weight: bold;">sudo shutdown -h now</span></pre>
+ <p>Using these commands is kinder to the VM than just cycling the power from
+ the Virtualbox control panel.</p>
+ <h1>Gritty Details of the Nitty Variety<a id="#nitty-gritty" name="#nitty-gritty"></a></h1>
+ <p>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.</p>
+ <h2>Configuring the guest VM</h2>
+ <p>The guest VM should already be set up appropriately. These steps
+ are provided for reference and updates.</p>
+ <h3>Set up Virtualbox guest additions for the VM</h3>
+ 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.
+ <ol>
+ <li>To install the guest additions, open the guest VM and have its window
+ in focus.</li>
+ <li>Choose the "Devices" menu and select "Insert Guest Additions CD
+ Image". This will mount the CD's ISO image on the VM.</li>
+ <li>On the guest VM, it may be necessary to mount the CD image that's now
+ available:<br>
+ <pre><span style="font-weight: bold;">sudo mount /dev/sr0 /media/cdrom</span></pre>
+ <p>Linux will mention that the device is mounted "read-only".</p>
+ </li>
+ <li>Since the VM currently has no windowing system installed, one must
+ start the Guest Additions install manually:<br>
+ <pre><span style="font-weight: bold;">cd /media/cdrom<br>sudo sh VBoxLinuxAdditions.run</span></pre>
+ </li>
+ <li>The latest Virtualbox guest additions should now be installed.</li>
+ </ol>
+ <h3>Set up network adapters on guest VM</h3>
+ <p>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:</p>
+ Adapter 1:<br>
+ Attached to: Host-only Adapter<br>
+ Name: vboxnet0 <br>
+ <p>Adapter 2:<br>
+ Attached to: Nat Network<br>
+ Name: NatNetwork</p>
+ <p>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:</p>
+ <pre>source /etc/network/interfaces.d/*<br><br>auto lo<br>iface lo inet loopback<br><br>auto enp0s3<br>iface enp0s3 inet static<br> address 10.28.42.20<br> netmask 255.255.255.0<br> network 10.28.42.0<br> broadcast 10.28.42.255<br> dns-domain cakelampvm.com<br> dns-search cakelampvm.com<br> dns-nameservers 127.0.0.1 8.8.8.8</pre>
+ <pre>auto enp0s8</pre>
+ <pre>iface enp0s8 inet dhcp</pre>
+ <p> </p>
+ <h3>Compacting the VM Disk Image</h3>
+ <p>To minimize the size used for the disk image, there are three major
+ steps.</p>
+ <p>1. While running the VM, run this command:</p>
+ <pre><span style="font-weight: bold;">sudo apt clean</span></pre>
+ <p>This throws away any cached data from the apt tool, which can be
+ substantial.</p>
+ <p>If there are other junk files you know of that can be removed, delete
+ those now also.</p>
+ <p>2. Reboot the VM to the gparted ISO image (available at the <a target="_blank"
+ title="great free partition editor" href="https://gparted.org/livecd.php">gparted
+ site</a>) and run the following command:</p>
+ <pre><span style="font-weight: bold;">sudo zerofree /dev/sda</span></pre>
+ <p>This sets all free space to the zero byte, enabling Virtualbox to free
+ that space in the next step.</p>
+ <p>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):</p>
+ <pre><span style="font-weight: bold;">VBoxManage modifyhd --compact ~/cake_lamp_vm/cake-lamp-vm-hd.vdi</span></pre>
+ <p>Replace the <span style="font-family: monospace;">~/cake_lamp_vm</span>
+ path with the real VM storage path. This command compacts the root
+ (and only) partition of the VM.</p>
+ <p>After these steps are complete, the VM should be its minimal size.</p>