How to Set Up a LAMP Environment With XAMPP on Ubuntu Linux

This guide will show you how to set up a LAMP Server (Linux, Apache, MySQL, and PHP) for developing PHP-based web applications on Ubuntu Linux using XAMPP.

You can use the XAMPP stack to develop PHP applications powered by frameworks such as WordPress, Joomla, Drupal, PrestaShop, etc.

What Is XAMPP?

XAMPP is one of the most popular LAMP-stacks for setting up a PHP development environment. It is open-source and available on all major operating systems including Windows, Linux, and macOS. The core components that work together to make XAMPP include Apache, MySQL, PHP, and Perl.

The XAMPP server is ideal for software development or prototyping because it is relatively easy to set up and doesn’t require much configuration. However, note that XAMPP is not recommended for use as a production server because it compromises some security issues in order to make setting up your development environment easier. For example:

  • Anyone can easily access the MariaDB daemon via the network.
  • The default database administrator (root) does not have a password.

Download XAMPP for Linux

To start, you should download the XAMPP Debian package for Ubuntu Linux as outlined below.

First, go into your Downloads directory using the cd command.

cd ~/Downloads

Run the following command to download XAMPP using wget, a command-line tool for downloading packages from the internet.

wget https://www.apachefriends.org/xampp-files/8.0.8/xampp-linux-x64-8.0.8-0-installer.run

Note: You can replace the XAMPP version in the command above with the version of your liking if you wish to.

Since your current working directory is the /Downloads folder, wget will automatically save the XAMPP application installer to that directory.

How to Install XAMPP on Ubuntu

Before you can install the XAMPP application, you’ll need to change the permissions of the installer to make it executable using the chmod command.

sudo chmod 755 xampp-linux-x64-8.0.8-0-installer.run

If you list the XAMPP installer using the ls -l command, you’ll get an output similar to the one below. As you can see, the installer now has “execute” permissions.

Issue the following command to start the XAMPP installer:

sudo ./xampp-linux-x64-8.0.8-0-installer.run

The initial screen of the XAMPP installer should look similar to the one below:

Click on the Next button and follow along with the installation instructions of the wizard.

Click on the Finish button to finalize the installation.

Once the installation is complete, the system will store the XAMPP files in the /opt/lampp directory on your system. The web pages or projects will be placed in the /opt/lampp/htdocs directory.

To start the XAMPP services, such as Apache, MySQL, and ProFTPD, simply run the following command:

sudo /opt/lampp/lampp start

You can check the status of the XAMPP services by typing:

sudo /opt/lampp/lampp status

Also, note that XAMPP comes with a graphical tool that you can use to manage your services easily. You can start the XAMPP GUI tool with the following commands:

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

The following XAMPP window will open.

Check if Everything Is Working

If you are able to start the services without any problems, then everything is probably working as expected.

To check if the Apache server is serving your web pages as expected, type http://localhost in your web browser. The browser will display a page that looks similar to the one below. For your information, the Apache server runs on port 80 by default.

You can also access the MySQL database that comes with XAMPP by typing the http://localhost/phpmyadmin URL in your browser.

Learn more: Become an Expert in Web Development and MySQL With This Course

Setting Up a LAMP Server in WSL

This guide has shown you how to set up a XAMPP server to use while developing your PHP-based applications. For security reasons, you should never use XAMPP for production purposes.

For developers who are working on Windows Subsystem for Linux, you can also set up a LAMP server on WSL if you want.

Source: makeuseof.com

Related posts

“Super Bundles” Can Help Save on Streaming, but What Are They?

Here’s How I Streamline My Smartphone Photography Workflow

I Wish More People Knew About These 6 Steam Features