CSIA 430 Linux Administration – Web Server Installation and Startup Process

This document was created for students in my college Linux Administration class (at Tonysako.com). This document contains the commands demonstrated in the videos for installing and starting a Linux web server running on a VirtualBox VM. This document is also available as a PDF.

  • Start Linux server (VM)
  • Make sure you are in the root account
  • Use yum to install the Apache web server which is in the httpd package. The command for installing the package is:

yum install httpd

  • Start the web server (httpd daemon) using systemctl command:

systemctl start httpd

  • Use the systemctl command to set the web server to start automatically when the system boots

systemctl enable httpd

  • Add a rule to the firewall configuration file(s) to allow the web traffic using

firewall-cmd --permanent --add-service=http

You can also add a firewall rule to allow https at this time. However using https requires adding a certificate server and issuing security certificates, so you won’t be able to test it until those steps are also completed.

firewall-cmd --permanent --add-service=https

  • Reload the firewall so that it will read the new rules from the configuration files.

firewall-cmd --reload

  • Add a port forwarding rule to Virtual Box to forward web traffic into the Linux virtual machine by following these steps:
  1. Shutdown the Linux VM. (Shutting down is a good idea any time you make changes the to Virtual Box settings for a virtual machine.)
  2. In Virtual Box, select the Linux VM and then click the Settings button.
  3. Select the Network category.
  4. Ensure that the Adapter 1 tab is selected and the Attached to: option is set to NAT.
  5. Click the triangle by Advanced to display the Advanced Network options. This will expand the network options.
  6. Click the Port Forwarding button. This will display the Port Forwarding Rules dialog box.
  7. Click on the green + icon (upper right) to add a new port forwarding rule.
  8. Set the Host IP to 127.0.0.1 and the Host Port to 8000. (You can use a different Host Port if you wish, just remember what you set it to.)
  9. Set the Guest IP to 10.0.2.15 and the Guest Port to 80
  10. Click OK. This will save the new port forwarding rule, close the Port Forwarding Rules dialog box, and return you to the Virtual Box Settings.
  11. Click OK to save the new settings
  • Start the Linux VM. The web server should now be running and ready for an acceptance test.