If you are a PHP programmer or any of the frameworks of PHP then apache 2, MySQL, PHP, and PHPMyAdmin are very common to use, and XAMPP gives a package of all the 4, So XAMPP became a very popular name among the PHP and PHP Framework programmers, Now Ubuntu is an open-source operating system and many developers love to work in Ubuntu or Linux operation system. So XAMPP in Ubuntu or Linux also became very useful, Now we are going to learn How to install XAMPP in Ubuntu 22.04 Linux.
To install XAMPP in Ubuntu operating system we need to follow a few steps and they are as described below,
- Update System Packages
- Download XAMPP On Ubuntu
- Give permission to the downloaded file
- Install XAMPP On Ubuntu
- Open Web Dashboard and phpMyAdmin using Xampp
1. Update System Packages
First of all, you have to update your system packages and for that open the command prompt or terminal of your Ubuntu machine and run the below command.
$ sudo apt update
2. Download XAMPP On Ubuntu
Now you have to download the XAMPP for installation and for that you have to go to the https://www.apachefriends.org/ link and then click on the download menu from the top menu bar
Now head over or scroll down to the XAMPP for Linux section and then choose according to the PHP version and download the XAMPP package,
You can download it from the command line also and for that, you have to run the below command according to the PHP version :
For PHP 8.1
$ wget https://www.apachefriends.org/xampp-files/8.1.1/xampp-linux-x64-8.1.1-2-installer.run
For PHP 8.0
$ wget https://www.apachefriends.org/xampp-files/8.0.14/xampp-linux-x64-8.0.14-1-installer.run
For PHP 7.4
wget https://www.apachefriends.org/xampp-files/7.4.27/xampp-linux-x64-7.4.27-1-installer.run
For PHP 7.3
wget https://www.apachefriends.org/xampp-files/7.3.33/xampp-linux-x64-7.3.33-0-installer.run
For PHP 7.2
wget https://www.apachefriends.org/xampp-files/7.2.34/xampp-linux-x64-7.2.34-0-installer.run
3. Give permission to the downloaded file
In any way you have downloaded the XAMPP executable file, that is from the command line or directly from the website, you have to give file permission first, and for that follow the below instructions,
** If you have downloaded it manually from the browser then you have to locate the folder where you have downloaded the XAMPP package and the right click on the folder and then click on the open in terminal and after opening the terminal run the below command
$ sudo chmod -R 777 ./xampp-linux-x64-7.4.29-0-installer.run
** If you have downloaded from the command line then also you have to give the file permission and for that, you have to run the below command in terminal
chmod a+x xampp-linux-x64-7.4.29-0-installer.run
Note: the xampp-linux-x64-7.4.29-0-installer.run will be replaced with your downloaded XAMPP package name
4. Install XAMPP On Ubuntu
Now after giving file permission your package is ready to install, and to install you have to run the below command in your terminal
sudo ./xampp-linux-x64-7.4.29-0-installer.run
Note: here also the xampp-linux-x64-7.4.29-0-installer.run will be replaced with your downloaded XAMPP package name
Now after running the command, there will appear an installation popup for setup XAMPP, there you have to press next
Now you have to follow the installation process by pressing the next button and finally, it will start to install and move the files to the installation folder
The installation progress may take a few minutes but you have to wait for the completion of the XAMPP installation process in Ubuntu.
Now finally you have to press the finish button to finish the installation process and if the launch XAMPP checkbox is checked then it will open the XAMPP window to start and stop Apache, MySQL, etc
5. Open Web Dashboard and phpMyAdmin using Xampp
Now start the Apache and MySQL and then open your browser and type localhost and enter in the address bar, and if you have successfully installed the XAMPP and started Apache and MySQL it will open the XAMPP info window in your browser,
if XAMPP info opened successfully in your browser then open another tab and type localhost/phpmyadmin in the address box and hit enter and give username as root and left the password box as blank and login and it will open your PHPMyAdmin window to handle the database
And then go to your drive and open /opt/lampp/htdocs folder it is your project folder and now inside the folder you can create PHP and its framework project or PHP file inside the folder and enjoy coding PHP.