How to Install a webserver – Apache, PHP and MariaDB MySQL



How to Install a webserver – Apache, PHP and MariaDB MySQL

How to Install a webserver - Apache, PHP and MariaDB MySQL

On a Linux system, this is known as a LAMP stack (Linux, Apache, MySQL, PHP). Linux being the operating sytem, Apache being the webserver, PHP the scripting language and MariaDB the database. This combination of packages makes for a strong foundation for a web server however depending on what you are hosting you may need additional packages like mcrypt, mbstring, gd, gettext, etc.

It is worth noting that you can install either MariaDB or MySQL the main differences being that MariaDB is open source, it doesn’t support data masking and dynamic columns but is faster than MySQL whereas MySQL is less open source in its enterprise edition but does support data masking and dynamic columns.

This guide is intended for a local network but can be expanded upon for internet access so long as security measures like firewalls and such are in place. After following this tutorial on your Ubuntu server you will, from within your local area network (LAN), be able to go to your server in a web browser (h t t p://server-host-ip-or-name). You can create sub-folders here for a nice local development space. More advanced users may prefer to configure the Apache virtual hosts file and manage DNS but for a local dev environment, this is a good start.

Prerequisites:
You have an Ubuntu server built and patched.
*Preferably with ssh installed.

In this video we use the following commands:

To prepare our system by upgrading packages that are ready for upgrades and then to upgrade them:
sudo apt-get updatesudo apt-get upgrade

To install our applications:
sudo apt-get install apache2 php mariadb-server

Verify installation
sudo mysql
exit;
sudo apache2 -v
sudo php -v

h t t p://server-host-ip-or-name (from a web browser)

For access from outside the LAN you will need a domain name or static IP as well as properly configured DNS and firewall ports.