Linux acts as the cornerstone for the web server, providing the space where the other stack elements can operate.
Apache: Apache is a web server program that controls HTTP requests to deliver content from your website.
MySQL: MySQL's relational database management system (RDBMS) aims to keep user data up to date on a server.
PHP: PHP is a server-side scripting language utilized for constructing dynamic web pages by embedding within HTML code and executing on the web server.
Requirements:
To begin, ensure that your server is already equipped with CentOS 7.
To check the version of the operating system in CentOS 7, you can use the following command:
# cat /etc/centos-release
1. install Apache
You can effortlessly install Apache using the Yum package manager. Within your SSH client, input the following:
sudo yum install httpd -y
Once the Apache installation is complete, utilize the subsequent commands to oversee the Apache daemon:
sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl status httpd
2. Install MySQL (MariaD

Utilize this command to install MySQL(MariaD

sudo yum install mariadb-server mariadb -y
Now, let's start the MariaDB service:
sudo service MariaDB start
During the MariaDB configuration, you'll encounter prompts for the root password (not the server's root password). If you don't have one yet, pressing Enter is fine.
Follow these instructions to safeguard your database:
Set root password? [y/n] Answer 'Y.'
New password: Enter your desired password
Re-enter new password: Confirm the password
Remove anonymous users? [y/n] Respond 'Y.'
Disallow root login remotely? [y/n] Choose 'Y.'
Remove the test database and access it. [y/n] Opt for 'Y.'
Reload privilege tables now? [y/n] Confirm with 'Y.'
3. Install PHP
To add the MySQL extension to PHP, use the yum package installer:sudo yum install php PHP-MySQL
You'll likely receive a Y/n prompt; select Y to confirm the installation.
To make Apache work seamlessly with PHP, restart the server:
sudo systemctl restart httpd.service
Next, download and install the Remi repo package:
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Enable the remi-php73 repository:
sudo yum-config-manager --enable remi-php73
To install PHP, enter the following command:
sudo yum install php php-common php-opcache php-script php-cli php-gd php-curl php-MySQL
To check the version, execute the below command:
php -v
Restart Apache with the new PHP setup:
sudo systemctl restart httpd.service
To test PHP processing, create an info.php file in the default PHP directory:
sudo nano /var/www/html/info.php
Insert the following code:
<?php phpinfo(); ?>
Save and exit with CTRL+X. Finally, check your server by visiting the info.php URL:
http://your.ip.address/info.php
The LAMP stack is a crucial collection of tools for web development, including Linux, Apache, MySQL, and PHP. These components collaborate to manage servers or VPS (Virtual Private Servers) effectively.
Leave a comment: