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