> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installing a LAMP stack on an Ubuntu server

> Learn how to quickly install a complete LAMP (Linux, Apache, MySQL, PHP) stack on an Ubuntu server.

This article describes how to install a complete LAMP stack on Ubuntu. A [LAMP stack](https://en.wikipedia.org/wiki/LAMP_\(software_bundle\)) is an open-source software bundle that contains the following components:

* The **L**inux operating system. (This is already installed on your server.)

* The **A**pache web server.

* The **M**ySQL database management system.

* The **P**HP programming language.

With a LAMP stack, you can install and create many popular types of web applications. WordPress, for example, often runs on a LAMP stack.

<Note>
  This article only applies to unmanaged hosting packages. You must have root access to the server to install the Ubuntu operating system template and a LAMP stack.
</Note>

## Installing a LAMP stack on Ubuntu

The following procedure assumes that you have installed the Ubuntu operating system template on your server.

To install a LAMP stack on Ubuntu, follow these steps:

1. Log in to your server [using SSH](/docs/using-ssh-secure-shell).

2. As the root user, type the following commands to update the system:

   ```bash theme={null}
   apt update
   apt upgrade
   ```

3. As the root user, type the following commands to install the *tasksel* package and then run it:

   ```bash theme={null}
   apt install tasksel
   tasksel
   ```

4. The *tasksel* interface lists predefined software collections that are available for installation:

   * Under **Choose software to install**, use the arrow keys to highlight **LAMP server**.

   * Press the spacebar to select **LAMP server**, and then press Enter. The installation process starts.

   * When you are prompted to specify a password for the MySQL root user, type the password and then press Enter.

5. When the installation process finishes, you have a functioning LAMP stack on your server. To test and configure the installation further, follow these steps:

   * **Test the web server:** To ensure the Apache web server is running normally, use your web browser to visit the domain name (or IP address) of the server. You should see the default Apache page.

   * **Test PHP:** To ensure PHP is running on the server correctly, type the following command at the command prompt:

     ```bash theme={null}
     php --version
     ```

     > 👍 Tip
     >
     > Additionally, to verify PHP is integrated with Apache, you can create a web page that contains the **phpinfo()** function. When you load the page in your web browser, you should see PHP configuration information for your server. For more information about how to use the **phpinfo()** function to view PHP settings, please see [this article](/docs/view-php-settings).

   * **Secure MySQL:** During installation you set a root password for MySQL. To help secure the MySQL installation further, type the following command at the command prompt:

     ```bash theme={null}
     mysql_secure_installation
     ```

     The *mysql\_secure\_installation* program enables you to configure additional security settings for MySQL.

## More information

* For more information about LAMP stacks, please visit [https://en.wikipedia.org/wiki/LAMP\_(software\_bundle)](https://en.wikipedia.org/wiki/LAMP_\(software_bundle\)).

* For more information about Ubuntu, please visit [https://ubuntu.com](https://ubuntu.com).
