1. Prerequisites

Definitions
  • $ in front of an instruction mean that you have to invoke this at the prompt

2. Topic: Install Apache

2.1. Introduction

(1 pmd: subtotaal 2)

In the previous days we learned the basics regarding Linux and the commandline. Now you are working on Acme Corporations and we are getting to the point where the rubber hits the road and we are going to install an Apache HTTP Server on Linux

2.2. Learning objectives

By the end of this module, learners will be able to
  • describe the interactions and responsibilities when we are installing a YUM package, e.g. the httpd

  • Identify the necessary configurations to support Apache

  • Create Apache resources by modifying the httpd.conf file

  • Test the Apache resources by issuing curl commands and validating the response

2.3. Why and When: Install Apache

We are going to install the Apache Server since a new customer of our Acme firm needs some functionality which Apache delivers e.g. response to an HTTP request

2.4. Instructor Demo: Install Apache

In this demo, we’ll illustrate
  • Installing of YUM packages (yum install)

  • Installing Apache Http Server

  • Setting up Apache Http Server

  • Configure Http Server

  • Test Http Server

We will install Apache Http Server from YUM using the follow commands
  • $ yum search

  • $ yum install

  • $ …​

2.4.1. Demo summary

Apache is an Http Server which is able to respond to an HTTP request and serve static pages

  • Install

    • yum search

    • yum install

  • Configure

  • Start / Restart

    • $ sudo systemctl start <application>

    • $ sudo systemctl restart httpd

General form
$ systemctl status / reload / restart / stop / start <application>

2.5. Intermediate takeaway

Q & A before entering the exercise ???

2.6. Exercise: Install Apache

(2 pmd: subtotaal 4)

Prerequisites
  • Check the permissions on the files e.g. /etc/httpd/httpd.conf and /var/www/html (chmod and touch, mkdir commands are helpful)

  • Just to be sure check the available space on the server (df / du commands are needed)

  • To install packages you need root access

Target
  • Learning your way in Linux using Apache Httpd config file httpd.conf

  • Learning your way in Linux using the DocumentRoot directory of Apache

Roadmap
  • Modify the httpd.conf file

  • Creating a personalized index.html file

Validation ⇒ Now we have to test the correct working of Apache Http Server
  • Modify a file in the /var/www/html directory and validate the changes are shown after a reload of the webpage

2.6.1. Takeaway

In this exercise, you have made a plan, reviewed the plan and set up Apache Http Server
  • Why did we need YUM

  • Why is YUM used for packaging Linux applications

  • How to add Apache to your Linux machine

  • Did you find some new commands during the case?

    • What did you do to find the working of the unknown command(s)?

2.7. Bonus Exercise 1

(1 pmd: subtotaal 5)

Nice to haves
  • Create a script which installs, starts and tests (using curl) the Apache Http Server

  • Add a VirtualHost to your Apache Configuration

  • Optional: Add the epel repository on the server (look this up on the internet)

  • Optional: As sysadmins are lazy, try to create some aliases (use the command)

2.8. Bonus exercise 2

Case 2

In case :-), your are done with the previous case, you can start the second case which will be introduced by the trainer.

2.9. Bonus exercise 3

Bonus Logging
  • Use the tail command to show the logging: $ tail -f /var/log/httpd/error.log and -access.log

3. Showtime

(1 pmd: subtotaal 6)

Show the team the result you have created!!!

4. Interesting reads

Apache Http Server

Apache Http Server

YUM command cheat sheet

YUM command cheat sheet

TecMint Linux Tutorials

TecMint Linux Tutorials