Install XAMPP on Ubuntu
Tags: xampp, php, install, ubuntu
Published: 2021-06-04 05:21:50

A [XAMPP](https://apachefriends.org/) is one of the most popular cross-platform PHP development environment. It is an open source package that can be easily install and to use.

XAMPP stands for cross-platform (**X**), Apache (**A**), MariaDB (**M**), PHP (**P**), and Perl (**P**).

XAMPP has been used widely by developers and has been around here with huge support of community since more than 10 years. It's currently available on Windows, Linux & Mac platforms while writing this article.

To download the Linux installer head over to the [Download](https://www.apachefriends.org/download.html) page. Here you will find latest release as well as previous versions.

While writing this article, the latest release version is 8.0.6. In this article, we will see how to install this open-source application in Ubuntu or Ubuntu-based distributions. Follow the same steps to install into other Ubuntu-based Distros.

## Install XAMPP on Ubuntu or Ubuntu-based Distros

### Download the XAMPP installer

Head over to [XAMPP Home](https://www.apachefriends.org/index.html) page and select **XAMPP for Linux**, that contains direct link that can be used for the latest version.

![Source: apachefriends.org](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/778lxi07vtarck9svdqj.png)
 

Once it's downloaded, open your terminal (`Ctrl + Alt + T`), head over to your directory where your installer has been saved and run the below commands with `sudo` privileges to change the permission.

```Bash
sudo chmod 755 xampp-linux-*-installer.run
```

This command will give permission to the installer.

**Note: Replace `xampp-linux-*-installer.run` with actual file name.**

### Run the XAMPP installer

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

This command will start the installer wizard. Proceed with installation, make changes if you need. By default it will be installed in `/opt/lampp/` directory, you can customize the installation directory too.

### Install supporting package

```Bash
sudo apt install net-tools -fy
```

This command will install `netstat` that is a part of the `net-tools` package.

### Start, Stop & Restart Server

#### Start, Stop & Restart Server via command line aka CLI

- Start the server with below command

  ```Bash
sudo /opt/lampp/lampp start
  ```

- Stop the server with below command

  ```Bash
sudo /opt/lampp/lampp stop
  ```

- Restart the server with below command

  ```Bash
sudo /opt/lampp/lampp restart
  ```

#### Start, Stop & Restart Server via Graphical User Interface aka GUI

- Execute the below command to launch graphical manager

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

### Create alias or shortcuts for commands for Bash Shell

Below command will create an alias for command for Bash shell, so you only need to use `lamppStart` to launch the graphical manager. You might need to reopen the terminal to use this newly added alias.

```
echo "alias lamppStart='cd /opt/lampp/ && sudo ./manager-linux-x64.run'" >> ~/.bashrc
```

## Creating a launcher icon

With the below code, you can create it a launcher icon.

```bash
cat > ~/.local/share/applications/postman.desktop <<EOL
[Desktop Entry]
Version=1.2
Encoding=UTF-8
Name=XAMPP
Exec=sh -c "pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY sudo /opt/lampp/manager-linux-x64.run"
Icon=/opt/lampp/htdocs/favicon.ico
Terminal=false
Type=Application
Categories=Network;WebBrowser;Development;
MimeType=text/html
EOL
```

## Uninstall XAMPP

- To uninstall XAMPP, open the terminal and navigate to the `opt/lampp` directory with the below command.
   ```bash
 cd /opt/lampp
   ```
- Execute the below command to uninstall XAMPP.
   ```bash
 sudo ./uninstall
   ```
- The prompt dialogue box will open asking for your confirmation to uninstall XAMPP and all of its modules.
- Finally, remove the lampp installation directory with below command.
   ```bash
 sudo rm –r /opt/lamp
   ```

### Conclusion

After reading this article, you will be able install XAMPP on Ubuntu or Linux devices.

XAMPP allows you to set up a free development environment on your system. It is a set of tools that allows you to get your site up and running much easily & quickly. An alternative to installing and configuring individual components.

Read the complete post on our site [Install XAMPP on Ubuntu](https://meshworld.in/install-xampp-on-ubuntu/)

Read others post on our site [MeshWorld](https://meshworld.in)

Hope you like this!

Keep helping and happy 😄 coding