I frequently reinstall Linux. Is there a tool to say what to install and configure that I can just run once after OS install? Things like
- Install neovim, signal, steam
- Configure firefox, desktop environment
I’m using this for just me, on my personal machine.
I don’t anticipate it’s possible between different distros, so assume I’m reinstalling the same distro.
There is a lot but I think you will find a lot of them more enterprise focused rather than consumer. For apps installed to home, why aren’t you preserving your
/homepartition? For system apps, could you create an image? (Although it should be basically a one liner?) There is a lot of missing detail, why are you reinstalling, what distribution(s)?It’s probably better to write a script in a repo that downloads and installs everything…
Then for configuration files create a dotfiles repo. I use chezmoi but there are a bunch of solutions for this.
You should have a look at NixOS. It’s a Linux distro where you declare the whole system in configuration like files, in a language called Nix (hence NixOS), then you run a command and that gets resolved into your system.
It takes a long time to setup the first time, but it’s a breeze when you need to reinstall, and you will never need to reinstall as every boot is a fresh copy of the system you declared.
There’s also a thing called home-manager which uses the Nix language to declare your home configuration. That part can be used in any other Linux by installing the home-manager package.
You can declare your OS in a way that the home part is portable for machines running other systems. I do that, then my machines are very easy to declare, and with some groups for things like Base (Terminal, prompt, some things I expect to have on every system like Python, nvim fully configured, etc), Gaming (Steam mostly), UI (Sway, many GUI things I use like browser with extensions, etc) I can add configs for a new machine in instants depending on what I expected for it, and if I ever want to convert my “Steam machine” into a desktop it’s just a couple line changes, regenerate the config and it’s exactly the same as my laptop.
Honestly I don’t think Nix is for everyone, but it’s a very niche thing that works extremely well for what it sets up to do, and if you’re in the target audience it’s a game changer.
I use two tools for this:
- https://www.chezmoi.io/ for all my various dotfiles
- A bash script I’ve put together over the years that has a list of all the basics that I want and calls whatever the right installer is for them: apt, cargo, brew, or whatever. It has targets for a local workstation, a remote headless server, and MacOS. Then at then the end it runs chezmoi.
Now, my use case is less “constant fresh install” and more “keep my environment the same across various devices”, as I mostly run Debian Stable and don’t feel the need to constantly tweak things.
The best would be NixOS, but if you just want to automate your install which you have then Ansible.
If a debian based distro there’s several ways to copy your package choices from one machine to another, the likes of using dpkg --get-selections and using that output on the new machine with --set-selections, but probably the easiest way is to use apt-clone, which streamlines that process to install the same packages on the new machine.
As for your firefox and desktop packages, they’ll be saved in /home/username (usually in .hidden dirs) - so just copy all of that over.
Alternatively, use an image cloner like clonezilla to make an exact disk copy and install that.
Or run your machine as a vm inside Proxmox or another hypervisor. That way you can have instant snapshots before you do risky things, as well as multiple scheduled entire-machine backups.
Or ansible (which I do a lot of), which can set whatever packages and copy your golden-image files over as you want. (But keeping those up to date requires a little thought)
The canonical method was with a kickstart, and if it looks like too complex, remember you should have one stashed in /root already that you just need to mod.
Normally a kickstart is a bit much, otherwise, though. I use a suite of tools but the best one I used was a simple virtual package to bring in the ot8her, drop configs in and start daemons. We did this in like 2001 to great effect.
Ansible, Salt, Puppet, Chef, Terraform, …
Fedora offers
kickstart.Others have
cloudinitorignition.Those are the ones if used personally.
I frequently reinstall Linux.
Like, how many times in a year? And secondly, for what reason?
deleted by creator
Aight. Understood. Thank you!
In your case, I’d propose something like NixOS then. As your full system configuration can be contained within a (set of) config file(s), the very same ones you use to install/config stuff, a reinstall just becomes very easy. Heck, if you’re willing to embrace the “Erase your darlings”-lifestyle, then I don’t even think you’d ever feel the need for a reinstall. Because, frankly, the clean slate is just a reboot away.
EDIT: Perhaps Guix System is also worth considering as an alternative to NixOS*.
EDIT2: If you still want to explore other distros, then it’s worth noting that nix, i.e. NixOS’ package manager, is available on most distros and offers a lot of the benefits already. Like, you could configure your system using it, and then use that config on another distro to get your config back. Good stuff.
Why don’t you try distros in a virtual machine first?
Not a full reinstall solution, but aptik is one of the only utilities I’ve found useful enough to pay for. Last time I reinstalled it saved me many hours of configuring.


