XAMPP is an open-source software package that provides an easy way to install and configure Apache web server, MySQL database, PHP, and Perl on your Linux machine. It is designed to be easy to install and use, making it a popular choice for web developers who need a quick and easy way to set up a development environment.
Before we start the installation process, let’s go over some prerequisites.
Once you have verified that your VPS meets these requirements, you can proceed with the installation.
The first step in installing XAMPP is to download the latest version from the official website. You can do this by opening a web browser on your VPS and navigating to the XAMPP download page.
On the download page, you will see a list of available versions for different operating systems. Since we are installing XAMPP on a Linux machine, we will click on the “Linux” tab and download the appropriate version for our VPS.
Once you have downloaded the XAMPP archive, you need to extract it to a directory on your VPS. You can do this by opening a terminal window on your VPS and navigating to the directory where you downloaded the archive.
Assuming that you downloaded the archive to your Downloads directory, you can use the following command to navigate to that directory:
Next, you can use the tar command to extract the archive to the /opt directory, which is the default installation directory for XAMPP:
sudo tar xvfz xampp-linux-x64-8.1.2-0-installer.run.tar.gz -C /opt
This command will extract the XAMPP files to the /opt directory on your VPS. The -C flag specifies the destination directory for the extracted files.
After you have extracted the XAMPP files to the /opt directory, you can start the XAMPP server using the following command:
sudo /opt/lampp/lampp start
This command will start the Apache web server, MySQL database, and other components included in the XAMPP package.
To verify that the server is running, you can open a web browser on your VPS and navigate to http://localhost/. If everything is working correctly, you should see the XAMPP dashboard, which provides an overview of the installed components and their status.
To verify that PHP is working correctly, you can create a test PHP file and place it in the”/opt/lampp/htdocs” directory, which is the default web root directory for XAMPP.
Assuming that you are still in the terminal window, you can use the following command to create a test file called test.php:
echo "<?php phpinfo(); ?>" | sudo tee /opt/lampp/htdocs/test.php
This command will create a file called test.php in the ” /opt/lampp/htdocs “directory with the following contents:
<?php phpinfo(); ?>
This file will display information about the PHP installation when accessed through a web browser.
To test the PHP installation, you can open a web browser on your VPS and navigate to http://localhost/test.php. If PHP is working correctly, you should see a page with information about the PHP installation, including the version number and configuration settings.
By default, the XAMPP installation is not secure and should not be used in a production environment. To secure your XAMPP installation, you need to take a few additional steps:
By default, XAMPP comes with a default password for the MySQL root user. This password should be changed to a strong and unique password to prevent unauthorized access to your database.
You can change the MySQL root password by opening a terminal window and using the following command:
sudo /opt/lampp/bin/mysqladmin -u root password NEW_PASSWORD
Note: Replace NEW_PASSWORD with a strong and unique password of your choice.
By default, XAMPP allows remote access to the Apache web server and MySQL database. This can be a security risk if your VPS is connected to the internet. To disable remote access, you can edit the ” httpd-xampp.conf ” file and comment out the following lines:
# Require local
# Require ip 192.168
Save the file and restart the XAMPP server using the following command:
sudo /opt/lampp/lampp restart
XAMPP releases updates periodically to address security vulnerabilities and bugs. Make sure to keep your XAMPP installation up-to-date by downloading and installing the latest version from the official website.
In this guide, we walked through the process of installing XAMPP on a Linux VPS. XAMPP provides an easy and convenient way to set up a development environment on your VPS, but it is important to take additional steps to secure your installation before using it in a production environment.
We hope that this guide was helpful and that you are now able to install and use XAMPP on your Linux VPS. Also, you can Read How to install XAMPP on Windows VPS. If you have any questions or comments, feel free to leave them below.