![](https://reliablevps.net/wp-content/uploads/2024/03/technologist-with-grey-tablet-his-hands-make-set-up-production-line-while-standing-department-dairy-factory-2.jpg)
How to install LAMP Stack?
LAMP Stack stands for Linux, Apache, MySQL, and PHP/Perl/Python.
A well-liked set of open-source programs is utilized to host dynamic websites and web apps.
Here’s a general guide on how to install LAMP Stack on a Linux system.
Please be aware that depending on the Linux distribution you are using, some stages may differ.
Installing LAMP Stack on Ubuntu:
- Update Package Repository:
sudo apt update
- Install Apache:
sudo apt install apache2
- Install MySQL:
sudo apt install mysql-server
- Install PHP:
sudo apt install php libapache2-mod-php php-mysql
- Restart Apache:
sudo systemctl restart apache2
- Verify Installation: Create a PHP file in the webserver’s root directory to test the installation:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
http://localhost/info.php
orhttp://your_server_ip/info.php
to see the PHP info page.
Installing LAMP Stack on CentOS:
- Update Package Repository:
sudo yum update
- Install Apache:
sudo yum install httpd
- Install MySQL:
sudo yum install mysql-server
sudo systemctl start mysqld sudo systemctl enable mysqld
- Install PHP:
sudo yum install php php-mysql
- Restart Apache:
sudo systemctl restart httpd
- Verify Installation: Create a PHP file in the webserver’s root directory to test the installation:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
http://localhost/info.php
orhttp://your_server_ip/info.php
to see the PHP info page.