Saturday, April 19, 2014

Create a desktop file for XAMPP control panel on Ubuntu

Steps to create a desktop file on Ubuntu:

1- Open any text editor, and type the following:

[Desktop Entry]
Comment=Start/Stop XAMPP
Name=XAMPP Control Panel 1.8.3-4
Exec=gksudo "python /opt/lampp/share/xampp-control-panel/"
Name[en_CA]=XAMPP Control Panel
Comment[en_CA]=Start/Stop XAMPP
Save this as xampp.desktop

Creating a desktop file is very simple, you can read more about it from this link:

2- And now as we have created a desktop file, we need to move it to applications directory, so it will be visible by unity launcher.

sudo cp xampp.desktop /usr/share/applications

3- We need to make it executable, so we can run it from launcher:
cd /usr/share/applications
sudo chmod 777 xampp.desktop
4- now we have executable, but if you run it, you will see an error, and to solve it, we need to install two libraries, if you notices the Exec=gksudo "python /opt/lampp/share/xampp-control-panel/" in the desktop file, you will see that we used gksudo, which we need to install, and  python-glade2 to run python file we have.

and this is can be done by running these two commands:
sudo apt-get install gksu
sudo apt-get install python-glade2

Thats it :).