4 <meta content="text/html; charset=windows-1252" http-equiv="content-type">
5 <title>Cake LAMP VM Documentation</title>
8 <h1 style="text-align: center;">The cakelampvm VM:<br>
9 Configuration and Usage</h1>
10 <div style="text-align: center;"><span style="font-weight: bold;">By Chris
11 Koeritz</span><span style="font-family: Comic Sans MS;"></span><span style="font-family: Comic Sans MS;"></span><br>
12 <span style="font-family: Comic Sans MS;">feisty meow® concerns ltd</span>.</div>
13 <h3 style=" text-align: center;"> Vintage: cakelampvm v002
14 Updated: 2017-11-20 (rev. g)</h3>
15 <p>The cakelampvm project provides a Virtualbox VM that acts as an "internet
16 in a bottle", serving up your web sites securely and only to your local
17 host. The virtual machine provides DNS services (<a target="_blank"
18 title="dns server" href="http://www.bind9.net/">bind9</a>), a Web server
19 (<a target="_blank" title="patchy" href="https://httpd.apache.org/">Apache2</a>),
20 a full <a target="_blank" title="ubuntu means compassion and humanity" href="https://www.ubuntu.com/">Ubuntu</a>
21 <a target="_blank" title="it's pronounced leenoox" href="https://www.linuxfoundation.org/">Linux</a>
22 desktop environment, the <a target="_blank" title="flux is change" href="http://fluxbox.org/">Fluxbox</a>
23 <a target="_blank" title="x11 -- best windowing system" href="https://www.x.org/">X
24 window manager</a>, and a suite of tools called the <a target="_blank"
25 title="feisty meow® concerns ltd. website" href="https://feistymeow.org/">Feisty
26 Meow® codebase</a> . Together, these services provide you with a
27 very flexible and powerful testbed for web development, especially suited
28 for <a target="_blank" title="it's cake" href="https://cakephp.org/">CakePHP</a>.
29 This VM was built with the assistance of and was partially funded by <a target="_blank"
30 title="saco design" href="http://sacodesign.com">Saco Design</a> of <a
31 target="_blank" title="winterport" href="http://www.winterportmaine.gov/">Winterport,
33 <p>Commands preceded by an octothorpe ('#') below are intended to be typed
34 into a bash shell running on the cakelampvm virtual machine. The
35 bash shell can be obtained either by logging into the VM through ssh or by
36 logging in directly to the Virtualbox VM console. You may find the
37 ssh session more convenient, because copy & paste features work as
39 <p>Commands preceded by a greater-than symbol ('>') are intended to be
40 run on the Host PC in a Windows command prompt (or in a bash prompt
41 running on the Host PC).</p>
42 <h2> Guest VM Configuration<a id="#config" name="#config"></a></h2>
44 <li>Hostname: <a target="_blank" title="the vm's website, when configured properly"
45 href="https://cakelampvm.com/">cakelampvm.com</a></li>
46 <li>Local IP Address: 10.28.42.20</li>
47 <li>Services Included: DNS (bind9), apache2, fluxbox X windowing system, <a
48 target="_blank" title="not just in the garden" href="https://www.gnome.org/">gnome
49 display manager</a></li>
50 <li>Main VM User: developer (password distributed separately)</li>
51 <li>Database Access: mysql root account, password: (password distributed
54 <h2>How to set up virtualbox for your host PC<a id="#virtualbox-setup" name="#virtualbox-setup"></a></h2>
56 <li>Download and install virtualbox: <a target="_blank" href="https://www.virtualbox.org/wiki/Downloads">https://www.virtualbox.org/wiki/Downloads</a></li>
57 <li>Install the extension pack for Virtualbox: This provides USB drivers
58 and other features. This is installed on Virtualbox itself (on the
59 Host PC), not on the guests.</li>
61 <li>Download the extension pack (also) at <a target="_blank" href="https://www.virtualbox.org/wiki/Downloads">https://www.virtualbox.org/wiki/Downloads</a></li>
62 <li>Stop any running Virtualbox VMs.</li>
63 <li>Close the Virtualbox control panel.</li>
64 <li>Double-click on the downloaded extensions package (in a file
65 explorer) and Virtualbox should be launched to install it.</li>
67 <li>Run the Virtualbox control panel.</li>
68 <li>Download the cakelampvm guest vm package and unzip it. Store the
69 unzipped version in some appropriate place where you want the virtual
70 machine to reside on your host's hard drive.</li>
71 <li>Add the guest VM to your list of VMs. From the Virtualbox menus,
72 choose the "Machine" menu and select "Add". Point the selector
73 dialog at the cakelampvm folder you created above and open the
74 cakelampvm.vbox file.</li>
75 <li>Now the cakelampvm should show up in the list of virtual
76 machines. Before starting it, perform the following network
77 configuration sections.</li>
79 <h3>Configure the Host-Only network on Virtualbox<a id="#host-only" name="#host-only"></a></h3>
80 <p>Configuring host-only networking for the VM makes the VM completely local
81 to your machine. The cakelampvm will not be accessible on the
82 internet or from the LAN, and can only be accessed by your host PC.
83 This is a key component of security for your VM and your host PC, and is
84 considered a crucial configuration step.</p>
85 <p>Note: If the host-only or NAT network exist ahead of time, Virtualbox may
86 complain about them even if they have the correct configuration.
87 This can be corrected simply by opening the cakelampvm settings and
88 selecting the appropriate network names again.</p>
89 <p>To configure the host-only network, follow these steps:</p>
91 <li> Go to virtual box "Preferences" (global preferences, not for a
93 <li> Click on the "Network" tab.</li>
94 <li> Choose the "Host-only Networks" tab from within "Network".</li>
95 <li> Click the plus icon to add a new host-only network, or if there is
96 already a Host-only network, then edit it.</li>
97 <li>Set the "Adapter" parameters:<br>
98 IPv4 Address: 10.28.42.1<br>
99 IPv4 Network Mask: 255.255.255.0<br>
100 IPv6 Address: (leave blank)<br>
101 IPv6 Prefix Length: 0<br>
102 Virtualbox will fill in the other details like so:<br>
103 <p><img alt="host only network adapter" src="images/host_only_network_adapter.png"></p>
105 <li>Set the "DHCP Server Settings" to disabled, e.g.<br>
106 <img alt="host only dhcp" src="images/host_only_adapter_dhcp_server.png"><br>
107 This is disabled because we will be using statically assigned addresses
108 for convenience and stability.</li>
110 <p>Additional information on host-only (and other) network adapter types is
111 at: https://www.virtualbox.org/manual/ch06.html#network_nat_service</p>
112 <h3>Configure the NAT Network on Virtualbox<a id="#nat-network" name="#nat-network"></a></h3>
113 <p>The NAT (Network Address Translation) network allows the VM to get off of
114 the machine and onto the internet safely. It will use this interface
115 for any communication off of the host machine. This is another
116 crucial component for the security of the VM and your host PC. Since
117 the real IP address of the VM is hidden behind the NAT firewall on
118 Virtualbox, this keeps the VM safe from attackers, and hence your machine
119 stays safe as well.</p>
120 <p>To set up the NAT network, follow these steps:</p>
122 <li> Go to virtual box "Preferences" (global preferences, not for a
124 <li> Click on the "Network" tab.</li>
125 <li> Choose the "Nat Networks" tab from within "Network".</li>
126 <li> Click the plus icon to add a new host-only network.</li>
127 <li>Set the "NAT Network Details" parameters:<br>
128 Network Name: NatNetwork<br>
129 Network CIDR: 10.0.2.0/24<br>
130 Supports DHCP: checked<br>
131 Supports IPv6: optionally checked<br>
132 These are my settings, with IPv6 left disabled:<br>
133 <img alt="nat net config" src="images/nat_network_config.png"></li>
135 <h2>Starting up the VM<a id="#start-vm" name="#start-vm"></a></h2>
136 <p>Using the Virtualbox interface, you should now be able to start your
137 virtual machine. Virtualbox will complain if it detects any
138 remaining configuration problems in the VM. The Linux boot sequence
139 will show many lines of text, before bringing up a black console window
140 with a login dialog.</p>
141 <p>If Windows complains about the Virtualbox application slamming into its
142 firewall, then allow the Virtualbox to get through. Usually, telling
143 Windows that once is enough, but if any odd network access problems
144 result, edit the Windows firewall settings and allow Virtualbox to use
145 both "Public" and "Private" networks.</p>
146 <p>You can log in directly on the VM console with the developer account, but
147 it is generally more useful to connect to the cakelampvm over ssh.
148 If the networking has been established properly, you should be able to do
150 <pre># ssh developer@10.28.42.20 # or the equivalent with your ssh client</pre>
151 <p>And then provide the password to log in.</p>
152 <p>Once the DNS services are set up (discussed in detail below), you will be
153 able to run the much friendlier command:</p>
154 <pre># ssh developer@cakelampvm.com</pre>
155 <h2>Updating cakelampvm to the Latest Model<a id="#update-vm" name="#update-vm"></a></h2>
156 <p>The cakelampvm v002 is released with the intention that it not need to be
157 released again. Version 001 was not built with that explicit
158 intention, which then required the release of Version 002. But we
159 hope to not need a v003 release...</p>
160 <p>There is an update feature built into the VM that is quite easy to
161 use. The updates are driven by the feisty meow script repository in
162 conjunction with a local scripted command. To activate the "update
163 process" for your VM, run the following commands on the VM (without the
164 initial '#' symbol):</p>
165 <pre># rpuffer $FEISTY_MEOW_APEX # updates to the latest version of feisty meow
166 # revamp_cakelampvm # enacts any configuration changes needed,<br> # plus fixes web folder and other permissions.</pre>
167 <p>These two commands can be run at any time to patch up your VM to the
169 <p>The first command ("rpuffer ...") is also useful on its own for getting
170 the latest version of the feisty meow code. Run it again if there
171 are bug fixes you need for any of the scripts or if you would like the
172 most up-to-date cakelampvm documentation.</p>
173 <h2>First Tasks as the Developer User</h2>
174 <p>Here are some first steps that will make the vm your own:</p>
176 <li>Change your password for the developer account. (This may
177 eventually be required and automatic.) First, log into the VM with
178 ssh. Then type this command:<br>
180 The 'passwd' command will ask for your current password, and then for a
181 new password plus a verification of that new password.<br>
183 <li>Change your git configuration for the user and email address.
184 This is how we've configured it so far:<br>
185 <pre># git config --global user.email "developer@cakelampvm.com"</pre>
186 <pre># git config --global user.name "Developer J. Cakemo"</pre>
187 If you're developing on a real project, you probably don't want the
188 bogus email and even more bogus name above attached to your
189 commits. Just run the two commands again but with proper values.</li>
191 <h2>Powering up with the Feisty Meow® scripts<a id="#powerup" name="#powerup"></a></h2>
192 The feisty meow scripts are a cohesive bash scripting environment for
193 getting a variety of tasks done. The feisty meow scripts recently
194 incorporated the "avbash" collection from Saco Design and added those
195 scripts to a new "site_avenger" collection of scripts. The site
196 avenger scripts provide tools for bringing up CakePHP web sites and managing
197 the collection of repositories for those sites. Each website is
198 considered an "application", and the application name itself (e.g.
199 "winterportlibrary") can often provide all the details for "powering up" the
200 site. The feisty meow team has added additional scripts for managing
201 DNS domains and Apache websites that provide the capability to "stand up" an
202 entire website around an application, with an accompanying DNS domain and an
203 Apache2 site definition.
204 <p>The site avenger scripts are documented separately within the feisty meow
205 codebase. Consult the <span style="text-decoration: underline;">f</span><a
206 target="_blank" title="quickstart" href="https://feistymeow.org/feisty_meow/readme.txt">eisty
208 readme</a> file first, as it provides some valuable information on
209 configuring the codebase initially. The site avenger script commands
210 are documented in the <a target="_blank" title="useful commands" href="https://feistymeow.org/feisty_meow/documentation/feisty_meow_command_reference.txt">feisty
211 meow command reference</a> file.</p>
212 <p>(The feisty meow codebase is already configured for the developer account
213 on the cakelampvm virtual machine.)</p>
214 <h2>X11 applications launched from the VM</h2>
215 <p>[incomplete section]</p>
216 <p>If a feature called "X forwarding" is enabled in your ssh client, then
217 you can start graphical applications on the VM and display them on your
218 local machine. This works right away on most Linux hosts, but can
219 also work on PCs with X window system installed. This section
220 describes how to set up Cygwin to run X server, which enables X11
221 forwarding to your local display.</p>
222 <p>...{insert that info}...</p>
223 <h2>Using the guest VM's DNS services<a id="#dns-from-vm" name="#dns-from-vm"></a></h2>
224 <p>The cakelampvm has been set up to provide a DNS server which will answer
225 name lookup requests on any of the sites that the cakelampvm is hosting
226 for you. It will also serve as a general DNS server for any other
227 domains that need to be looked up.</p>
228 <p>To use the cakelampvm DNS, modify your host operating system network
229 configuration by adding or changing the DNS server to use the guest VM's
230 DNS service. The cakelampvm is available at the local IP address
231 10.28.42.20. (The DNS server can be tested with nslookup, dig and
233 <p>Note that the cakelampvm DNS should be listed first, if one intends to
234 override any DNS names that actually exist out on the internet. We
235 have also found it most effective to have only the cakelampvm as your DNS
236 server, because a secondary DNS server can "take over" providing the name
237 lookups, and thus foul up DNS requests that should succeed for your
239 <p>If your Host PC is running Windows, see the DNS configuration section
240 below that is tailored to that operating system.</p>
241 <p>Important Note: It behooves you to remember to switch back to a normal
242 DNS server configuration when you shut off the cakelampvm, or your machine
243 will not know the names of any sites on the internet any more!</p>
244 <p>Once the DNS server is properly set up (by whatever means necessary),
245 these ping commands should get answering responses (from 10.28.42.20) on
246 both the cakelampvm VM and on your host PC. Note: ping on Linux
247 keeps going forever, so hit control-C when you are tired of seeing the
249 <pre># ping cakelampvm.com</pre>
250 <pre># ping mapsdemo.cakelampvm.com</pre>
251 <p>Note that any other answer than 10.28.42.20 for the address is *bzzzt*
252 wrong, and means something needs to be fixed.</p>
253 <p>If these pings succeed (which hopefully they will!), then try accessing
254 the websites of each domain:</p>
255 <pre>(browse to) <a target="_blank" title="vm website if dns working" href="http://cakelampvm.com">http://cakelampvm.com</a></pre>
256 <pre>(browse to) <a target="_blank" title="mapsdemo app, hopefully functional"
257 href="http://mapsdemo.cakelampvm.com">http://mapsdemo.cakelampvm.com</a></pre>
258 <p>These should show local sites on the VM rather than sites on the
259 internet. If you instead get failures to find the domains, or if the
260 "real internet" site comes up for cakelampvm.com (the page covered with
261 red X marks and complaining), then the DNS is not hooked up properly yet.</p>
262 <h4>Troubleshooting the DNS</h4>
263 <p>If your pings are getting the wrong answers and you're certain the DNS
264 settings on your Host PC are right, then you may need to flush your DNS
265 cache, and that might be sufficient. On Windows, the command for
267 <pre>> ipconfig /flushdns</pre>
268 <p>and on Linux the flush DNS command can be many different things, but try
269 these two most common options:</p>
270 <pre># sudo service dns-clean restart # restarts the client side DNS cache.</pre>
272 <pre># sudo service nscd restart # restarts the nscd caching server.</pre>
273 After, this try the pings again. If they still fail, please go back
274 over your DNS configuration very carefully. The cakelampvm's DNS
275 feature *does* actually work, but operating systems sometimes do their best
277 <h4>Troubleshooting the Apache Sites</h4>
278 <p>If your DNS pings and lookups are functioning properly, but you're just
279 not getting the right websites, then try clearing your browser's cache and
280 shutting the browser application down. Then, start the browser up
281 and try the address again. Often this cache dumping is enough to fix
282 the browser so that you start seeing the local website versions on
284 <h3>Setting up DNS on Windows<a id="#windoze-dns" name="#windoze-dns"></a></h3>
285 <p>The ipconfig tool will provide helpful information about your current
286 networking and DNS configuration:</p>
287 <pre>ipconfig --all</pre>
288 <p>The DNS configuration on Windows is somewhat byzantine. The pipe
289 characters ('|') below are used to separate the menus or tabs or dialogs
290 to traverse. Follow this path to get to the DNS config:</p>
291 <pre>Control Panel | Network & Sharing | click WiFI or Ethernet link near top right | click Adapter Settings on left | click on specific network device to modify | select Properties</pre>
294 <p>{fill in rest}<br>
298 <h2>Editing files on the guest VM from the host<a id="#editing-files-on-vm"
299 name="#editing-files-on-vm"></a></h2>
300 <p>On the host computer, look for the guest vm as a networked computer
301 called cakelampvm. This should provide some network shares using
302 Microsoft SMB protocol, and they can be attached to using the "developer"
303 user and its password.</p>
304 <p>On windows, one may want to mount this network location as a drive letter
305 for easier access.</p>
306 <p>Currently, the root of all web servers is exposed as "www". Editing
307 the files in those folders requires ownership by the developer user.
308 The existing mapsdemo site is owned by a different user ("fred") rather
309 than developer, mostly as a test case. The "fred", "developer", and
310 "www-data" accounts on the VM have all been put into each others Unix
311 "groups" so that they can access each other's files, and thus you may not
312 notice any issues editing fred's files.</p>
313 <p>One should be able to create a new directory over the network also.
314 Try creating a junk folder in the "www" folder, and then deleting it
315 again. That should succeed, and this approach can be used to create
316 folders (from the Host PC) that are owned by the developer user (on the
317 VM). You should be able to create folders or copy files within the
318 developer's home folder also ("/home/developer").</p>
319 <p>If you run into any permission problems that prevent file access, either
320 remotely or within the VM itself, then try running this command to fix
321 them (repeated from the section above about updating the cakelampvm):</p>
322 <pre># revamp_cakelampvm</pre>
323 <p>Afterwards, the www folder and others should allow the developer user to
324 create new folders at will.</p>
325 <h2>Accessing files on the host PC from the guest VM<a id="#samba-shares" name="#samba-shares"></a></h2>
326 <p>If you want to share a folder from the host to the guest, perhaps for
327 driver updates or other conveniences, then make the share with these
330 <li>Create a folder on the host that is to be shared.</li>
331 <li>Right-click on the vm in Virtualbox manager and choose "Settings".</li>
332 <li>In the "Shared Folders" tab of the settings, go to "Machine Folders".</li>
333 <li>Click the folder plus icon to create a new share.</li>
334 <li>Fill in the "Folder Path" on the host PC to the folder that will be
335 shared, and give it a name for the guest. We assume the folder
336 name will be "myshare".</li>
337 <li>On the guest vm, run the following commands to mount the share:<br>
338 <pre># mkdir ~/shared # for the guest's version of the shared folder<br># sudo mount -t vboxsf myshare ~/shared # mount the vm's share name onto the folder on the vm.</pre>
341 <h2>Adding a new website and domain on the guest VM</h2>
342 <p>Note: these instructions, even the quick approaches below, pale in
343 comparison to the ease of use of the "standup" command in feisty meow's
344 site avenger scripts. The standup command is detailed in the <a
345 target="_blank" title="useful commands" href="https://feistymeow.org/feisty_meow/documentation/feisty_meow_command_reference.txt">feisty
346 meow command reference</a> document. These instructions are for
347 situations when the domain or site is idiosyncratic in some way that
348 standup doesn't support.</p>
349 <p>To add a new website, you will first need to pick one of the DNS options
350 below (A or B) depending on how you want to name the site. If the
351 DNS name of the site is contained within another existing domain (e.g.,
352 "A.B.C" has subdomain A contained in domain B.C), use Option A. If
353 the DNS name is a so-called "Second Level Domain" (SLD), then it stands on
354 its own (e.g., "B.C" is an SLD).</p>
355 <p>Once the DNS option has been picked and implemented, continue to the next
356 section of "Creating a New Apache Site".</p>
357 <p>For either Option A or Option B, first connect to the cakelampvm via ssh
358 as the developer user, e.g.: ssh developer@cakelampvm.com </p>
359 <h3>DNS Option A: Adding a sub-domain in an existing domain</h3>
360 <p>Let us say a customer needs an application called "excalibur". It
361 will be a new subdomain within an existing domain, such as the
362 "cakelampvm.com" domain, meaning we want the VM to start answering
363 requests for "excalibur.cakelampvm.com".</p>
364 Note that this option requires the containing domain "cakelampvm.com" to
365 already exist before adding the subdomain; see DNS Option B below for
366 details on how to add a containing domain for the first time.
367 <h4>Quick approach: Use the feisty meow "add_domain" command.</h4>
368 <p>Run this command in a bash shell on the VM:</p>
369 <pre># add_domain excalibur.cakelampvm.com</pre>
371 <h4>Manual approach: Edit the bind9 configuration.</h4>
372 <p>Note: the manual approach is not compatible with later use of feisty
373 meow's "remove_domain".</p>
374 Execute the following command to edit the DNS file for the cakelampvm
376 <pre># sudo vi /etc/bind/cakelampvm.com.conf</pre>
377 <p>Add a stanza for the new site at the end of this file:</p>
378 <pre>excalibur.cakelampvm.com. IN A 10.28.42.20<br> IN HINFO "linux server" "ubuntu"</pre>
379 <p>Restart the DNS server:</p>
380 <pre># sudo service bind9 restart</pre>
381 <p>Afterwards, pinging excalibur.cakelampvm.com should work from both the
382 guest VM and the host PC.</p>
383 <h3>DNS Option B: Using an entirely new domain for the site</h3>
384 <p>This is a similar procedure to Option A, but we will create a totally new
385 config file for the new domain and add it to the bind directory. For
386 this example, we need to add the site "excalibur.tv" into the DNS.</p>
387 <h4>Quick approach: Use the feisty meow "add_domain" command.</h4>
388 Run this command in a bash shell on the VM:
389 <pre># add_domain excalibur.tv</pre>
391 <h4>Manual approach: Edit a new DNS config file</h4>
392 <p>Note: the manual approach is not compatible with later use of feisty
393 meow's "remove_domain".</p>
394 Create a file called /etc/bind/excalibur.tv.conf for our new domain
395 excalibur.tv with these contents:
396 <pre>$TTL 1W<br>@ IN SOA @ fred.cakelampvm.com. (<br> 2017100801 ; serial<br> 2H ; refresh<br> 8M ; retry<br> 14D ; expiry<br> 6H ) ; minimum<br><br> IN NS ns.cakelampvm.com.<br> IN MX 10 mail.cakelampvm.com.<br><br># new SLD for our excalibur site.<br>excalibur.tv. IN A 10.28.42.20<br> IN HINFO "linux server" "ubuntu"</pre>
397 The gnarly prefix stuff above the "excalibur.tv." listing establishes
398 configuration info for the new domain. This file relies on the
399 existing cakelampvm.com infrastructure in DNS, such as the "ns" host, which
400 is the domain's name server. However, the new domain does <span style="text-decoration: underline;">not</span>
401 live inside the cakelampvm.com domain.<br>
402 <p>Now that the config file is in place, edit "/etc/bind/named.conf.local"
403 to add the new file by adding this bit of configuration at the end:</p>
404 <pre>zone "excalibur.tv" in {<br> file "/etc/bind/excalibur.tv.conf";<br> type master;<br> allow-query { any; };<br>};</pre>
405 <p>Restart the DNS server:</p>
406 <pre># sudo service bind9 restart</pre>
407 <p>Afterwards, pinging excalibur.tv should work from both the guest and the
409 <h3>Creating a New Apache Site</h3>
410 <p>First, connect to the cakelampvm via ssh as the developer user, e.g.: ssh
411 developer@cakelampvm.com </p>
412 <h4>Quick approach: Use the feisty meow "add_apache_site" command.</h4>
413 <p>Run this command in a bash shell on the VM:</p>
414 <pre># add_apache_site excalibur excalibur.tv</pre>
415 <p>(The first parameter is the application name, the second is the domain
418 <h4>Manual approach: Edit an Apache config file</h4>
419 <p>Note: the manual approach is not compatible with later use of feisty
420 meow's "remove_apache_site".</p>
421 <p>For Apache, the choice of DNS Option A or B, subdomain or SLD, does not
422 matter. The site configuration file just has to accurately specify
423 the domain in question.</p>
424 <p>Start with the following template file for the new website, and modify it
425 for the appropriate host name and "DocumentRoot" path:</p>
426 <pre><VirtualHost *:80><br> ServerName excalibur.tv
427 DocumentRoot /home/apps/excalibur<br> ErrorLog ${APACHE_LOG_DIR}/excalibur.tv-error.log<br> CustomLog ${APACHE_LOG_DIR}/excalibur.tv-access.log combined<br> Include /etc/apache2/conf-library/basic-options.conf<br> Include /etc/apache2/conf-library/rewrite-enabling.conf<br></VirtualHost></pre>
428 <p>The above example is appropriate for our excalibur app in the
429 excalibur.tv domain (using DNS Option B). Modifying the excalibur.tv
430 references in it (and the path in the DocumentRoot) is sufficient to
431 re-target it for any domain you want.</p>
432 <p>Copy the new site config file into "/etc/apache2/sites-available" with an
433 appropriate file name that includes the site's domain name. We will
434 call our config file "excalibur.tv.conf". If you developed the file
435 in your home folder, this would be the command to move it up to Apache:</p>
436 <pre># sudo cp ~/excalibur.tv.conf /etc/apache2/sites-available</pre>
437 <p>Then tell apache to use the new file:</p>
438 <pre># sudo a2ensite excalibur.tv # the '.conf' portion of the filename is unnecessary for this command.
440 <p>Finally, restart apache to get it to begin serving the site:</p>
441 <pre># sudo service apache2 restart</pre>
442 <h3>Test the new web site</h3>
443 <p>Given the configuration above, your host PC should now be able to access
444 the new website on the domain "excalibur.tv".</p>
445 <p>To test this, first try pinging the new DNS name:</p>
446 <pre># ping excalibur.tv</pre>
447 <p>If there are responses to the ping *and* the answer is 10.28.42.20, then
448 it means the DNS is working. If there are no responses or it's some
449 other IP address talking back, check the instructions in the above DNS
451 <p>Once the DNS is working, try browsing to the site at "<a title="it's excalibur, wilbur!"
452 href="http://excalibur.tv">http://excalibur.tv</a>". That should
453 at least bring up the configured site storage path, even if nothing is
454 being served from that folder yet.</p>
455 <p>If the new site is not showing up properly, try examining the apache logs
456 for any error messages that can be corrected. The log files are
457 stored in "/var/log/apache2" and are named after the website (if
458 configured through the above process).</p>
459 <h2>Handy Techniques for Using cakelampvm</h2>
460 <h3>Assorted Guides and Cheat-Sheets</h3>
461 <p>A Cheat sheet for the Vim editor (there are many of these available): <a
462 target="_blank" title="vim commands" href="https://vim.rtorr.com/">https://vim.rtorr.com/</a></p>
463 <p>A git branching model that seems to work well: <a target="_blank" title="release and patch process"
464 href="http://nvie.com/posts/a-successful-git-branching-model/">http://nvie.com/posts/a-successful-git-branching-model/</a></p>
465 <h3>Get the network address on the guest vm</h3>
466 <p>Run this command:</p>
467 <pre># ifconfig</pre>
468 <p>In the results, look for "<span style="font-family: monospace;">inet addr</span>".
469 There may be more than one, if there are multiple network interfaces.</p>
470 <p>The standard IP address is 10.28.42.20 for the cakelampvm.</p>
471 <h3>How to cleanly reboot or shut down the guest VM</h3>
472 <p>When you've got the DNS and everything integrated, these commands will
473 manage the vm's state:</p>
474 <p>First, log into the guest VM:</p>
475 <pre># ssh developer@cakelampvm.com</pre>
476 <p>Then, to reboot the guest VM:</p>
477 <pre># sudo reboot</pre>
478 <p>Or, to halt the guest VM:</p>
479 <pre># sudo shutdown -h now</pre>
480 <p>Using these commands is kinder to the VM than just cycling the power from
481 the Virtualbox control panel.</p>
482 <h1>Gritty Details of the Nitty Variety<a id="#nitty-gritty" name="#nitty-gritty"></a></h1>
483 <p>This is the lowest level of plumbing for your VM. Hopefully you
484 will not need to engage with this section. The most useful doc
485 section here is the one below about the "Virtualbox guest additions",
486 which you will probably need at some future point. Oracle releases
487 updates to the guest additions fairly regularly.</p>
488 <h2>Configuring the guest VM</h2>
489 <p>The guest VM should already be set up appropriately. These steps
490 are provided for reference and updates.</p>
491 <h3>Set up Virtualbox guest additions for the VM</h3>
492 This procedure is needed if the guest provides an older or incompatible
493 version of the guest additions (which have already been installed on the
494 guest vm). It may also be necessary when a new version of the guest
495 additions becomes available.
497 <li>To install the guest additions, open the guest VM and have its window
499 <li>Choose the "Devices" menu and select "Insert Guest Additions CD
500 Image". This will mount the CD's ISO image on the VM.</li>
501 <li>On the guest VM, it may be necessary to mount the CD image that's now
503 <pre># sudo mount /dev/sr0 /media/cdrom</pre>
504 <p>Linux will mention that the device is mounted "read-only".</p>
506 <li>Since the VM currently has no windowing system installed, one must
507 start the Guest Additions install manually:<br>
508 <pre># cd /media/cdrom<br># sudo sh VBoxLinuxAdditions.run</pre>
510 <li>The latest Virtualbox guest additions should now be installed.</li>
512 <h3>Set up network adapters on guest VM</h3>
513 <p>The network interfaces should already be configured on the guest within
514 the Virtualbox configuration. This is available by clicking on the
515 VM in the Virtualbox manager and selecting "Settings". These are the
516 configuration settings used:</p>
518 Attached to: Host-only Adapter<br>
519 Name: vboxnet0 <br>
521 Attached to: Nat Network<br>
522 Name: NatNetwork</p>
523 <p>On the guest VM itself, the network settings are specified in a file
524 called /etc/network/interfaces. Here are the current contents of
526 <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>
527 <pre>auto enp0s8</pre>
528 <pre>iface enp0s8 inet dhcp</pre>
530 <h2>Notes on building the Cake Lamp VM</h2>
531 <p>This is all work that should already have been done. It is
532 mentioned here just as breadcrumbs for a future vm builder.</p>
534 <li>Downloaded and installed Virtualbox for host computer (where the vm
535 image will be built).</li>
536 <li>Downloaded ubuntu server 16.04 iso. (<a target="_blank" title="ubuntu server"
537 href="https://www.ubuntu.com/download/server">https://www.ubuntu.com/download/server</a>)</li>
538 <li>Created a new vm in Virtualbox, telling it to start from the ubuntu
540 <li>Installed LAMP stack on guest VM. Some help here: <a target="_blank"
541 title="lamplighter" href="http://howtoubuntu.org/how-to-install-lamp-on-ubuntu">http://howtoubuntu.org/how-to-install-lamp-on-ubuntu</a></li>
542 <li>Configured CAKE on the guest VM. Useful link: <a target="_blank"
543 title="cakebundtu" href="https://askubuntu.com/questions/628938/how-to-install-cakephp-in-ubuntu-14-04">https://askubuntu.com/questions/628938/how-to-install-cakephp-in-ubuntu-14-04</a></li>
544 <li>Configured the two network adapters as needed (one for host-only
545 network and one for nat network). Here's some info about
546 Virtualbox networking with two adapters similar to our setup: <a target="_blank"
547 href="https://askubuntu.com/questions/293816/in-virtualbox-how-do-i-set-up-host-only-virtual-machines-that-can-access-the-in">https://askubuntu.com/questions/293816/in-virtualbox-how-do-i-set-up-host-only-...</a><br>
549 <li>Installed and configured Samba service for the guest VM. The
550 main config file lives in "/etc/samba/smb.conf". Some pointers
551 here: <a target="_blank" href="https://help.ubuntu.com/community/How%20to%20Create%20a%20Network%20Share%20Via%20Samba%20Via%20CLI%20%28Command-line%20interface/Linux%20Terminal%29%20-%20Uncomplicated%2C%20Simple%20and%20Brief%20Way%21">https://help.ubuntu.com/community/How%20to%20Create...</a></li>