No matter what operating system I work on it is inevitable that it will become filled with cruft as I test new apps or code I have written. Some of it I keep, others I delete. In a short time I have no idea how to rebuild the system to where it is at or to make sure that I have cleaned up the cruft when I am done.
When I installed Ubuntu 20.10 on my trusty Lenovo X240 I decided that this time I wanted to both document everything so I can recreate the ideal install for me as well as ensure that the cruft gets cleaned out from time-to-time. I have modest needs on my system to begin with so keeping things documented seemed easy enough. In this post I will detail how my current system is setup so I have it to look back on and maybe you will find it helpful as well.
Start with the right OS
Obviously if you are looking for stability and support then the best place to start is with the LTS version of Ubuntu. Since I was documenting everything and I wanted to play with the most recent OS I installed Ubuntu 20.10. I only install a minimal OS, however, since, again, I have modest computing needs and the full OS installs a lot of applications I just don’t need.
Since I installed a minimal OS I will have to build up the applications that I need.
Applications
I wanted to be able to look and examine what apps I have installed as time goes on so that I can document what I want to keep and purge what I do not. This was a hard problem to solve since apt has no easy way to find this information out of the box. I did some digging (a lot of digging) and finally found a solution that has proven to be both solid and useful so far. I add this function to my .bashrc so I can list any apps that I have installed.
my-apt-installs () {
comm -23 <(apt-mark showmanual | sort -u) \
<(gzip -dc /var/log/installer/initial-status.gz |
sed -n 's/^Package: //p' | sort -u)
}
It lists anything that I have installed using apt and ignores anything that was installed by the system, such as dependencies.
Now with that set up I can begin installing apps. The first I install some necessary utilities: htop, curl, openssh-server, vim, tmux, and git. These are the bare minimum I need to get up and running. Technically I don’t absolutely need openssh-server on my laptop, but I like to be able to log into it using ssh from my desktop when I am at home.
sudo apt install curl
sudo apt install openssh-server
sudo apt install vim
sudo apt install tmux
sudo apt install git
sudo apt install htop
With the basics out of the way, I am going to install a few more utilities that are helpful but not necessary to begin work.
First is uptimed. Uptimed is a daemon that runs and keeps a history of uptimes. Not a big deal for a laptop, but I like having the history so I can evaluate stability and when I get changes that force a reboot.
sudo apt install uptimed
Since I do a lot of writing and I mostly do that in Markdown, it is nice to have a way to simply convert it to other formats such as html and pdf. For this I use pandoc.
sudo apt install pandoc
It is good to have some tools to manipulate images and videos so ffmpeg and imagemagick are installed next.
sudo apt install ffmpeg
sudo apt install imagemagick
I use LXD a great deal to build system containers, again to keep my main OS clean when testing software and services, and it is recommend to use ZFS to create storage pools for it. Ubuntu 20.10 minimal does not include the ZFS utilities to create ZFS pools so that gets added next.
sudo apt install zfsutils-linux
Finally, and this one is a recent addition, I no longer use Dropbox to syncronize files between machines. I could always use rsync, but I am lazy and using a simple GUI interface in this case to handle everything is just easier so I now use Syncthing. I hadn’t used it before because the documentation made it sound more time consuming to setup than it really is. I set up three machines running Syncthing in less than 15 minutes.
sudo apt install syncthing
Now that is all the software I isntall with apt. It is Ubuntu and Ubuntu relies heavily on snap packages for software installation. This is somehow controversial, but snaps don’t bother me a great deal. I have three applications I install as snaps.
Like I said earlier, I use LXD for building system containers so I install that next.
sudo snap install lxd
I have written a simple tutorial on initializing and using LXD a while ago if you are interested.
The next two apps are useful, but not necessary. First, switching audio input and output can be a pain. An application called Sound Switcher sits as an icon in the top bar in GNOME and makes it simple to switch these when necessary so it is added next.
sudo snap install indicator-sound-switcher
The last snap package I install serves a single purpose for me. I use vim normally when editing files. But I wanted a simple Markdown previewer. I turns out that Visual Studio Code includes a live Markdown previewer. I am warming to it. I always felt it was too heavy and cumbersome to write code in but for Markdown with live preview it works quite well.
sudo snap install code --classic
If you are running an LTS version of Ubuntu, I highly recommend installing and setting up Canonical Livepatch to automagically install security updates. This is a relatively simple install and setup but it is good practice. You will have to get a livepatch token but it is free for individual use. To get a livepatch token view the Canonical Livepatch Service.
sudo snap install canonical-livepatch
sudo canonical-livepatch enable <livepatch token>
Since this is a laptop and I occasionally must work offline, I install Youtube-dl to download videos. I install this directly instead of using apt because the apt version is quite old. I did run into a small problem with this in that it expects to run using python, but Ubuntu 20.10 does not have python linked to anything instead it ships with just a python3 executable. To fix it I just linked /usr/local/bin/python to /usr/bin/python3 and this solved the problem.
sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
sudo ln -s /usr/bin/python3 /usr/local/bin/python
As much as I might like to use a different browser, some things simply work better using Google Chrome. At some point it would be nice to only need one browser, like Firefox, but for now I install Chrome.
curl -L https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
Gnome setup
With all of this done, now it is time to tweak Gnome. I prefer things to be a stock as possible but, at least for now, I make four changes.
First, Ubuntu maps launching the terminal to ctrl+alt+t. That just seems awkward to me so I remap it to super+t.
gsettings set org.gnome.settings-daemon.plugins.media-keys terminal "['<Super>t']"
The last three changes are extensions. I haven’t looked into installing them from the command line so I use the browser. To do this a Firefox plugin must be installed to download and activate them. See the Gnome site to locate addons for other browsers or distros.
sudo apt install chrome-gnome-shell
Update 2021-11-27: Decided to remap caps lock key to esc key to save the reach.
dconf write "/org/gnome/desktop/input-sources/xkb-options" "['caps:swapescape']"
The three Gnome extensions I use are Emoji selector, Caffine, and Clock Override. The Gnome project has many more but these are the ones I find most useful.
Conclusion
That is my setup and modifications. I try and keep it clean and as close to the stock install as possible.