Automate post-installation setup
I would like to automate everything I generally do post-installation of a Linux OS. For instance:
- Installing certain packages (e.g.
nvim
,zsh
,ohmyzsh
,tmux
) - Installing my dotfiles through
dotbot
(I can do that with a single command already) - Creating certain folders
- Creating a public ssh key
- ...
What tools do you generally use to do that?
In my case, I have two laptops and a server. I would like to simply run a command post-installation to set up the OS. All three machines are running Ubuntu (although at times different versions) and are configured in the same way. Hence why I would like to automate the process.
One solution could be to use a shell executables file. I'm wondering if there is a better way.
Solution 1:
Shell script is good solution, just be careful with exit codes of command executions (for example package not found, need to run as root and so on)
Other option is to create meta package and install it with dpkg
. You can check this Q/A in Ask Ubuntu site about how to do it.