Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Linux » How to setup and configure a Lamp stack on CentOS
  • Proxmox VM backup with VBR
    How to create a backup job for Proxmox VMs using VBR Backup
  • Implement Azure Bicep
    How to Deploy Azure Resources Using Azure Bicep Automation
  • Allow and Disallow Simultaneous Connection to Domain and Non Domain network
    Allow and Disallow Simultaneous Connection to Domain and Non-Domain network Network | Monitoring
  • Azure Storage 1
    Azure CLI: How To Upload Batch Files to Azure Storage Account AWS/Azure/OpenShift
  • Screenshot
    Fix AirDrop issue “No People found and there is no one nearby to share with” on Mac Mac
  • GitMarkdown
    Install Git on Windows: Practical Git use with markdown Version Control System
  • screenshot 2020 05 03 at 18.30.44
    How to Activate Cisco ASA 5505 License Network | Monitoring
  • ext
    The DriveLock server returned an invalid or unrecognized response Security | Vulnerability Scans and Assessment

How to setup and configure a Lamp stack on CentOS

Posted on 21/11/202004/05/2024 Dickson Victor By Dickson Victor 2 Comments on How to setup and configure a Lamp stack on CentOS

LAMP stands for Linux Apache Mysql PHP. This stack is an open-source software used to deliver high-performing web applications comprising of the above-named applications. What this means is that these individual packages are installed together in a stack to enable a server to host dynamic websites and web applications. In this article, I will be showing you how to setup and configure a lamp stack on CentOS. Please see How to install MariaDB on Ubuntu, How to update WampServer to Latest Version, and how to install MariaDB on Ubuntu. Also, see how to Install and configure Ansible on Azure Virtual Machine.

There are other versions of this setup for other operating systems such as WAMP/WIMP for Microsoft Windows and MAMP for MAC OS. How to add a new partition to an existing Linux server, How to setup and configure a lamp stack, ESXI 6.7 ALARM: Seat disk exhaustion on 10, how to setup up WatchGuard Log and Report Server in a VM, how to encrypt a partition with Cryptsetup on Linux and how to disable RC4 Cipher Algorithms support in SSH Server.

LAMP Stack provides a complete, fully-integrated and ready to run LAMP development environment. Kindly take a look at this related guide: How to Install LAMP Stack on Ubuntu 18.04

– Apache is probably the most widely used web application; mainly maintained by an open-source community.
– Mysql is an open-source relational database for storing application data. There are different relational databases you can use; the most commonly used database is the MariaDB.
– PHP is a programming language used to create dynamic web pages in conjunction with Apache.  It is relatively easy and efficient to use. You can also use Perl instead of PHP.

STEPS TO SET UP THE LAMP STACK

Install Apache: Install the Apache package with the yum install httpd command.

When the installation is done, start the httpd service with the systemctl start httpd. You should also make it persistent across reboot with systemctl enable httpd this will make it active when you boot your system.

You can now test if the setup is working by inputting your system’s i.p address into the address bar of your web browser. This should display a test page that looks something like the image below.

Here are some more excellent articles: How To Check the Kernel Version in Linux / Ubuntu / CentOS, and how to Install LAMP Stack on Ubuntu 18.04.

Install and configure Mariadb

Install the database package with yum install mariadb-server mariadb

Now start the database and enable Mariadb with the following commands;

systemctl start mariadb
systemctl enable mariadb

There are however some other configurations you need to include to secure your database such as creating an Admin user, changing the password and deleting the default user that is created when you install Mariadb.

Install the php package

When installing the php package as part of a LAMP server, it is important to install it with the mysql extention.

After the installation, restart the httpd.service.

If you have a firewall up, you will need to allow firewall to allow http and https through.

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

To ensure that php is correctly installed, you need to create a basic script named info.php. This file should be stored in the /var/www/html directory.

vi /var/www/html/info.php

Here is a simple script that you can use to test the php setup;

                         <?php
                                     phpinfo();
                         ?> 

Save and quit your editor. Go to your web browser and type;

http://i.p-adress/info.php

The result of this when you hit the enter button should be an image that looks like the image below.

With the php package, there are some additional extensions you can find within the package. To find these packages, type the following into your terminal.

yum search php

This will bring an output of several additional php packages that may be useful.

You can then use yum install to install whatever additional package you want.

In summary, the LAMP stack allows for flexibility and efficiency; LAMP is an open-source stack, there is a vast ecosystem of users and developers. It also has a secure architecture and well-established encryption practices.

I hope you found this blog post helpful on how to setup and configure a lamp stack on CentOS. If you have any questions, please let me know in the comment session.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Click to share on X (Opens in new window) X
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to share on Threads (Opens in new window) Threads
  • Click to share on Nextdoor (Opens in new window) Nextdoor
Linux Tags:MySQL, Python

Post navigation

Previous Post: Fix insufficient access rights to perform this operation when trying to enable Active Directory Recycle Bin
Next Post: Restore AD Objects: How to restore deleted user accounts in Active Directory with Microsoft LDP and PowerShell

Related Posts

  • Header image
    How to setup a Third-Party DNS Server on a Linux Server Linux
  • yarnfinalfeature
    How to Install and Uninstall Yarn on Ubuntu Linux Linux
  • SSL on WAMPServer
    Setup VirtualHost with SSL on WAMP Server Linux
  • physical
    Linux Machine: Is it Virtual or a Physical server Linux
  • fba7f screenshot 2019 04 15 at 18.33.30
    File System Overview: How to decide on the right File System to use for your USB Linux
  • featureunions
    How to Install Unison on Linux System Linux

More Related Articles

Header image How to setup a Third-Party DNS Server on a Linux Server Linux
yarnfinalfeature How to Install and Uninstall Yarn on Ubuntu Linux Linux
SSL on WAMPServer Setup VirtualHost with SSL on WAMP Server Linux
physical Linux Machine: Is it Virtual or a Physical server Linux
fba7f screenshot 2019 04 15 at 18.33.30 File System Overview: How to decide on the right File System to use for your USB Linux
featureunions How to Install Unison on Linux System Linux

Comments (2) on “How to setup and configure a Lamp stack on CentOS”

  1. Avatar photo George says:
    03/01/2023 at 3:34 PM

    Thank you for sharing! I’m glad you liked the article; lamp development is an interesting subject matter and it’ll be interesting to do more research on it in future posts.

    Log in to Reply
    1. chris Christian says:
      03/01/2023 at 9:43 PM

      You are welcome

      Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a
 
  • Proxmox VM backup with VBR
    How to create a backup job for Proxmox VMs using VBR Backup
  • Implement Azure Bicep
    How to Deploy Azure Resources Using Azure Bicep Automation
  • Allow and Disallow Simultaneous Connection to Domain and Non Domain network
    Allow and Disallow Simultaneous Connection to Domain and Non-Domain network Network | Monitoring
  • Azure Storage 1
    Azure CLI: How To Upload Batch Files to Azure Storage Account AWS/Azure/OpenShift
  • Screenshot
    Fix AirDrop issue “No People found and there is no one nearby to share with” on Mac Mac
  • GitMarkdown
    Install Git on Windows: Practical Git use with markdown Version Control System
  • screenshot 2020 05 03 at 18.30.44
    How to Activate Cisco ASA 5505 License Network | Monitoring
  • ext
    The DriveLock server returned an invalid or unrecognized response Security | Vulnerability Scans and Assessment

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,841 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.