DEV Community

Cover image for How to set up a fresh Ubuntu desktop using only dotfiles and bash scripts

How to set up a fresh Ubuntu desktop using only dotfiles and bash scripts

Victoria Drake on August 19, 2019

One of my most favourite things about open source files on GitHub is the ability to see how others do (what some people might call) mundane things,...
Collapse
 
solikeumyeah profile image
solikeumyeah • Edited

Next level would be porting it to an orchestration tool like Ansible, Puppet, Chef or Salt. They include modules to integrate with everything under the sun. It would be a good learning experience and the skills would be transferable to DevOps roles. With these tools, a well designed script could rebuild your system on any distro, regardless of whether it's using apt/dpkg, yum/rpm or something else.

Collapse
 
moopet profile image
Ben Sinclair

I recommend using stow for that kind of installation (symlinking to your dotfiles).

Collapse
 
victoria profile image
Victoria Drake

I’ve tried out stow before, and found even that to be more overhead than I needed to manage my (relatively small, I’ll concede) dotfiles collection. If I recall correctly, stow looks for the files in the same folder structure in the source that it then links to the destination. I found that just writing my own symlink and specifying the destination once was easier than remembering where the dotfile is in the file structure. I’m sure it makes sense for larger installations or ones with more programs than mine, though!

Collapse
 
shostarsson profile image
Rémi Lavedrine

That is a very interesting post. Thank you for writing it.
I have a note where I gather all the tools and installation when I am setting up a new Linux or Mac machine.
I planned to create some script to automate it but never started it.

I definitely must do it.

Collapse
 
victoria profile image
Victoria Drake

Some time ago I realized that I can write notes of this nature as scripts, or at least, close to. So now I try to start there whenever possible. Documentation is automation!

Collapse
 
shostarsson profile image
Rémi Lavedrine

Defintely. :-)

Collapse
 
drenze profile image
drenze

I had to laugh when this came across my feed this morning, as I just figured part of this out on my own and started doing it just last week (symlinking my dotfiles). I never thought about the rest though. Thanks for the tip!

Collapse
 
victoria profile image
Victoria Drake

Great timing! :D Try not to lose too many hours to it, like I did at first ^^;

Collapse
 
sebbestune profile image
Sebastian Lindgren

Very interesting! It reminds me a bit of a project of my own: github.com/Sebbestune/DebConf where I try to also have a way to automatically configure my Debian machines with just a script. If anyone wants to take inspiration from a vimrc here is mine too: gist.github.com/Sebbestune/40b7392... (I'm planning to put it in a dedicated git repo soon). :)

Collapse
 
ssimontis profile image
Scott Simontis

Very inspirational since I have three servers I need to get set up in the next few days! This is a great reminder to try automating things!

Also, to anyone who tries something like this, remember that your dotfiles can contain sensitive information! You may need to strip information out of your files and have a private script not hosted publicly that you can use for the sensitive information. If you're feeling bold, you could try to set up a build process that grabs the secrets from another file, environment variables, Hashicorp Vault, probably all sorts of solutions I can't think of and puts them back into the files while orchestrating your scripts!

Collapse
 
victoria profile image
Victoria Drake

Symlinks on symlinks 😂 Good luck with the server setups!

Collapse
 
bbborisk profile image
bbborisk

Brilliant post! Thanks a lot!

Collapse
 
victoria profile image
Victoria Drake

Oh no kidding. Although the encryption feature is neat.

Collapse
 
mrm8488 profile image
Manuel Romero

Links to your GitHub scripts throw 404 errors

Collapse
 
victoria profile image
Victoria Drake • Edited

I wonder if it would be because I forgot to make it public.

(Thanks! Glad someone’s paying attention.)

Collapse
 
adlacruzes profile image
Andrés De la Cruz

Nice post! I want to do something similar in Ansible, but I like the bash approach you did.