20i
Blog header which repeats the title of the blog and shows logos for the LAMP stack.

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 18.04  

Welcome to our step-by-step guide on setting up a Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 18.04.

This combination of technologies forms a powerful web server framework that can host dynamic websites and web applications.

Installing a LAMP stack can seem a bit daunting, especially if you’re new to server administration and web development.

Fear not!

This tutorial is designed to guide you through the process, making it as seamless and understandable as possible.

By the time you finish, you’ll have a robust platform ready to support your web projects.

Whether you’re an experienced developer or a newcomer to the world of web hosting, let’s dive in!

  1. Install Apache 
  • Open the terminal and update the package index by running the command:
  • Then install Apache by running the command:
sudo apt update 
  • Then install Apache by running the command:
sudo apt install apache2 
  • After the installation is complete, you can start the Apache service by running the command:
sudo systemctl start apache2 
  • You can also configure Apache to start automatically on boot:
 sudo systemctl enable apache2 
  1. Install MySQL 
  • Install MySQL by running the command:
sudo apt install mysql-server 
  • During the installation process, you may be prompted to set a root password for MySQL but it will possibly pick up on the root password for your server.  After the installation is complete, you can start the MySQL service by running the command:
sudo systemctl start mysql
  • You can also configure MySQL to start automatically on boot:
sudo systemctl enable mysql
  1. Install PHP: 
  • Install PHP and the necessary modules by running the command:
sudo apt install php libapache2-mod-php php-mysql 
  • After the installation is complete, you will need to configure Apache to use PHP. To do this, open the Apache configuration file by running the command:
vim /etc/apache2/mods-enabled/dir.conf 

Save the changes and exit the editor. 

Press:

Esc shift +

Then type:

wq 

Next, restart the Apache service by running the command:

sudo systemctl restart apache2 

Test your LAMP stack: 

  • To test if the LAMP stack is working properly, create a new PHP file in the Apache web root directory by running the command:
vim /var/www/html/info.php 
  • Add the following line of code to the file:
<?php phpinfo(); ?>
  • Save the changes and exit the editor. 
  • Then, in your web browser, navigate to “http://your_server_ip/info.php” 
  • If everything is set up correctly, you should see a page displaying information about your PHP installation. 


Deploy all your apps with great value virtual server hosting, no compromises. Our high-performance VPS include:

  • Lightning-fast speed with 100% SSD storage
  • Genuine unlimited bandwidth – no throttling, ever
  • Deploy standard distro, 1-click app or custom image
  • Manage your servers through one single, intuitive control panel
  • 100% green hosting powered by renewable energy

Find out how our VPS Hosting is the perfect choice, from personal projects to complex apps.



Add comment