Best practices to maintain application/programs

  1. What are best practices to install an application in fedora

  2. also what are the best practices to uninstall and application and it’s related files in fedora. (Removing .cache/app, .config/appname, . local/share/applications/app.desktop)

I know that we can use dnf to install application, but there are applications like intellij community edition, eclipse for these type of softwares they have separate installer applications.

Usually when we download this kinds of softwares, we extract the .tar.gz file in our download folder, then which contains application source files to run it properly. But if we unexpectedly delete the folder then it’s a mess.

I saw that external applications can be installed in /opt

You’re on the right track with most of your observations! Here’s a summary of best practices for installing and uninstalling applications on Fedora, especially when dealing with third-party software like IntelliJ IDEA or Eclipse.

Best Practices for Installing Applications

  1. Use the Package Manager (dnf) whenever possible:
    This ensures proper system integration, dependency management, and easier updates/removal. Example: sudo dnf install gimp

  2. Flatpak for GUI apps:
    If the software is available as a Flatpak, it’s often the best alternative to manual installs.
    Example: flatpak install flathub com.jetbrains.IntelliJ-IDEA-Community
    Flatpaks are sandboxed, auto-updated, and don’t clutter your home/config directories as much.

  3. For software distributed as .tar.gz archives (like IntelliJ, Eclipse):
    Instead of keeping them in ~/Downloads, a better practice is:
    Extract to /opt for system-wide installation
    sudo tar -xzf ideaIC-*.tar.gz -C /opt/

    You can create a symlink to /usr/local/bin for easier CLI access:

    sudo ln -s /opt/idea-IC*/bin/idea.sh /usr/local/bin/intellij

    Optionally create a .desktop entry in /usr/share/applications/ or ~/.local/share/applications/ to integrate with your desktop environment.

  4. Use installers if provided:
    Some apps like JetBrains Toolbox can manage IDE installations properly (in `~/.local/share/JetBrains/), handle updates, and create launchers automatically.

Best Practices for Uninstalling Applications

  1. If installed via dnf - Remove using:
    sudo dnf remove appname

    Clean up leftover user config:
    rm -rf ~/.config/appname ~/.local/share/appname ~/.cache/appname

  2. If installed manually in /opt:

    Just remove the folders:
    sudo rm -rf /opt/idea-IC*
    sudo rm /usr/local/bin/intellij

    also delete the .desktop file if you created one:
    rm ~/.local/share/applications/intellij.desktop

Summary:

  • Prefer dnf or flatpak when available.
  • For .tar.gz apps, use /opt for organization and cleaner system management.
  • Always clean up config files from ~/.config, ~/.cache, ~/.local/share if uninstalling manually.
  • Consider using JetBrains Toolbox or similar tools if available for the app.

Disclaimer: This Post has been written with the help of ChatGPT, but the Information has been verified by a Human.

In general, there’s no easy way to uninstall software installed from source—it depends on the “build system” they use. If it’s a make style one, they often include make uninstall, but one has to be very careful that it doesn’t pull out any other files.

Unless you want all users to have access to a tool, you don’t have to use /opt either. You can use ~/.local and that way it’s contained for one user only.

@bachenberg : your answer sounds quite AI generated, was it? That’s perfectly fine if it is, but we do ask people to please note when they’ve used AI so that other forum members are aware. (everyone can use AI, but people come to the forum to get human answers, so it’s important to note where information is coming from)

2 Likes

This COPR repo has IntelliJ and several other JetBrains products: medzik/jetbrains Copr

So if you add that repo, you can install IntelliJ using dnf.

1 Like

I’m not aware of an easy way to automatically do that besides installing applications as Flatpaks when possible. Flatpak app user data is usually contained in ~/.var/app/* and these directories can be easily removed:

  1. Delete the correct ~/.var/app/<application_id>. The app can still be installed but this will “reset” it to a clean state – as though you have never opened it before.
  2. Delete these directories for all uninstalled apps: flatpak uninstall --unused
  3. Using GUI apps (e.g. Flatsweep). Some software managers like GNOME Software often will give you an option to remove the corresponding data when uninstalling a program.

This assumes that the application behaves well and touches only user data in this directory – as opposed to requiring access e.g. to your whole $HOME directory just so it can bypass this mechanism. In my experience, many apps will do the correct thing. Some might store data (also/entirely) elsewhere but if they don’t have weird permissions, this should usually not be an issue.

Other programs, no matter how they are installed can use the directories which you mentioned (.cache, .config, .local/share) to store data and this is the good case. They might also touch files in other places and it can be different for different programs.

I can share my approach of managing apps in my Fedora Atomic installations. I’m not sure it could be universally recommended, but it well supports my portability and compartmentalization requirements.

  • I use systemd-homed managed users on external/separate drives to contain all my files, data, configs and apps to a LUKS protected homed-managed user home.
  • I uninstall as many apps from base install as I can, both native and flatpak
  • Only system-wide components are layered, e.g., VPN or libvirt software
  • I install all GUI apps as flatpak to --user space, i.e., to my user home

Important note about portability of systemd-homed managed user homes - I still need copy systemd-homed keys to the target install in order for systemd-homed access and manage my home on external/separate disks seamlessly.

This method is not ideal, but it provides good level of portability and security to my files, apps, etc.

If you uninstall a Flatpak from the command line, you can actually wipe its directory in ~/var/app at the same time:

> flatpak uninstall [application_id] --delete-data
2 Likes

This cannot be done automatically, at least not for data in a user’s home and with DNF. (APT on Debian/Ubuntu has a ‘purge’ functionality, which also removes global configuration data (typically files in /etc/. But even this does not remove data from users’ homes. And I don’t know of an equivalent for RPM.)

I have seen variations of this come up several times, typically from users who are the only user on their machine. But just imagine you share your machine with a partner or kids. Then each of these users can use any installed application and it will create files in their respective homes. And then the adminstrator comes along and uninstalls the application. To do what you ask, the uninstall would have to go through all users’ homes and remove data from each user. And even if this was possible, I would seriously consider violence if a careless admin user uninstalled an application and deleted data of that application from my home directory.

You are absolutely right. The most part is AI generated / translated. Sorry for not flagging it ( I didn’t know that rule ).