forked from sq9890xp/MIS362
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIOT05.html
391 lines (276 loc) · 14.3 KB
/
IOT05.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
<!doctype html>
<html lang="en">
<head>
<title>IOT05</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- PgP 7/11/2019 summative assignment for Raspberry Pi, Arduino Uno, micro:bit -->
<!-- Bootstrap -->
<link href="../../ReadOnly/bootstrap.css" rel="stylesheet">
<!-- constant file for student firstname, lastname, starid on students' pages -->
<script src="../constants.js"></script>
<!-- course constant file that contains semester, class, section pages -->
<script src="../../ReadOnly/CourseConstants.js"></script>
</head>
<body onload="setVariables()">
<form class="container-fluid" action="https://eprofessor.azurewebsites.net/code/ProcessFormData.asp" method="post" name="frmAssignment" id="frmAssignment">
<input name="InstID" type="hidden" id="InstID" value="00617282">
<h1 class="text-center">Apache2 Webserver on a Raspberry Pi</h1>
<!-- -start-Student, class and assignment information. Assignment hard-coded, other values from constants.js file-start -->
<div class="row col-lg-12">
<div class="col-lg-3">
<label class="text-primary" for="FirstName">First Name:</label>
<input class="form-control" name="FirstName" id="FirstName" type="text" value="default first name" readonly="readonly">
</div>
<div class="col-lg-3">
<label class="text-primary" for="LastName">Last Name:</label>
<input class="form-control" name="LastName" id="LastName" type="text" value="default last name" readonly="readonly">
</div>
<div class="col-lg-3">
<label class="text-primary" for="pin">StarID:</label>
<input class="form-control" name="pin" id="pin" type="text" value="default StarID" readonly="readonly">
</div>
<div class="col-lg-3">
<label class="text-primary" for="email">Email:</label>
<input class="form-control" name="email" id="email" type="email" value="default email address" readonly="readonly">
</div>
</div>
<div class="row col-lg-12">
<div class="col-lg-3">
<label class="text-primary" for="semester">Semester:</label>
<input class="form-control" name="semester" id="semester" type="text" value="default" readonly="readonly">
</div>
<div class="col-lg-3">
<label class="text-primary" for="class">Class:</label>
<input class="form-control" name="class" id="class" value="xClass" type="text" readonly="readonly">
</div>
<div class="col-lg-3">
<label class="text-primary" for="section">Section:</label>
<input class="form-control" name="section" id="section" value="default" type="text" readonly="readonly">
</div>
<div class="col-lg-3">
<label class="text-primary" for="assignment">Assignment:</label>
<input class="form-control" name="assignment" id="assignment" value="IOT05" type="text" readonly="readonly">
</div>
</div>
<!-- -end-Student, class and assignment information-end -->
<br />
<!-- Calculate the correct path for saving the files -->
<script>Path = "\OneDrive - MNSCU\" + xClass + "\" + document.getElementById("assignment").value + "\"; </script>
<div class="col-lg-12">
<br />
<input class=" text-danger btn-block btn-lg" type="submit" name="Submit" value="SUBMIT -once you have completed this assignment- SUBMIT"><br />
</div>
<div class="h3 text-danger col-lg-12">
100 Points<hr />
</div>
<div class="col-lg-12"><a href="#Objectives" class="btn btn-info" data-toggle="collapse">Learning Objectives</a></div>
<div id="Objectives" class=" collapse in col-lg-12">
<p>
These instructions will show you how to run Apache2 website software on a Raspberry Pi.<br />
<br />
More information on <a href="https://httpd.apache.org/" class="bg-info text-white" target="_blank">Apache</a> is available online.<br />
Being able to use this software will greatly simplify working with the Raspberry Pi to learn how websites work.
</p>
<p>After completing this assignment you will be able to:</p>
<ol>
<li>Run Apache2 on a Raspberry Pi</li>
<li>Find and edit a website file served by Apache2</li>
<li>View your (or other's) website on your Raspberry Pi and laptop</li>
</ol>
<hr />
</div>
<div class="col-lg-12"><a href="#Overview" class="btn btn-info" data-toggle="collapse">Assignment Overview</a></div>
<div id="Overview" class="collapse in col-lg-12">
<h3>When you encounter technical issues, please first review <a href="../IOT00/IOT00.html" class="bg-info text-white" target="_blank" >IOT00</a>. </h3>
This assignment reviews basic computer concepts that you will need in this course and throughout your career.
<br />
<p>
You are expected to have a working knowledge of SBC hardware and software.<br />
If you do not understand how to use an item, perform a Google Search,
refer to the <a href="https://learn.winona.edu/WSU_Technology_Knowledge_Base" class="bg-info text-white" target="_blank">WSU Technology Knowledge Base</a>, ask a teaching assistant, or ask the instructor.
</p>
<hr />
</div>
<!--Exercise 1-->
<div class="col-lg-12"><a href="#Exercise01" class="btn btn-info" data-toggle="collapse">Exercise 1-Running Apache2</a><a href="#Exercise01"></a></div>
<div id="Exercise01" class="collapse in col-lg-12">
<p>ref: <a href="https://pimylifeup.com/raspberry-pi-apache/" class="bg-info text-white" target="_blank">PiMyLifeUp Article</a> </p>
<ol>
<li>These steps are performed on the Raspberry Pi.</li>
<li>If Apache webserver is not installed, in the Terminal window enter the following command to install the Apache2 webserver:<br />
<code>
sudo apt install apache2 -7
</code>
</li>
<li>Open a browser and ensure the Apache2 webserver is running by browsing to both these urls:<br />
<code>127.0.0.1</code><br />
<code>current IP address</code> can be found by entering <code>hostname -I</code> into a Terminal window
</li>
<li>If the Apache2 webserver is not running, in a Terminal window enter the following command:<br />
<code>/etc/init.d/apache2 restart</code><br />
To stop the Apache2 webserver, in a Terminal window enter the following command:<br />
<code>/etc/init.d/apache2 stop</code><br />
</li>
<li>After Apache2 begins, the following webpage will load, which you must read.<br />
<p>
<a href="images/apache2.PNG" class="img-responsive img-rounded" target="popup" onclick="window.open('images/apache2.PNG', 'popup'); return false;">
<img src="images/apache2.PNG" width="300" alt="webserver" class="img-responsive img-responsive" /></a>Apache Webserver<br />
</p>
</li>
<li>If the webpage does not appear, troubleshoot and resolve any issues.<br />
</li>
</ol>
<hr />
</div>
<!--Exercise 2-->
<div class="col-lg-12"><a href="#Exercise02" class="btn btn-info" data-toggle="collapse">Exercise 2-Examine Apache2</a></div>
<div id="Exercise02" class="collapse in col-lg-12">
<ol>
<li>These steps are performed on your Raspberry Pi.</li>
<li>The materials on the 'Apache2 Debian Default Page' describe details of the webserver installation.<br />
Note that the local website root folder is at <code>/var/www/html/</code>
</li>
<li>Create a new 'page' for your website by using VNC Viewer to transfer the file '<a href="mypage.html" class="bg-info text-white" target="_blank">mypage.html</a>' from this IOT05 assignment folder to the desktop. <br />
Note a copy of 'mypage.html' is also on the RPi in the Desktop 'IoT_Files' folder<br />
<code>/home/pi/Desktop/</code>
<br />
</li>
<li>In the terminal window do the following to modify the mypage.html file:
<br />
<code>cd Desktop</code> then press Enter<br />
<code>sudo nano mypage.html</code>then press Enter, and you are in superuser(su) edit mode<br />
</li>
<li>Press the space key, then the backspace key, and 'Modified' will appear in the top right corner.<br />
<p>
<a href="images/sudoEdit.PNG" class="img-responsive img-rounded" target="popup" onclick="window.open('images/sudoEdit.PNG', 'popup'); return false;">
<img src="images/sudoEdit.PNG" width="300" alt="edit homepage file" class="img-responsive img-responsive" /></a>Modify mypage.html<br />
</p>
</li>
<li>Press the 'Ctrl+X' keys, then press 'y' and then press 'Enter'
<br />
In the 'File Name to Write' row, enter
<br />
<code>/var/www/html/mypage.html</code><br />
and then press enter.<br />
When asked to save file under a different name, press
'y'<p>
<a href="images/SaveFile.PNG" class="img-responsive img-rounded" target="popup" onclick="window.open('images/SaveFile.PNG', 'popup'); return false;">
<img src="images/SaveFile.PNG" width="300" alt="save homepage file" class="img-responsive img-responsive" /></a>Save homepage to Website Root Folder<br />
</p>
</li>
</ol>
<hr />
</div>
<!--Exercise 3-->
<div class="col-lg-12"><a href="#Exercise03" class="btn btn-info" data-toggle="collapse">Exercise 3-Screenshot</a></div>
<div id="Exercise03" class="collapse in col-lg-12">
<p>
Use your laptop to view your modified webpage on the Raspberry Pi running the Apache2 webserver.<br />
</p>
<ol>
<li>Find the IP address of your Raspberry Pi by opening VNC server in the upper right corner.
</li>
<li>Type this Raspberry Pi IP address into the address bar of your laptop browser.</li>
<li>Your modified home page will appear, similar to below:<br />
<a href="images/NewHomePage.PNG" class="img-responsive img-rounded" target="popup" onclick="window.open('images/NewHomePage.PNG', 'popup'); return false;">
<img src="images/NewHomePage.PNG" width="300" alt="new home page" class="img-responsive img-responsive" /></a>New Home Page<br />
</li>
<li>On the Raspberry Pi, open a text editor and enter the following information:<br />
Your Name<br />
Your Class<br />
Todays Date<br />
IOT05<br />
</li>
<li>Take a screenshot with Apache2 running and displaying 'mypage.html' along with your personal information in the text editor.
</li>
<li>On your laptop save the screenshot as "IOT05" in your '
<code><span id="abPath"></span></code>
<script>document.getElementById("abPath").innerHTML = Path; </script>
' folder.<br />
</ol>
<hr />
</div>
<div class="col-lg-12 text-danger">
<h2>Screenshot IOT05</h2>
<hr />
</div>
<div class="col-lg-12"><a href="#UploadScreenShot" class="btn btn-info" data-toggle="collapse">Upload Screenshot</a></div>
<div id="UploadScreenShot" class="collapse in col-lg-12">
<p>
Submit to the appropriate D2L Assignment folder a screenshot that documents your work.<br />
</p>
<br />
</div>
<div class="col-lg-12 text-primary">
<p>
(50) 1. Upload your screenshot to the 'IOT05' D2L Assignment Folder.
</p>
<hr />
</div>
<!--Exercise 4-->
<div class="col-lg-12"><a href="#Exercise04" class="btn btn-info" data-toggle="collapse">Exercise 4-Reflections</a></div>
<div id="Exercise04" class="collapse in col-lg-12">
<p>
Based on your experience in this exercise and what you just learned, develop a brief statement about the value of Apache2 as a web server software platform for organizations.<br />
Think about what type of problems these devices could solve, and would it be cost-effective?<br />
Consider businesses that deploy IoT 'solutions', on the order of thousands or millions of devices-how can Apache2 equipped Raspberry Pis support or automate these efforts?<br />
One example is the need to monitor and display sensor or actuator information from IoT devices-are they online? are they working? are they reporting problems?<br />
References:<br />
Apache2: <a href="https://httpd.apache.org/" class="bg-info text-white" target="_blank">Apache</a><br />
PiMyLifeUp <a href="https://pimylifeup.com/raspberry-pi-apache/" class="bg-info text-white" target="_blank">Apache2 Article </a>
</p>
<div class="col-lg-12 text-primary">
(20) 2. Reflections-value<br />
<!-- Enter your answer in the VALUE field below GROK -->
<input class="form-control" name="q2" type="text" id="q2" value="value of Apache2 webserver:">
<hr />
</div>
<hr />
<div class="col-lg-12 text-primary">
(20) 3. Reflections-content<br />
Research the internet to determine what type of data (text, numbers, audio, video...) can be displayed in a webserver.<br />
List a use that you find particularly interesting.
<!-- Enter your answer in the VALUE field below GROK -->
<input class="form-control" name="q3" type="text" id="q3" value="interesting web server use:">
<hr />
</div>
<hr />
</div>
<div class="col-lg-12"><a href="#ExerciseSubmit" class="btn btn-info" data-toggle="collapse">Submit Assignment</a></div>
<div class="col-lg-12">
<p>
When all tasks are completed press the Submit button.
</p>
<hr />
</div>
<div class="col-lg-12 text-primary">
(10) 4. Assignment submission<br />
<!-- Enter your answer in the VALUE field below GROK -->
<input class="form-control" name="q4" type="text" id="q4" value="I have completed all the exercises, and uploaded my screenshot to the D2L Assignment folder IOT05.">
<hr />
</div>
<hr />
<hr />
<div class="col-lg-12">
<p>
Congratulations! You have successfully used Apache2, a web server, on a Raspberry Pi single board computer.
</p>
<hr />
</div>
<div class=" col-lg-12">
<br />
<input class=" text-danger btn-block btn-lg" type="submit" name="Submit" value="SUBMIT -once you have completed this assignment- SUBMIT">
<br />
</div>
</form>
<!-- Creative Commons License Info -->
<div id="xLicense" class=" col-lg-12 text-muted"></div>
<div id="xfooter" class=" col-lg-12 text-muted"></div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="../../ReadOnly/jquery-1.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="../../ReadOnly/bootstrap.js"></script>
</body>
</html>