Install LAMP on Ubuntu 24.04 | 22.04 with a single command

To run some popular web applications we need a lightweight LAMP server installation, here we learn how to do that on Ubuntu 20.04 focal or 22.04 Jammy Jellyfish using a single command. 

LAMP sounds may be familiar but it is not for our table, instead, it is an acronym composed of the initial letters of the software Linux, Apache, MySQL, and PHP. This stack is quite common when it comes to creating a web server environment for installing popular PHP-based web applications such as WordPress. We can use LAMP to provide static or dynamic web content.

LAMP refers to a software stack whose initial letters consist of the following individual components:

  • Linux operating system
  • Apache Web Server
  • MySQL database system
  • PHP Scripting Language

All the software components used to make a LAMP environment are typically installed on physical or virtual servers LAMP-based servers are websites or online shops created with the help of content management systems (CMS). LAMP servers also serve as an environment for software development.

Since the LAMP is a free-to-use and distributed software, hence quite popular among hosting providers to provide services.

If necessary, the individual components of a LAMP system can be replaced. For example, instead of an Apache web server, one can use Nginx; the scripting language JavaScript, or the database management system MariaDB, which can be used alternatively. Depending on which component is replaced, the acronym changes.

Although LAMp is natively meant to run on a Linux system but can be used on Windows and at that time it will be known as WAMP.

Explore individual software components of a LAMP system

The individual software components Linux, Apache, MySQL, and PHP each perform different tasks and provide different functions.

Linux- Open source OS

Linux doesn’t need an introduction, it is a popular open-source operating system to control hardware and running applications. It forms the interface between the hardware and the installed applications. You can find Linux in a variety of forms- from lightweight to heavy graphics armed for modern computers. Out of the most popular Linux distros, some are Ubuntu, Debian, RedHat, Fedora, and more… We can operate them both in GUI or using the command line terminal.

Apache Web Server

Apache web server is one of the key elements of the LAMP environment. It is a popular HTTP server that powers hundreds of hosting servers. It helps the system to receive the HTTP requests from the clients, process them, and deliver the responses to the clients via HTTP. The web server can access static content or forward dynamic requests to a server-side scripting language such as PHP, Perl, or Python.

MySQL database management system

MySQL is an open-source SQL database server used in the LAMP stack environment to store data generated by web applications. Together with the PHP scripting language, MySQL generates the dynamic content that the Apache web server then delivers to the client.

PHP scripting language

PHP stands for Hypertext Preprocessor and is a scripting language that can be used as free software. It can be used with the various Database servers and MySQL is one of them. PHP takes care of the server-side processing of the PHP code to generate the dynamic content. The Apache web server receives the PHP requests from the clients and forwards them to the PHP interpreter. After processing, it dynamically generates the HTML documents to be sent from the web server to the client.

Advantages of a LAMP system

1. Widely used and supported by a huge developers community.
2. Stable and Mature
3. Quickly patched if some error or vulnerabilities occur.
4. Free and open source, hence the source is open to everyone.
5. Distribution under GPL license allows users to create their useful extensions or apps around the components of Lamp stack.
6. LAMP servers offer a high degree of flexibility.
7. Provide high performance for the generation of dynamic web content.

Command to install LAMP server on Ubuntu 24.04 or 22.04

1. Run system update

All the components of the LAMP server are available to install using the default system repository of Ubuntu. Hence, we can configure the environment without adding an extra repository. However, before moving forward, just run the system update command to ensure the system rebuilds the APT package index cache.

sudo apt update

2. Install the Lamp server on Ubuntu 24.04 or 22.04

We can install LAMP server components one by one on our Ubuntu system. However, it is a time-consuming process, hence to make it short here we are using a single command. That will not only install the LAMP server but also enable and start all the required services.

sudo apt install lamp-server^ php

The above command will select all the required packages to set up Apache, MySQL, and PHP on your system.

Install Lamp server on Ubuntu 22.04 or 20.04

3. Check the service

Once, the installation is completed we can check whether the installed LAMP components services are working correctly or not.

For Apache web server:

systemctl status apache2 --no-pager -l
Check Apache server service status

For MySQL Database:

systemctl status mysql --no-pager -l
Check MySQL service status

4. To check the version

If you want to know the version of the installed LAMP server stack components, we can check that as well using the given commands:

php -v
apache2 -v
mysql -V
Check LAMP server version

5. Uninstall the LAMP Server

Well, when it comes to uninstalling the LAMP server completely from your Ubuntu system, we can use the given command:

sudo apt autoremove --purge apache2* mysql-server* php*

Other Articles:

How to install Wireshark on Ubuntu 22.04 or 20.04…
Install Jenkins on Ubuntu 22.04 or 20.04
Install Joomla on Ubuntu 22.04 LTS Jammy Linux
How to install Jellyfin Media Server on Ubuntu 22.04
How to install a Lighttpd web server on Ubuntu 20.04 | 22.04

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.