LAMP setup in ubantu

LAMP setup in ubantu

Setting up a LAMP (Linux, Apache, MySQL, PHP) stack on Ubuntu involves installing and configuring each component. Here's a step-by-step guide to do that:

Step 1: Update Package Lists:

Open a terminal and run the following command to ensure that your package lists are up-to-date:

sudo apt update

Step 2: Install Apache:

Install the Apache web server by running:

sudo apt install apache2

Step 3: Install MySQL:

Install the MySQL database server with the following command:

sudo apt install mysql-server

During the installation, you'll be prompted to set a root password for MySQL. Make sure to choose a strong password and remember it.

Step 4: Install PHP:

Install PHP along with the necessary modules to enable interaction with MySQL:

sudo apt install php libapache2-mod-php php-mysql

Step 5: Test PHP:

Create a test PHP file to ensure that PHP is working properly:

echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php

Step 6: Access PHP Info Page:

Open a web browser and navigate to http://your_server_ip/info.php. You should see a PHP information page that displays details about your PHP installation.

That's it! You've successfully set up a LAMP stack on your Ubuntu system. You can now start building and hosting web applications using Apache, MySQL, and PHP.




Mahendra Pratap Singh

Hey there! I'm a Senior Full Stack Developer with 10 +years of experience in the tech world. I've spent a lot of time working with different tools and languages, like PHP, WordPress, Laravel, and CodeIgniter... Read More >>

Leave a Comment