XAMPP Linux Ubuntu
What is XAMPP?
How to Install XAMPP on Ubuntu Linux 2021 - XAMPP is one of the most widely used database management applications by web developers for creating SQL databases within the scope of the PHP programming language.
This XAMPP application is cross platform that can be installed on Windows, Linux and Mac OS. In this article I will share how to install XAMMP on Linux using the terminal.
Download XAMPP Linux
If you don't have the installer file, please download it on the download page. You can download the version you want.
You can use the following buttons
Now, once the download is complete open Terminal. Then navigate to the folder where the file has been downloaded.
For example, the name of the XAMPP file I downloaded is xampp-linux-x64-8.0.7-0-installer.run in the Downloads folder.
Open a terminal, then type the following command:
$ cd Downloads/
Then, for installation use the following command:
$ sudo ./xampp-linux-x64-8.0.7-0-installer.run
Then the XAMPP application install screen will appear like this:
Just click Next and Next for the installation process.
When the installation is complete, the XAMPP folder will be in /opt/lampp and it will look like this:
Okay, so far we have finished the installation process, but it can't be used smoothly. We have to change the access permissions of the htdocs folder.
Change htdocs Folder Permissions
Slightly different from Windows, on Windows OS we can directly access (write) files in the htdocs folder, where htdocs is the folder that we will use to store php files and others and in this folder localhost/ is located.
Linux by default will make this htdocs folder accessible only to administrators. So, with this condition we will have a bit of a problem if we want to write one of our project files which we will save in the htdocs folder.
To be able to change it to public / guest, then open a terminal using the following command:
$ sudo chown -R username:username /opt/lampp/htdocs
*username is replaced with the username of your computer. For example, your computer username is asus, then the command will be:
$ sudo chown -R asus:asus /opt/lampp/htdocs
Then, we have to update the httpd.conf file which is owned by XAMPP. Please open the file via terminal with the command:
$ sudo gedit /opt/lampp/etc/httpd.conf
*gedit is a text editor application that I use. You can replace it with your favorite text editor.
When the httpd.conf page opens, look for the words:
User nobody Group nobody
Change it with :
User nobody Group nogroup
Then save file httpd.conf.
How to Run Server on XAMPP on Linux
This becomes very important, because by running the server we can access localhost and start creating the desired website.
To be able to run an existing server on XAMPP on Linux, there are two ways:
Using Control PanelTo be able to run the server, open the control panel and navigate to the Manage Servers menu. Pay attention to the following picture:
By default, there are 3 servers provided, MySQL Database, ProFTPD and Apache. The red color indicates that the server has not been started.Please click Start on each server and wait for the color to turn green.
Please open a terminal, use the following command:
$ sudo /opt/lampp/xampp startIf you get a result like the following, it means the server has been running successfully.
Starting XAMPP for Linux 8.0.7-0... XAMPP: Starting Apache...ok. XAMPP: Starting MySQL...ok.
No Launcher Shortcuts Icon XAMPP Control Panel on Your Computer?
If you want to access the XAMPP control panel, by default shortcut icons are not created automatically. So to run the XAMPP Control Panel on Linux, use the following command:
$ sudo /opt/lampp/manager-linux-x64.run
Okay I assume everything is running normally and the server is running, especially the Apache server.
Open a web browser, Google Chrome for example, then type localhost/ in the search form, then click Enter.
If it looks like the picture above, it's a sign that you have successfully installed XAMPP on Linux.