A comprehensive guide to setting up Apache2, MySQL 8, and PHP 8.3 on Ubuntu Server
This guide walks you through setting up a LAMP (Linux, Apache, MySQL, PHP) server on Ubuntu. We'll cover installation, configuration, best practices, and the importance of patch management.
Start by installing the latest version of Ubuntu Server. Download the ISO file from the official Ubuntu website, create a bootable USB drive, and follow the installation instructions.
After installation, perform the following initial configurations:
sudo apt update sudo apt upgrade -y sudo apt install -y openssh-server sudo systemctl enable ssh sudo systemctl start ssh
To install Apache2, use the following command:
sudo apt install apache2 -y
Configure Apache2 to serve your websites. The main configuration file is located at /etc/apache2/apache2.conf
.
sudo nano /etc/apache2/apache2.conf
/var/log/apache2/
.To install MySQL 8, use the following command:
sudo apt install mysql-server -y
Secure your MySQL installation by running the security script:
sudo mysql_secure_installation
Follow the prompts to set a root password and secure other settings.
mysqldump
.To install PHP 8.3, use the following commands:
sudo apt install software-properties-common -y sudo add-apt-repository ppa:ondrej/php sudo apt update sudo apt install php8.3 -y
Configure PHP settings in the php.ini
file:
sudo nano /etc/php/8.3/apache2/php.ini
Adjust settings such as memory limits, upload file size limits, and error reporting as needed.
opcache
to enhance performance./var/log/php_errors.log
.Create a PHP file in the web root directory to test the setup:
sudo nano /var/www/html/info.php
Add the following content:
<?php phpinfo(); ?>
Access the file via your web browser: http://your_server_ip/info.php
LinuxPatch.com offers an easy-to-use platform for managing patches on your Linux servers. With features like automated patching, detailed reports, and scheduling, it simplifies the patch management process.
Learn More at LinuxPatch.comSetting up a LAMP server involves several steps, but with careful configuration and regular maintenance, it can provide a robust and scalable environment for web applications. Remember to follow best practices and keep your software updated to ensure security and performance.