To install the LAMP stack on Ubuntu 22.04 LTS, follow these steps.
- Using
apt
, update the Ubuntu packages:sudo apt update && sudo apt upgrade
- Install the Apache web server using
apt
:sudo apt install apache2
- Install the MySQL web server:
sudo apt install mysql-server
- Install PHP, along with additional PHP modules for Apache and MySQL:
sudo apt install php libapache2-mod-php php-mysql
- (Optional) Install the following commonly-used PHP modules.
sudo apt install php-curl php-json php-cgi
- (Optional) To host a WordPress site on the server, install the following PHP components:
sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc
Ubuntu 22.04 LAMP Installation