In this hands-on lab, we will be using the RPM command to manage our software installations. This may be something you are tasked with to show your proficiency with software management tools.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Using a File from the Packages List, Get the Package Version for the Apache2 Installation
Run the following commands:
rpm -ql apache2 rpm -qf /var/lib/apache2
- In the `default-server.conf`, Modify the Document Root
List the configuration files to locate the
default-server.conf
:rpm -qc apache2
Modify the configuration file:
sudo vim /etc/apache2/default-server.conf
Change the section dealing with document root — we need to change two places.
Change this:
# # Global configuration that will be applicable for all virtual hosts, unless # deleted here, or `overriden` elswhere. # DocumentRoot "/srv/www/htdocs" . <<<-- change this line # # Configure the DocumentRoot # <Directory "/srv/www/htdocs"> <<<-- change this line # Possible values for the Options directive are "None", "All", # or any combination of: ...
To this:
# # Global configuration that will be applicable for all virtual hosts, unless # deleted here, or overriden elswhere. # DocumentRoot "/var/www/htdocs" <<<-- to this line # # Configure the DocumentRoot # <Directory "/var/www/htdocs"> << -- to this line # Possible values for the Options directive are "None", "All", # or any combination of: ...
- Use Rsync to Copy the Old Doc Root to the New Doc Root and Create an `index` File Containing the string `new doc root`
Use
rsync
to synchronize the doc root:sudo rsync -avr /srv/www /var
Create an
index.html
file in the new doc root with the stringnew doc root
:cd /var/www/htdocs/ sudo touch index.html sudo vim index.html <<< ensure you put the string into the index.html file>>>
- Verify the Package Files and Ensure the `server-default.conf` is Listed as Changed. Start Apache2 and Ensure the New `index` Loads.
Run the following:
rpm -V apache2
Start Apache and check the index:
sudo systemctl start apache2 curl 127.0.0.1
The result should be the string inserted in the previous task.