How to install LAMP Stack?

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:

  1. Update Package Repository:
    sudo apt update
  2. Install Apache:
    sudo apt install apache2
  3. Install MySQL:
    sudo apt install mysql-server
    During the installation, you will be prompted to set a password for the MySQL root user.
  4. Install PHP:
    sudo apt install php libapache2-mod-php php-mysql
  5. Restart Apache:
    sudo systemctl restart apache2
  6. 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
    Open a web browser and navigate to http://localhost/info.php or http://your_server_ip/info.php to see the PHP info page.

Installing LAMP Stack on CentOS:

  1. Update Package Repository:
    sudo yum update
  2. Install Apache:
    sudo yum install httpd
  3. Install MySQL:
    sudo yum install mysql-server
    Start the MySQL service and set it to start on boot:
    sudo systemctl start mysqld sudo systemctl enable mysqld
    During the installation, you will be prompted to set a password for the MySQL root user.
  4. Install PHP:
    sudo yum install php php-mysql
  5. Restart Apache:
    sudo systemctl restart httpd
  6. 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
    Open a web browser and navigate to http://localhost/info.php or http://your_server_ip/info.php to see the PHP info page.
These steps provide a basic LAMP Stack setup. You may need to install more modules or modify extra parameters, depending on your needs. Additionally, ensure that your firewall settings allow traffic on the necessary ports (e.g., port 80 for HTTP and 443 for HTTPS).

Post Your Comment

Free Migration Assistance

If you need assistance with migrating your current data from another provider, we would be more than happy to assist.