{"id":79101,"date":"2026-11-17T02:03:59","date_gmt":"2026-11-17T02:03:59","guid":{"rendered":"http:\/\/bangla.sitestree.com\/?p=79101"},"modified":"2026-11-17T02:03:59","modified_gmt":"2026-11-17T02:03:59","slug":"linux-advanced-2-07-capstone","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=79101","title":{"rendered":"Linux Advanced 2 07 \u2014 Capstone: Build, Diagnose, and Recover a Linux Service"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/bangla.sitestree.com\/?name=linux-course-index\">Linux course index<\/a> \u00b7 <a href=\"https:\/\/bangla.sitestree.com\/?cat=1993\">Linux Advanced 2 category<\/a> \u00b7 Lesson 7 of 7<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>AI disclosure<\/strong> \u2014 AI-generated content, posted as is. AI can make mistakes. This extension adds new material and links related posts from this site. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Learning goal<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Demonstrate Linux service deployment, evidence-led incident diagnosis, and recovery in one lab.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Concepts and setup<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use a disposable VM with Bash, curl, tar, and Python 3. Everything in this capstone starts in a temporary lab directory and binds only to loopback. Keep the same shell for the whole exercise. The site&#8217;s boot, Apache, networking, and archive posts inform the checklist. The Python web server is for a local lab, not a production HTTP service.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The service is healthy only when the expected content is served, not merely when a PID exists. Save a baseline, introduce one known file fault, collect evidence before changing anything else, and prove the service returns to its original response.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Build the baseline and archive the fixture<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>lab=$(mktemp -d)\nmkdir &quot;$lab\/site&quot;\nprintf 'course-check=ready\\n' &gt; &quot;$lab\/site\/index.html&quot;\ntar -czf &quot;$lab\/site.tgz&quot; -C &quot;$lab\/site&quot; index.html\nport=8089\n# Make sure this local port is free before starting.\nss -ltn &quot;sport = :$port&quot;\npython3 -m http.server &quot;$port&quot; --bind 127.0.0.1 --directory &quot;$lab\/site&quot; \\\n  &gt; &quot;$lab\/server.log&quot; 2&gt;&amp;1 &amp;\npid=$!\n# Wait for the server to start before the next check.\ncurl -fsS &quot;http:\/\/127.0.0.1:$port\/index.html&quot;\nps -p &quot;$pid&quot; -o comm=<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>State Recv-Q Send-Q Local Address:Port Peer Address:Port\ncourse-check=ready\npython3<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If another process already listens on 8089, choose another unused unprivileged port. Stop if the baseline response does not match your fixture.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Create one controlled fault and restore<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>mv &quot;$lab\/site\/index.html&quot; &quot;$lab\/index.saved&quot;\ncurl -sS -o \/dev\/null -w 'HTTP %{http_code}\\n' &quot;http:\/\/127.0.0.1:$port\/index.html&quot;\ntail -n 3 &quot;$lab\/server.log&quot;\ntar -tzf &quot;$lab\/site.tgz&quot;\ntar -xzf &quot;$lab\/site.tgz&quot; -C &quot;$lab\/site&quot; index.html\ncmp &quot;$lab\/index.saved&quot; &quot;$lab\/site\/index.html&quot;\ncurl -fsS &quot;http:\/\/127.0.0.1:$port\/index.html&quot;\nkill -TERM &quot;$pid&quot;\nwait &quot;$pid&quot; 2&gt;\/dev\/null || true<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>HTTP 404\n... code 404, message File not found\n... &quot;GET \/index.html HTTP\/1.1&quot; 404 -\nindex.html\ncourse-check=ready<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Only signal the child started by this shell in the first block. This fault leaves the listener intact. A restart is not necessary because the file, not the process, was broken.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What to submit and how it is graded<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Submit a short runbook and a table with baseline, fault, and restored state. Include the command, timestamp, and relevant output for each observation. Do not submit secrets or host identifiers. Score out of 20. Award 5 for a reproducible baseline, 5 for using logs and checks to isolate the fault, 5 for restoring and verifying content, and 5 for a credible improvement with an acceptance test.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Questions only<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Quick-check questions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>What did the HTTP 404 establish about the network and service path?<\/li>\n\n\n<li>Why keep pre-repair evidence?<\/li>\n\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Assessment questions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Write a short incident narrative with symptom, cause, evidence, repair, and verification.<\/li>\n\n\n<li>What observations would change if the process itself had exited?<\/li>\n\n\n<li>Propose one security or recovery improvement and a test to prove it works.<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Questions and answers<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Quick-check answers<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li><strong>What did the HTTP 404 establish about the network and service path?<\/strong><br><strong>Answer<\/strong> \u2014 The client reached an HTTP listener and received a valid response, but the named resource was unavailable.<\/li>\n\n\n<li><strong>Why keep pre-repair evidence?<\/strong><br><strong>Answer<\/strong> \u2014 It lets you separate cause from coincidence and verify that repairs changed the expected symptom.<\/li>\n\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Assessment answer key<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li><strong>Write a short incident narrative with symptom, cause, evidence, repair, and verification.<\/strong><br><strong>Answer<\/strong> \u2014 Example: the baseline served the marker, moving index.html produced 404 with matching logs, the archive restored that exact member, cmp matched, and curl returned the original marker.<\/li>\n\n\n<li><strong>What observations would change if the process itself had exited?<\/strong><br><strong>Answer<\/strong> \u2014 The listener should disappear and curl could fail to connect rather than receiving a valid status. Verify process and binding separately.<\/li>\n\n\n<li><strong>Propose one security or recovery improvement and a test to prove it works.<\/strong><br><strong>Answer<\/strong> \u2014 For example, put the fixture under a restricted service identity and show it still serves the intended page, but cannot read data outside the allowed directory.<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Related source articles on this site<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=78691\">Q &amp; A:  Linux: Switch Users, Boot Process, File System<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=78439\">Basic Commands for Networking in Linux<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=65718\">On Thursday and Friday tar all contents of \/etc folder into \/export\/home\/shell\/test\/etc.tar .. do misc logs #Linux\/Unix: Shell Programming \u2013 001<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=78613\">Using Let\u2019s Encrypt With Apache2 (HTTPS Setup)<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=76443\">Linux: Disk Space, Memory Space, Running Processes<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=9949\">\u0987\u0989\u09a8\u09bf\u0995\u09cd\u09b8\u0983 \u09b8\u09bf\u09b8\u09cd\u099f\u09c7\u09ae \u09b2\u0997\u09bf\u0982 (Unix \u2013 System Logging)<\/a><\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Continue the course<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Previous lesson 06 \u2014 Encrypted Backups and Restore Drills. This is the last lesson in this level. See the course index for the next level.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/bangla.sitestree.com\/?name=linux-course-index\">Linux course index<\/a> \u00b7 <a href=\"https:\/\/bangla.sitestree.com\/?cat=1993\">Linux Advanced 2 category<\/a> \u00b7 Lesson 7 of 7<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Demonstrate Linux service deployment, evidence-led incident diagnosis, and recovery in one lab.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1993],"tags":[],"class_list":["post-79101","post","type-post","status-publish","format-standard","hentry","category-linux-advanced-2","item-wrap"],"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":79102,"url":"http:\/\/bangla.sitestree.com\/?p=79102","url_meta":{"origin":79101,"position":0},"title":"Linux Administration Course \u2014 Start Here and Lesson Index","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"A 33-lesson Linux course from shell fundamentals to server administration, performance, and a recovery capstone.","rel":"","context":"In &quot;Linux Basics&quot;","block_context":{"text":"Linux Basics","link":"http:\/\/bangla.sitestree.com\/?cat=1990"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79100,"url":"http:\/\/bangla.sitestree.com\/?p=79100","url_meta":{"origin":79101,"position":1},"title":"Linux Advanced 2 06 \u2014 Encrypted Backups and Restore Drills","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Create an encrypted Restic snapshot and verify a real restore into a separate directory.","rel":"","context":"In &quot;Linux Advanced 2&quot;","block_context":{"text":"Linux Advanced 2","link":"http:\/\/bangla.sitestree.com\/?cat=1993"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79094,"url":"http:\/\/bangla.sitestree.com\/?p=79094","url_meta":{"origin":79101,"position":2},"title":"Linux Advanced 09 \u2014 MariaDB Service Accounts and Restore Verification","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Check a Linux-hosted MariaDB service, identify least-privilege database roles, and test a logical restore.","rel":"","context":"In &quot;Linux Advanced&quot;","block_context":{"text":"Linux Advanced","link":"http:\/\/bangla.sitestree.com\/?cat=1992"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79093,"url":"http:\/\/bangla.sitestree.com\/?p=79093","url_meta":{"origin":79101,"position":3},"title":"Linux Advanced 08 \u2014 Apache Virtual Hosts and HTTPS","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Test Apache name-based routing locally and verify HTTPS with certificate and renewal checks.","rel":"","context":"In &quot;Linux Advanced&quot;","block_context":{"text":"Linux Advanced","link":"http:\/\/bangla.sitestree.com\/?cat=1992"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79095,"url":"http:\/\/bangla.sitestree.com\/?p=79095","url_meta":{"origin":79101,"position":4},"title":"Linux Advanced 2 01 \u2014 Hardening a systemd Service","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Run a small systemd service with a dedicated dynamic identity and a narrow writable directory.","rel":"","context":"In &quot;Linux Advanced 2&quot;","block_context":{"text":"Linux Advanced 2","link":"http:\/\/bangla.sitestree.com\/?cat=1993"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79097,"url":"http:\/\/bangla.sitestree.com\/?p=79097","url_meta":{"origin":79101,"position":5},"title":"Linux Advanced 2 03 \u2014 Repeatable Configuration with Ansible","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Convert a small configuration task into an Ansible playbook and demonstrate idempotence.","rel":"","context":"In &quot;Linux Advanced 2&quot;","block_context":{"text":"Linux Advanced 2","link":"http:\/\/bangla.sitestree.com\/?cat=1993"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=79101"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79101\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=79101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=79101"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=79101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}