Web Services: Installing Apache

10 minutes
  • 2 Learning Objectives

About this Hands-on Lab

Installing and managing services is one of the first things a Linux Server Administrator should learn how to do. The standard example of a web service is a “LAMP stack” – Linux, Apache, MySQL, PHP. In this lab, we’ll practice installing and configuring Apache on a Linux server.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Install and Configure Apache
  1. Now we need to install the software. Run the following command:

    yum install httpd -y

    Start the httpd service with:

    systemctl start httpd
  2. Now we’ve been directed to use a specific DocumentRoot. So we need to edit the configuration file to set that correctly.

    vim /etc/httpd/conf/httpd.conf
  3. In that file, search for the DocumentRoot by typing /DocumentRoot. The DocumentRoot section is the path that the httpd service uses to produce an app/website.

  4. Set line 119, DocumentRoot, to "/opt/website". Also, set the <Directory> tags in lines 124, and 131 to <Directory /opt/website>.

  5. Save and quit the file with :wq.

  6. Restart to initiate changes to the file:

    systemctl restart httpd
Test the Configuration
  1. Verify the webpage is accessible by "curling" your server:
    curl localhost
  2. Go to a browser (e.g. Chrome) and paste in the IP address of the Cloud Server. If successful, you’ll see a great website. We hope you love dad jokes!

Additional Resources

You have just started working at DadCorp, a new startup providing a subscription service that emails dad jokes to customers. The majority of the data center is web servers containing the sign-up forms.

When the load gets too high, a new webserver is built. You've received your first ticket to set up a new web server. You've already deployed a CentOS 7 server, now you just need to deploy Apache and set the Document Root to /opt/website which is where the developers have already placed their code.

To get started, we need to log in to our servers:

  1. Use ssh and the provided lab credentials to log in to our server. Be sure to keep the Cloud Server's public IP handy. You'll need it momentarily:

    ssh cloud_user@<PUBIC_IP>
  2. Become the root user:

    sudo -i

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!