I am under the impression that it is a good ideal to install applications to /opt
Therefore, whenever I download a program I place it in /opt
. However, some of these are AppImages and some of them are folders.
However, now to run one of those applications, I have to run /opt/pathtoapp/
from a terminal prompt - and usually with sudo
because of the app location in opt
.
Is there an easy way to make a desktop icon, add it to my system and make the application be recognized as a native application (like to open other files with) and run without sudo privileges when it is located in /opt
?
appimaged
is an optional daemon that watches certain locations for AppImages and if it detects some, registers them with the system, so that they show up in the menu, have their icons show up, MIME types associated, etc. It also unregisters AppImages again from the system if they are deleted.appimaged
will register the AppImages in with your system from the following places:$HOME/Downloads
(or its localized equivalent, as determined byG_USER_DIRECTORY_DOWNLOAD
in glib)$HOME/.local/bin
$HOME/bin
$HOME/Applications
/Applications
[any mounted partition]/Applications
/opt
/usr/local/bin
https://github.com/AppImage/appimaged#monitored-directories
There are few things you have to do with the externally-installed application for it to be "integrated" into your system. But first let's clarify installation directories:
Installation directories
/opt
is a folder for system-wide storing and installation of externally installed applications.~/.local/
is a set of folders for your-user-only storing and installation of the same apps.Sudo problems
There should NOT be a need to
sudo
the application, where ever could it be saved unless the app itself needs root privileges. Check the following:If the file permissions of the app file(s) are OK:
The file should have (when
ls -l [filename]
) these permissions:775 =
rwxrwxr-x
If it's not, just:
chmod 775 filename
If all folders containing this app's file(s) have correct permissions:
775 =
rwxrwxr-x
If not, just
chmod 775 folder
If the app doesn't try to access any files with non-matching permissions:
This may be harder to check, but usually, you can just enable debugging mode on the app with (for example)
-v
option (differs from app to app - you can sometimes find out by--help
or in man or info pages) and then see the errors the app prints out.(Warning: With this question, you didn't show us what makes you use
sudo
on those apps! If none of these methods work, it WILL be certainly because WE do NOT know what is happening in your computer!)DE "integration"
App launchers are saved in file(s) (like everything on Linux).
On most Linux distros (including Ubuntu),
AppName.desktop
files are used. If the app you are using doesn't provide these, you can make yourself one (and not just for apps).Just put this into a file named
AnyNameYouWantHere.desktop
file:Then run:
xdg-desktop-menu install --novendor AnyNameYouWantHere.desktop
You can as well provide
--mode
option: (according to the man page of xdg-desktop-menu)You can now delete the file -
xdg-desktop-menu
has copied it to its own location.Shell integration
To run the app from the shell without the need to supply its whole location, you have to add it to your PATH.
What is a PATH, you might ask...
$PATH is a variable in your shell, that tells
bash
,dash
,zsh
, or any other shell where are apps saved. On most systems it's going to have something like this in it:This tells your shell that when you put an app name in it, it should look for it in these locations.
Where to then save the app?
If it's system-wide installed:
Just link it into the
/usr/bin
directory:ln -s /opt/amazingapp/AppImage /usr/bin/
If it's user installed:
Again link it as above, but this time into
/home/your_username/.local/bin
, then add/home/your_username/.local/bin
in to your PATH, if it isn't already in there. (Most info HERE: https://unix.stackexchange.com/a/26059/316299 ) You can test that after you linked the program, by closing and opening the shell again, and trying the full name of the app.