How to Install XAMPP on a Linux VPS in 5 Minutes?

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.

How to Install XAMPP on a Linux VPS in 5 Minutes

Before we start the installation process, let’s go over some prerequisites.

Prerequisites

    • A Linux distribution that is supported by XAMPP (e.g., Debian, Ubuntu, CentOS, etc.)
    • Sufficient storage space for the XAMPP installation (at least 1 GB)
    • The latest version of the sudo package installed on your system
    • A non-root user with sudo privileges

Once you have verified that your VPS meets these requirements, you can proceed with the installation.

Step 1 – Download XAMPP

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.

Download XAMPP

Step 2 – Extract the XAMPP Archive

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:

cd ~/Downloads

cd ~/Downloads

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

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.

Step 3 – Start the XAMPP Server

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

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.

Step 4 – Test PHP

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

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(); ?>

<?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.

Step 5 – Secure your XAMPP Installation

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:

Step 6 – Change the default XAMPP password:

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

Change the default XAMPP password

 

Note: Replace NEW_PASSWORD with a strong and unique password of your choice.

Step 7 – Disable remote access:

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

Disable remote access

Save the file and restart the XAMPP server using the following command:

sudo /opt/lampp/lampp restart

sudo /opt/lampp/lampp restart

Step 8 – Keep your XAMPP installation up-to-date:

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.

Conclusion

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.


author image

The Author Emily.J

Emily started working as a member of the sales team, and because of his strong passion for providing solutions to the problems of users, he has become a successful person in the field of content creation, and so far he has been able to solve many problems. Also, Emily is trying to increase his expertise and experience with serious challenges.

More from Emily.J

Post Your Comment

Your email address will not be published. Required fields are marked *