LAMP is a combined software bundle of Linux Operating System, Apache Web server, MariaDB database and the PHP coding language which are the necessary components to get a Web server up and running. LAMP stack is widely used in the world by Linux professionals, geeks, developers and webhosting companies.
Installation of LAMP Stack
Let’s deploy & test each component of LAMP stack one by one.
1. Install Linux
A Linux operating system is the core component of LAMP; I have installed Fedora 22 on my virtual box to install and test LAMP.
After completing the installation, update the system with the help of below command.
Since YUM has been updated to DNF which stands for Dandified YUM, so we will use dnf where we have been using yum in our earlier Fedora versions.
2. Install Apache
Apache is open source, freely available and one of the most popular web servers runs mostly on UNIX based systems. It runs on port 80 with HTTPD daemon and coded in C.
Issue the below command to get Apache installed:
Start the daemon to get the web server up and running.
As it is redirected to /bin/systemctl, so we can start Apache as:
In order to check the web server has started and running, run the below command:
We can verify the status of the web server via browsing the page, write the IP address of your system or hostname.
In case the browser shows nothing, the web server port might have been getting blocked by firewall, please allow both ports for Apache  and Secure Apache  in the firewall with following commands:
firewall-cmd --permanent –add-service=https
Make sure to enable Apache to start on system boot via following command:
We have a working Apache web server 🙂
3. Install MariaDB
MariaDB is the default database engine on Fedora 22 and its a MySQL relational database developed originally by MySQL developers. It is open source having backported features of MySQL. The following command needs to be executed to install it:
Star the service, enable it to start on boot as well.
systemctl enable mariadb
Execute mysql to enter into the MariaDB environment:
It is highly recommended to secure the database from un-authorized access and set a strong password for root user, just execute the below query and it will be set.
For more options, please run mysql_secure_installation command.
4. Install PHP
PHP is world renowned coding and scripting language especially used to design and develop websites. It comes along with a number of modules being used by hundreds of millions of websites. It’s installation is also easy and can be carried out with the help of below command:
In order to test either PHP is working on our system, create a sample file test.php in the Apache document root which is /var/www/html by default and add the following lines in the file:
Now restart apache:
Load your system’s IP address or hostname in web browser, you must see the following page if PHP has been installed correctly.
Our LAMP stack is complete and fully functional, we can deploy our projects, host websites and build databases. In my opinion, a server is incomplete without LAMP and widely used in every online business.
Try it now on newly released Fedora 🙂