Milestone 6: Server Platform
For this milestone, you will install a configure a simple HTTP server and test that server using a text-mode web browser. You will also enable the cron service, add local documentation to the system, and install locale support for the C library.
Milestone Worksheet
Please download the following worksheet for Milestone 6. To be sure your browser downloads the file instead of trying to open it, right-click the following link and choose “Save As,” “Save Link As,” or similar language from the menu. (Each browser is a little different in what wording it uses.)
Background
Please read the following background lessons:
As you complete the readings, fill in the top part of the Milestone Worksheet. Note that you will need to return to these instructions in order to get the commands needed for the steps in this milestone like you did in the previous milestone.
Procedure
Step 1: Boot the Pi and Run Updates
Boot the Pi and log in as your regular user. Verify that your network connected by running:
ip a s
Run updates using:
doas apk update
doas apk upgrade
Watch the output to see if the linux-tealpi5 package gets updated. If there is an update to this package, then you need to reboot the Pi to switch onto the newer version of the kernel.
Step 2: Install Documentation
Follow the instructions from the background page to install documentation.
Step 3: Add Locale Files
In order for the musl C library to be able to format dates and times and support multiple languages, it is necessary to add the musl-locales package:
doas apk add musl-locales
Step 4: Enable cron
The cron service schedules tasks to run automatically in the background. It is included, but not enabled, with a default Alpine Linux install. Enable it using:
doas rc-update add crond
Step 5: Configure Lighttpd
For our HTTP server, we’re going to install Lighttpd, which is pronounced “lighty.” This server is straightforward to install and configure. Begin by installing it:
doas apk add lighttpd
To configure the server, open its configuration file in Neovim:
nvim /etc/lighttpd/lighttpd.conf
You will notice that the sections of the file are collapsed in the Neovim display. Move the cursor down to the + sign on the line that contains the word “variables”. Press the right arrow key to expand the section. Move the cursor down to the line that contains “mod_userdir” (with the quotes). Use the x key in Neovim to remove the comment symbol (#) from the beginning of that line. You should see that 3 modules are enabled: mod_access, mod_userdir, and mod_accesslog.
Now move the cursor down to the + sign on the line that contains mod_userdir. Press the right arrow key to expand this section. Use the x key in Neovim to remove the leading comment symbol (#) and space from the following two directives:
userdir.path = "public_html"
userdir.exclude-user = ("root")
Now we need to save the file as the root user. To do so, use the :W (capital W) command we created in the previous milestone. Enter your regular user password when prompted. Confirm that the file has been written (as root), then exit Neovim with the :q command.
Enable and start the server by running:
doas rc-update add lighttpd
doas rc-service lighttpd start
Step 6: Create a Test HTML Page
In order to test the server, we need to create a simple HTML page. Since we enabled mod_userdir, we can actually create this page inside a public_html directory in our user account’s home directory. Run:
cd
mkdir public_html
cd public_html
nvim index.html
Be careful about the spelling and capitalization! If the directory name is wrong, or if the file is named something else, this test will not work.
In your index.html file, type in a basic HTML document, replacing YOUR NAME with your first and last name:
<!DOCTYPE html>
<html>
<head>
<title>Test Page</title>
</head>
<body>
<h1>CSCI 311 - Spring 2025</h1>
<p>My name is YOUR NAME.</p>
</body>
</html>
Check that your HTML code is correct (remember CSCI 120?). Save and exit Neovim.
Step 7: Install Lynx
Follow the instructions from the background page to install the Lynx browser.
Step 8: Test the Server
Open the test site you created by running the following command. Replace USERNAME with your username:
lynx http://localhost/~USERNAME
Note the symbol before your username is a tilde (~), which is normally located in the upper-left section of a United States keyboard.
If the test is successful, you should see CSCI 311 - Spring 2025 highlighted and centered at the top of the Lynx browser. The statement with your name should be on the next line. A successful result indicates that Lynx was able to contact the lighttpd server running on your local system and retrieve the index.html file from your user website directory.
If Lynx fails to load the page, then you probably have an issue with the server configuration. Go back and double-check Step 5.
Submission Guidelines
For this milestone, your submission photo will show that your test website is working in Lynx, so leave the browser open from the last step of the procedure.
Check Your Work
Verify the following:
- Your screen displays the Lynx browser.
- The heading at the top of the page shows CSCI 311 - Spring 2025.
- Your first and last name are contained in a sentence on the page.
Prepare Your Submission
Use your phone to take a photo of your screen, since you don’t yet have a screenshot tool available on the Pi. Transfer the photo to your computer, and replace the placeholder image in the Milestone Worksheet with your photo. Export the worksheet to PDF format, and upload the PDF to Moodle as the submission for the Milestone 6 assignment activity.
As a reminder, here are the instructions for editing the worksheet in either LibreOffice or Word Online:
ABET Assessment
Successful completion of this assignment satisfies the following performance indicator:
- IT 6.3. Select systems appropriate for different user and environment requirements.