Automated installation of multiple applications after a fresh OS install? (Fedora)
from makingStuffForFun@lemmy.ml to linux@lemmy.ml on 24 Sep 2024 23:35
https://lemmy.ml/post/20673461

Hi all,

I am about to do a bit of a distro hop, and I am looking at Fedora and its spins, after years on Debian / POP.

I am not looking forward to setting it all up again, it’s a drag.

I wonder, is there a tool that lets me script installs?

I’ll want to check if application exists, and if so, update, otherwise, install. That kind of thing.

Things like:

I show the list, only to give an idea of what might be involved.

I’m new to Fedora, so not sure how it differs beyond the package manager. But, thought I’d ask.

Does such a tool exist, and is it worth my time? I can practice on a VM before trying on the final install/s.

Thank you

#linux

threaded - newest

vhstape@lemmy.sdf.org on 24 Sep 2024 23:39 next collapse

I use yadm’s post-checkout script feature to accomplish this on my machines.

subtext@lemmy.world on 25 Sep 2024 00:05 collapse

Or any of the similar tools listed here, based on personal preferences! I currently use Chezmoi, but I like that they help you discover alternatives.

qocu@hexbear.net on 24 Sep 2024 23:46 next collapse

I didn’t find any script that would install the apps you wanted, but I did find a script that will help you build your own (it’s pretty easy). You can take inspiration from this one and modify it, so that whenever you reinstall your system, you’ll run your script.

gist.github.com/…/ed53aa410a22620013e04baca437abb…

Research what commands are used in Fedora to install what application and add them to your script. Then, give your .sh file execute permissions and run it. You can do this in a virtual machine first if you want.

makingStuffForFun@lemmy.ml on 24 Sep 2024 23:57 next collapse

oh that is VERY nice, I even have a lenovo laptop. I think that will get me started for sure. Thank you

makingStuffForFun@lemmy.ml on 25 Sep 2024 01:17 next collapse

…aaaand DONE and tested. That was amazingly simple, when there’s a framework like that to work, and learn from. Thanks again.

qocu@hexbear.net on 25 Sep 2024 02:31 collapse

Wow, that was fast. Glad it helped you.

possiblylinux127@lemmy.zip on 25 Sep 2024 04:04 collapse

Not to sound rude but I am fairly surprised to see this from a hexbear user. It seems like a lot of hexbear is just going around and trolling.

I can’t say I agree with hexbear but I appreciate the normal (and very useful) comment

harsh3466@lemmy.ml on 24 Sep 2024 23:55 next collapse

You could write yourself a bash script to do this.

makingStuffForFun@lemmy.ml on 25 Sep 2024 02:04 collapse

This ended up working perfectly

harsh3466@lemmy.ml on 25 Sep 2024 03:44 collapse

Awesome!

lens0021@lemmy.ml on 25 Sep 2024 00:33 next collapse

Have you tried SaveDesktop? Thought It is limited in the flatpak softwares, but cloud synchronization feature is recently added.

TeryVeneno@lemmy.ml on 25 Sep 2024 19:19 collapse

Was looking for this in this comment section, I see this solution as becoming the goto for moving between installs even though it is limited right now

feddylemmy@lemmy.world on 25 Sep 2024 00:33 next collapse

Something like Ansible won’t help you the first time around, but it’ll make the next times easier.

possiblylinux127@lemmy.zip on 25 Sep 2024 04:01 collapse

It can make the first time around easy if you use the proper plugin

that_leaflet@lemmy.world on 25 Sep 2024 00:36 next collapse

I have a bash script I use to script my Silverblue install. Something like this should work.

# space-separated list of packages to install
S_RPM_PACKAGES_TO_INSTALL="pkg1 pkg2 pkg3"

# function to install the packages
dnf_install () {
	sudo dnf install -y $1
}

# call to function, passing the list
dnf_install "$S_RPM_PACKAGES_TO_INSTALL"

I have it set up this way so that I just have a bunch of bash variables describing the stuff I want to install all at the top of the file, but the function definitions and calls lower down since I don’t need to see them.

It also does other things like removes packages from the system, removes some preinstalled flatpaks, installs flatpaks from Fedora Flatpaks / Flathub / gnome-nightly, and sets up gnome through a list gsettings commands.

As I use my system, I add new apps to the list I want next time I install and remove apps I don’t use.

makingStuffForFun@lemmy.ml on 25 Sep 2024 01:25 collapse

I love this, I will update the script I’ve setup to mirror your idea. Nice and clean.

I wonder if you can help at all? The only app that fails install is Anydesk. I have to do the following:

# Anydesk
sudo tee /etc/yum.repos.d/anydesk.repo<<EOF
[anydesk]
name=AnyDesk Fedora Linux
baseurl=http://rpm.anydesk.com/fedora/x86_64/
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://keys.anydesk.com/repos/RPM-GPG-KEY
EOF

sudo dnf install anydesk -y

But it gives an error, saying :

[anydesk]
name=AnyDesk Fedora Linux
baseurl=http://rpm.anydesk.com/fedora/x86_64/
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://keys.anydesk.com/repos/RPM-GPG-KEY
AnyDesk Fedora Linux                                                                                                                                                         397  B/s | 488  B     00:01    
AnyDesk Fedora Linux                                                                                                                                                         1.8 kB/s | 1.7 kB     00:00    
Importing GPG key 0xCDFFDE29:
 Userid     : "philandro Software GmbH <info@philandro.com>"
 Fingerprint: D563 11E5 FF3B 6F39 D5A1 6ABE 18DF 3741 CDFF DE29
 From       : https://keys.anydesk.com/repos/RPM-GPG-KEY
AnyDesk Fedora Linux                                                                                                                                                         796  B/s | 1.2 kB     00:01    
Error: 
 Problem: conflicting requests
  - nothing provides libgtkglext-x11-1_0-0 needed by anydesk-6.3.2-1.x86_64 from anydesk
(try to add '--skip-broken' to skip uninstallable packages)

Is there a special way to add that kind of command to a bash script? All good apart from that though.

that_leaflet@lemmy.world on 25 Sep 2024 01:54 collapse

I think that’s just a dependency issue unrelated to the script.

makingStuffForFun@lemmy.ml on 25 Sep 2024 01:58 collapse

ok, thank you. I’ll address that, in that case. Thanks again!

EDIT, and resolved. Thanks again.

Concave1142@lemmy.world on 25 Sep 2024 00:36 next collapse

I use an Ansible playbook to do fresh install stuff such as app installs & joining my local Samba AD.

Another option, that I’ve never tried, would be to put your /home directory on another partition. That only solves the settings though and not your app installation bit.

possiblylinux127@lemmy.zip on 25 Sep 2024 04:00 collapse

Do you use Windows?

Concave1142@lemmy.world on 25 Sep 2024 11:07 collapse

I daily drive Debian and use Windows for work. Only have one Windows VM for playing games via Moonlight.

possiblylinux127@lemmy.zip on 25 Sep 2024 13:29 collapse

So you use Samba AD for the Windows VM?

Concave1142@lemmy.world on 25 Sep 2024 15:10 collapse

Correct. I’m running two AD DC’s based on Samba, all running on Zentyal. Super simple to install & setup. I them run a VM in Virtualbox on my laptop for the rare occasions I need to use the Windows RSAT tools.

Other than that, all my Linux VM’s, ProxMox hosts & unRAID NAS all set to auth against the Samba DC. It has been working perfectly for over a year now.

www.zentyal.com

possiblylinux127@lemmy.zip on 25 Sep 2024 15:35 collapse

I don’t believe Zentyal is supported by the Samba team. I’d just stick to regular Samba DCs.

I am personally debating on setting up either Samba AD or FreeIPA. FreeIPA is definitely better for Linux but I really like Samba. Thanks for answering my question.

kuadhual@lemm.ee on 25 Sep 2024 00:47 next collapse

Using ansible will help you on your 2nd, 3rd , nth install.

But getting ansible to do what you want (plus testing) for the first time would takes 10x longer than manual install.

I think there’s xkcd about that.

exu@feditown.com on 25 Sep 2024 05:19 collapse

Just installing applications is pretty easy though.

---
- hosts: localhost
  become: yes
  tasks:
    - name: Install required software
      dnf:
        state: latest
        name:
          - firefox
          - telegram
          - calibre

ansible-playbook install.yml

Something like that (untested)

timbuck2themoon@sh.itjust.works on 25 Sep 2024 22:50 collapse

I distinctly remember yum/dnf should be using a loop. Forget why but it’s recommended. Here’s a snippet from my playbook. Simply make the vars as you need and run.

  - name: Install flathub as remote
    ansible.builtin.shell:
      cmd: flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
    tags:
      - apps

  - name: Install flatpak apps
    community.general.flatpak:
      name: "{{ item }}"
      state: present
    loop: "{{ flatpaks }}"
    tags:
      - apps

  - name: Remove some default unused packages
    ansible.builtin.dnf:
      name: "{{ item }}"
      state: absent
      update_cache: no
    loop: "{{ remove }}"
    ignore_errors: true
    tags:
      - apps

  - name: Install our packages
    ansible.builtin.dnf:
      name: "{{ item }}"
      state: present
      update_cache: yes
    loop: "{{ rpms }}"
    ignore_errors: true
    tags:
      - apps```

On mobile. Apologies if formatting is off.
[deleted] on 25 Sep 2024 04:00 next collapse

.

makingStuffForFun@lemmy.ml on 25 Sep 2024 04:24 next collapse

I do use docker, and compose a lot. But can it be used for desktop apps? Telegram, gimp, Thunderbird, etc?

LeLachs@lemmy.ml on 25 Sep 2024 05:54 collapse

It should be possible. Although probably very complicated. Have a look at https://distrobox.it/. It allows you to tightly integrate containers into your desktop, including accelerated graphics, some devices, your homedir, etc. It can even automatically install desktop shortcuts. (You can disable the integrations of course) Even tho it uses Podman instead of docker, AFAIK it should be 1:1 compatible with docker for your usecase.

eraclito@feddit.it on 25 Sep 2024 19:25 collapse

Have a look at https://distrobox.it/. It allows you to tightly integrate containers into your desktop, including accelerated graphics, some devices, your homedir, etc. It can even automatically install desktop shortcuts. (You can disable the integrations of course)

Furthermore, distrobox allows you to define the list of packages to be installed, see:

github.com/89luca89/…/distrobox-assemble.md

LeLachs@lemmy.ml on 26 Sep 2024 06:27 collapse

That is very cool. Thanks for sharing. If you need some additional repos (like OP), you can probably add them through some commands in the “pre_init_hooks” option.

utopiah@lemmy.ml on 25 Sep 2024 05:41 next collapse

I did more than 5 installs this weekend (for … reasons) and the “trick” IMHO is …

Do NOT install things ahead of actually needing them. (of course this assume things take minutes to install and thus you will have connectivity)

For me it meant Firefox was top of the list, VLC or Steam (thus NVIDIA driver) second, vim as I had to edit crontab, etc.

Quite a few are important to me but NOT urgent, e.g Cura (for 3D printer) and OpenSCAD (for parametric design) or Blender. So I didn’t event install them yet.

So IMHO as other suggested docker/docker-compose but only for backend.

Now… if you really want a reproducible desktop install : NixOS. You declare your setup rather than apt install -y and “hope” it will work out. Honestly I was tempted but as install a fresh Debian takes me 1h and I do it maybe once a year, at most, no need for me (yet).

utopiah@lemmy.ml on 25 Sep 2024 05:43 collapse

Another “trick” I use is having an ~/Apps directory in which I have AppImage, binaries, etc that I can bring from an old /home to a new one. It’s not ideal, bypassing the package manager, and makes quite a few assumption, first architecture, but in practice, it works.

Samueru@lemmy.ml on 25 Sep 2024 22:39 collapse

Check this out: github.com/ivan-hc/AM

Use appman and set the install directory to ~/Apps and now you will be able to install appimages/binaries in the ~/Apps dir using a package manager that keeps them up to date and that you can move to any other distro, I have all of this:

<img alt="" src="https://lemmy.ml/pictrs/image/6faced1a-b7a8-4ec9-899f-011d36adf771.png">

Although more recently for binaries I’ve been using this instead, which pulls from a massive repo of static binaries, though note that dbin needs its own separate directory in HOME to install binaries (you can’t use ~/Apps that is).

<img alt="" src="https://lemmy.ml/pictrs/image/ca2f44a1-69fa-4bbe-a1d6-75e1c0f22da0.png">

utopiah@lemmy.ml on 27 Sep 2024 06:46 collapse

Hmmm very interesting thanks for the links and explanation!

I’m not “ready” for it yet so I’ve bookmarked all that (by adding a file in ~/Apps ;) but that’s definitely and interesting, and arguably neater solution.

Honestly I try to stick to the distribution package manager as much as I can (apt on Debian stable) but sometimes it’s impossible. Getting binaries myself feels a bit “wrong” but usually works. Some, like yt-dlp as I see in your list, do have their own update mechanisms. Interesting to consider stepping back and consider the trade off. Anyway now thanks to you I know there are solutions for a middle ground!

utopiah@lemmy.ml on 27 Sep 2024 06:47 collapse

Also this is a good way to re-consider integration back, e.g. generating .desktop files for /.local/share/applications/ when using KDE rather than having to manually do it each time.

Samueru@lemmy.ml on 27 Sep 2024 07:42 collapse

This is already done automatically with appman.

AM puts the .desktop files in /usr/local/share/applications

AppMan puts them in ${XDG_DATA_HOME:-~/.local/share}applications

They also get symlinked in PATH, that is you can launch yt-dlp by typing yt-dlp on the terminal as if you had installed it with your distro package manager.

utopiah@lemmy.ml on 27 Sep 2024 09:51 collapse

Ah! Wonderful. I’m always a bit reluctant with system-wide install so I’ll put AM on hold for now but probably tinker with AppMan/dbin soon.

Out of curiosity, one of the app I’d usually get outside my package manager is Chromium. I’d usually download the latest build from download-chromium.appspot.com so in this situation, how would you do it using any of those solutions? Would it support adding extensions e.g …google.com/…/cgffilbpcibhmcfbgggfhfolhkfbhmik that I need for development?

PS: note to self, go through bash history to see which failed apt install attempts could be replaced with such tools.

Samueru@lemmy.ml on 27 Sep 2024 10:54 collapse

<img alt="" src="https://lemmy.ml/pictrs/image/86944712-b169-4eb5-9cd9-9f9af7c80fac.png">

It pulls the latest chromium from googleapis.com so it can do everything.

utopiah@lemmy.ml on 27 Sep 2024 13:09 collapse

Very cool, sincere thank you for the clarification and even on-boarding process. Installed this way, feels quite efficient. Will dig a big deeper while using them more.

merthyr1831@lemmy.ml on 25 Sep 2024 09:55 next collapse

Some distros allow this. Nix for example allows you to save config files that describe your entire system (apps, settings, etc) and then load them in one go. Other distros are following suit with their own tailored solutions too (I think Ubuntu might have something? Manjaro?).

LeLachs@lemmy.ml on 26 Sep 2024 06:31 collapse

You can even have all nixpkgs on a different distro through the nix package manager

possiblylinux127@lemmy.zip on 25 Sep 2024 13:35 next collapse

Could you just build a base image and then deploy it?

Also Ansible is pretty solid

Samueru@lemmy.ml on 25 Sep 2024 22:42 next collapse

I wonder, is there a tool that lets me script installs?

I’ll want to check if application exists, and if so, update, otherwise, install. That kind of thing.

github.com/ivan-hc/AM

Use AppMan to install them in HOME.

Nibodhika@lemmy.world on 26 Sep 2024 06:51 next collapse

That’s one of the things I miss the most in Gentoo, having the packages of your system defined in text files so a fresh install was just copying those files and running an update.

I’ve tried similar things with other distros, but it’s never the same, the list of packages ends up getting out of date or ends up with too much garbage.

Currently I have a home server so I took the time to get an Ansible playbook setup for running, maintaining, and maybe migrating the server if needed. Since some stuff is also run on other machines that I have (update system, update some docker images I run in multiple systems, etc) I did setup some minimal packages that I need on my main system, it’s easy enough but I wouldn’t recommend using Ansible just for this (but if you also have dotfiles it’s a great tool for automating lots of the initial setup).

All of that being said, the reason I never bothered with this until I had a home server is that usually there are years between system installs, so even if what you had was exactly what you wanted the last time you installed your system, it’s unlikely to be exactly what you want next time you do. Since the last time I installed my main system I switched from X to Wayland, from i3 to Hyprland and then Sway, etc, etc…

danhab99@programming.dev on 28 Sep 2024 14:48 collapse

Nix and home-manager, those are the only 2 I have off the top of my head.