SYSTEM AND NETWORK ADMINISTRATION
LINUX BASED
ITEC 3116
LAMP CONFIGURATION IN LINUX
LECTURE 23 -WEEK 13,
JULY 2020.
RECAP OF THE PREVIOUS LECTURE
Domain Name System (DNS)
Installation and Configuration of
DNS in Ubuntu Server
AGENDA FOR TODAY’S CLASS
LAMP in Ubuntu Server
L-Linux
A-Apache
M-MySQL
P-PHP
WEB SERVER
• A Web server is a software responsible for accepting HTTP requests from clients, which
are known as Web browsers, and serving them HTTP responses along with optional data
contents, which usually are Web pages such as HTML documents and linked objects
(images, etc.).
• A protocol is just a standard set of rules that allow a client and server to communicate.
• For a client and server to communicate, they must speak the same protocol.
APACHE WEB SERVER
• Apache is the most commonly used Web server on Linux systems. Web servers are used
to serve Web pages requested by client computers. Clients typically request and view
Web pages using Web browser applications such as Firefox, Opera, Chromium, or Internet
Explorer.
• The most common protocol used to transfer Web pages is the Hyper Text Transfer
Protocol (HTTP). Protocols such as Hyper Text Transfer Protocol over Secure Sockets
Layer (HTTPS), and File Transfer Protocol (FTP), a protocol for uploading and
downloading files, are also supported.
APACHE WEB SERVER
• Apache Web Servers are often used in combination with the MySQL database engine, the
Hyper Text Preprocessor (PHP) scripting language, and other popular scripting languages
such as Python and Perl.
• This configuration is termed LAMP (Linux, Apache, MySQL and Perl/Python/PHP) and
forms a powerful and robust platform for the development and deployment of Web-
based applications.
MY SQL
• MySQL is an Oracle-backed open source relational database management system
(RDBMS) based on Structured Query Language (SQL).
• MySQL runs on virtually all platforms, including Linux, UNIX and Windows. Although it
can be used in a wide range of applications, MySQL is most often associated with web
applications and online publishing.
• MySQL is an important component of an open source enterprise stack called LAMP.
PHP (HYPERTEXT PREPROCESSOR)
• PHP is a general-purpose scripting language suited for Web development. PHP scripts can
be embedded into HTML.
• It was originally created by Rasmus Lerdorf in 1994.
• PHP is an important component of an open source enterprise stack called LAMP.
WHAT IS LAMP?
• LAMP is an open source Web development platform that uses
• Linux as the operating system,
• Apache as the Web server,
• MySQL as the relational database management system
• PHP as the object-oriented scripting language (Sometimes Perl or Python is used instead
of PHP.)
LAMP..
Because the platform has four layers, LAMP is sometimes referred to as a LAMP stack.
Stacks can be built on different operating systems.
• Developers that use these tools with a Windows operating system instead of Linux
are said to be using WAMP;
• with a Macintosh system, MAMP;
• and with a Solaris system, SAMP.
INSTALLATION AND CONFIGURATION OF APACHE
WEB SERVER
We can install Apache easily using Ubuntu’s package manager, apt. Ubuntu package manager
allows us to install most software painlessly from a repository maintained by Ubuntu.
We can divide the installation and configuration into following steps;
1. Install the Package (Apache)
2. Set Global Server Name to Suppress Syntax Warnings
3. Adjusting the Firewall to Allow Web Traffic
4. Verification
INSTALL THE PACKAGE (APACHE)
• To install the package or Apache, we need to use the following command to serve the
purpose.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install apache2
• We are using sudo for root privileges.
SET GLOBAL SERVER NAME TO SUPPRESS SYNTAX
WARNINGS
• Now, we need to add a single line to /etc/apache2/apache2.conf file to suppress warning
message.
• If we don’t set ServerName globally, we will receive the following warning message when
checking our server Apache configuration for syntax errors:
“$ sudo apache2ctl configtestOutput: AH00558: apache2: Could not reliably determine the
server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to
suppress this message Syntax OK”
SET GLOBAL SERVER NAME TO SUPPRESS SYNTAX
WARNINGS
• Open the main configuration file, we will use nano for this example:
$ sudo nano /etc/apache2/apache2.conf
• Inside at the bottom of the file, add ServerName directive that will point to our
primary domain name.
• If you don’t have a domain name associated with your server, you can also use your
server’s public IP Address:
ServerName DOMAIN_NAME_OR_PUBLIC_IP
SET GLOBAL SERVER NAME TO SUPPRESS SYNTAX
WARNINGS
• Save and close the file when we have added the ServerName directive.
• Now check for syntax errors by typing the following command:
$ sudo apache2ctl configtest
The output of this command should be like the following;
“Output:
Syntax OK”
SET GLOBAL SERVER NAME TO SUPPRESS SYNTAX
WARNINGS
• Now we have to restart Apache so that our changes can be implemented.
sudo systemctl restart apache2
ADJUSTING THE FIREWALL TO ALLOW WEB TRAFFIC
• Now we need to make sure that our firewall allows HTTP and HTTPS traffic. We can list the
application profile for Apache by using the following command.
$ sudo ufw app list
• We will have the following output of the above command as below;
Output:
Available applications:
Apache
Apache Full
Apache Secure
OpenSSH
ADJUSTING THE FIREWALL TO ALLOW WEB TRAFFIC
• Now we need to look at Apache Full profile, it shows that it enables the traffic to ports 80
and 443 by using the following command;
$ sudo ufw app info "Apache Full“
• The output of the following command is as follows;
Output:
Profile: Apache Full
Title: Web Server (HTTP,HTTPS)
Description: Apache v2 is the next generation of the omnipresent Apache web
server.Ports:
80, 443/tcp
ADJUSTING THE FIREWALL TO ALLOW WEB
TRAFFIC
• Now allow incoming traffic by using the following command;
$ sudo ufw allow in "Apache Full"
VERIFICATION
• Now we can verify on the spot to check whether things go as planned by visiting our
server’s public IP address in our web browser.
http://OUR_SERVER_IP_ADDRESS
VERIFICATION
• End of the Lecture
• Homework: Practically configure and install Apache2 on Ubuntu Server