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.


About LAMP

A LAMP stack is an open-source software bundle used for hosting web applications. It includes:

  • Linux – the operating system (already installed on your server)

  • Apache – the web server

  • MySQL – the database management system

  • PHP – the server-side programming language

Many popular web applications, like WordPress, run on a LAMP stack.

Note: This guide applies only to unmanaged hosting packages. You must have root access to install Ubuntu and a LAMP stack.

Installing a LAMP stack on Ubuntu

The following steps assume Ubuntu is installed on your server.

  1. Log in via SSH as the root user.

  2. Update the system:

apt update
apt upgrade
  1. Install and run tasksel:

apt install tasksel
tasksel

The tasksel interface lists predefined software collections for installation.

  1. Install the LAMP server:

  • Use the arrow keys to highlight LAMP server.

  • Press Spacebar to select it, then Enter to start the installation.

  • When prompted, set a password for the MySQL root user.

  1. Verify the installation:

  • Test Apache: Open your web browser and visit your server’s domain or IP address. You should see the default Apache page.

  • Test PHP: Run the following command:

php --version

Tip: To confirm PHP is integrated with Apache, create a web page containing phpinfo() and load it in your browser. This displays PHP configuration details.

  1. Secure MySQL: Strengthen MySQL security by running:

mysql_secure_installation

Follow the prompts to configure additional security settings.


More information

Was dit antwoord nuttig? 0 gebruikers vonden dit artikel nuttig (0 Stemmen)

Powered by WHMCompleteSolution