create .desktop launch

Problems with the Linux version of XAMPP, questions, comments, and anything related.

create .desktop launch

Postby SystemL » 24. June 2018 14:16

Hi, how to create .desktop launch from Desktop ..launch ?

xampp 7.1.18 64 bit. Ubuntu 18.04 LTS Desktop GNOME.

My elementary english.
Posts: 4
Joined: 23. November 2016 16:43
XAMPP version: 3.2.2
Operating System: Windows 10 64 bit

Re: create .desktop launch

Postby joshim » 22. July 2018 18:32

This requires a few steps because XAMPP requires root privileges to run. These instructions assume you have installed XAMPP in the default /opt/lampp/ folder in Ubuntu 18.04.

1. Create a bash script to launch XAMPP GUI

Open gedit and type:

Code: Select all


Save this as I have a folder for bash scripts like this in my home folder called 'scripts,' but you can save this wherever you like. You will need the path for the next step.

2. Give the script correct permissions

This script will not open XAMPP yet because it does not have sudo rights. To get this to work open terminal and enter one line at a time:

cd /path/to/script/
sudo chown root:root
sudo chmod 700

This has given the script the necessary permissions, but now we need it to run without having to enter the sudo password. So the next step is to exempt it in the sudoers file.

3. Exempt script from needing sudo password

In the terminal enter:

Code: Select all
sudo visudo

This will launch the sudoers file within terminal. It allows us to make changes to sudo users file without the risk of locking ourselves out by mistake.

Around line 25, you'll see this line: %sudo ALL=(ALL:ALL) ALL

Below that line, insert the following line, where username is your username:

Code: Select all
username  ALL=(ALL) NOPASSWD: /path/to/file/

Exit with Ctrl + X, then press Enter to save.

4. Create the launcher

You need gnome-desktop-item-edit to easily create desktop launchers. It is not installed in Ubuntu 18.04 by default, so in terminal enter:

Code: Select all
sudo apt-get install --no-install-recommends gnome-panel

After install is done, in terminal type:

Code: Select all
gnome-desktop-item-edit ~/Desktop/ --create-new

This will launch the desktop launcher creator. Enter the details as follows:

Type: Application
Command: sudo /path/to/file/

Click OK. The launcher should now appear on your desktop. Double click to give it a try. At this point XAMPP should launch. Next, right click the launcher and open with gedit or text editor. If there is an "Icon" value, change it to the following, or if there is no "Icon" value, just add this line at the end:

Code: Select all

Press save and close the editor.

5. Move launcher so that it can be found in Applications drawer

If you want to be able to search for this launcher like other applications, it has to be moved to /usr/share/applications.

In terminal enter:

Code: Select all
cd Desktop
sudo mv /usr/share/applications

Now when you search for XAMPP in GNOME, it will appear.

Hope this works for you.
Posts: 5
Joined: 22. July 2018 17:53
XAMPP version: 7.2.7-0
Operating System: Ubuntu 18.04

Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 9 guests