Exercises to complete:

  1. Install Apache2
  2. Enable and start Apache2
  3. Add a port to firewalld
  4. Create a simple website
  5. Check does the website display correctly using IP address

Install Apache2

SLES

To install Apache2 type:

# refresh repositories
sudo zypper ref
# install Apache2
sudo zypper -n in apache2
# enable Apache2 on boot
sudo systemctl enable apache2
# start the Apache2
sudo systemctl start apache2

Allow Apache2 service

SLES

linux:~ # sudo firewall-cmd --add-service=http --permanent
success
linux:~ # sudo firewall-cmd --reload
success

Create a simple webiste

echo 'Linux fundamentals - lab' | sudo tee -a /srv/www/htdocs/index.html

Check does the website display correctly using IP address

curl http://checkip.amazonaws.com
curl http://IP-ADDRESS

Additional modules

Once the Apache server is up and running, additional modules can be enabled for extended functionality.

To check the lsite of additional modules, look in the /etc/apache2/mods-available directory or /etc/httpd/conf.modules.d directory.

Suppose you want to install the MySQL authentication module. You can do that by running the following command:

SLES

sudo zypper -n in libapr1-util1-dbd-mysql

After installation, the module should be turned on using the following command:

sudo a2enmod authn_dbd

Must read: Differences in the way Apache server modules are enabled between SLES/OpenSUSE, Debian/Ubuntu and RedHat/Fedora/CentOS

Then restart the Apache server to enable activating the changes made:

SLES

sudo systemctl restart apache2