How to install a virtual XAMPP web server on Lubuntu

Introduction

This page explains how to install a Xampp server in a Lubuntu virtual machine. The aim of this page is to create a virtual machine working as a remote server. The following has been tested with following version:

Configure the virtual machine

Let's start by creating the virtual machine. Download the Lubuntu version suited for your needs, in my case, the last LTS. I suggest to download from the official Lubuntu website.

While the iso file is downloading, let's configure VirtualBox. Create a new virtual machine

Create a new virtual machine, configure name and OS

Select the amount of memory. In my case, 8Gb:

Create a new virtual machine, configure memory size

Create a new virtual hard disk for your server:

Create virtual hard drive for the web server

Select virtual machine hard drive type

Select dynamically allocated to save disk space on the host computer:

Select dynamically allocated hard drive to save space

Set the file location (where the machine will be saved) and the size. I suggest 12 or 14 Gb to have some margin. Anyway, as the disk is dynamic, it should not be a problem.

Select disk size and location

Create and start the new virtual machine.

Install Lubuntu

During the first start of the machine, the machine asks for a start-up disk.

Virtual machine first start

Click on the little folder icon to open the Optical Disk Selector. Then click Add and locate the Lubuntu ISO file we downloaded previously:

Virtual machine select iso file

Start the machine, select try or Install Lubuntu and wait for Lubuntu to boot:

Lubunutu first start

Note that Lubunutu is not installed. Is has been launched from the ISO files. On the desktop, there is a launcher named Install Lubuntu 22.04 LTS. Start the installer and follow the instructions. Once the installation is over, restart the virtual machine

Restart Lubuntu after installation

Configure Lubuntu

After restart, log in your session if you previously set a password. You can also change the Lubuntu display settings to get a better resolution:

Lubuntu display settings

Change the setting, apply. Don't forget to save if you want the configuration to be keep after reboot.

Change display resolution

In the VirtualBox settings, in the network tab, set Bridged Adapter. The virtual machine get a new DHCP IP on the network. Thus it becomes a new independent server machine.

VirtualBox network settings

Last step before installing the server is to check that Lubuntu is up-to-date. In a terminal (Ctrl+Alt+T) run the following commands:

sudo apt update
sudo apt upgrade

If the disk size is important, remove unused packaged:

sudo apt autoremove

Install XAMPP

XAMPP is a PHP development environment. Installing XAMPP will install

Download the XAMPP installer from this page. Once the .run file is downloaded, open a terminal, goes into the Downloads folder.

cd Downloads

Make the installer executable:

chmod +x xampp-linux-*-installer.run

Run the installer with root privileges:

sudo ./xampp-linux-*-installer.run

The installer should start:

XAMPP installer setup

Click Forward and leave the default components by default:

XAMPP installer, select components

Click Forward and select installation folder (leave default folder if not sure):

XAMPP installer, select installation folder

Click Forward:

XAMPP installer ready to install

Click Forward to install XAMPP:

XAMPP installation progress bar

Select Launch XAMPP and click Finish:

XAMPP install completed

The XAMPP control panel should start:

XAMPP control panel first start

If the control panel does not start, run the following command in a terminal:

sudo /opt/lampp/manager-linux-x64.run

Web server

In the Manage Servers tab, start the service you need:

XAMPP start services

Once the Apache service is started, you can check the web server is online by going to the url localhost or 127.0.0.1:

Check the web server properly started on localhost

In a terminal, install net-tools

sudo apt install net-tools

Then run ifconfig to get the IP address of the guest machine:

ifconfig

Get the IP address of the guest computer

On the host computer, enter the IP address of the guest machine, the web server should be available:

XAMPP web server available on host computer browser

phpMyAdmin

Try to start phpMyAdmin on the host computer, you should get something like:

XAMPP phpMyAdmin access forbidden on host computer

To change the server configuration, edit the file httpd-xampp.conf:

sudo featherpad /opt/lampp/etc/extra/httpd-xampp.conf

Replace:

Require local

with:

Require all granted

Restart the Apache Web Server in XAMPP control panel. phpMyAdmin is now available from the host computer:

phpMyAdmin on the host computer

See also


Last update : 12/04/2022