Skip to content

Setup a LAMP server in ubuntu

Posted on:February 3, 2023 at 01:20 AM

Setup a LAMP server in ubuntu

1. Install Apache web server

   sudo apt-get install apache2 -y

2. Install MariaDB

   sudo apt-get install mariadb-server mariadb-client -y

3. Start and secure MariaDB:

   sudo systemctl start mariadb

   sudo mysql_secure_installation

4. Install PHP:

   sudo apt-get install php libapache2-mod-php -y

5. Test the LAMP server:

     <?php
     phpinfo();
     ?>
Note:
   cd /etc
   ls  (you should see apache2 folder here)
   cd /var/www/html
   sudo nano /var/www/html/info.php
   hostname -I
   http://your_server_IP/info.php
If you see a page with information about your PHP installation, your LAMP server is up and running successfully.