Ubuntu desktop for devs

Ruslan Gainutdinov
Sep 26 · 5 min read

Here is a short guide on setting up Ubuntu Linux 18.04 to be comfortable, high-performance development environment for everyday use.

This is kind of a summary of things I think important when you have Linux as a primary operating system.

About me — I am developer, architect and Tech Lead and I was using Linux for past 3 years as a primary desktop OS. Here is the latest notes on installing and running Linux Ubuntu.

Core stuff

Partition and installing

Use GPT partition layout. It is more flexible and have a benefit that partition number does not depend on on the order of partitions, i.e. if you delete partition in the middle, number for existing partions will not change.

For maximum compatibility, use ext4 filesystem (Dropbox does not support other filesystems).

Align partitions on 1Mb boundary for best SSD life. (Check afterwards using “sudo parted /dev/nvme0n1 align-check”)

Encryption

Please consider full-disk encryption when you install Linux. You can also enable it after install but it is much, much more difficult.

LVM

LVM does not sense on desktop/laptop machine. If you have a no spare disk compartments you better of replacing SSD entirely instead of resizing to the bigger disk.

Rescue partition

It is nice to have a way to boot into the temporary environment in case of you need to do some changes or temporarily check things. It is also great to have it without a need of separate USB flash disk.

Use gparted or during install, create 10GB rescue partition. Format it as ext4. Label and enter name rescue.

Add following file to /boot/grub as custom.cfg

/boot/grub/custom.cfg

Download xubuntu-18.04.3-desktop-amd64.iso and ubuntu-18.04.3-desktop-amd64.iso and put them in the root directory of rescue partition.

Run “update-grub” and it will add this menu entries to Grub boot menu.

System software

  • lm-sensors —Install to monitor temperatures, on modern hardware it will detect sensors automatically
  • etckeeper — Commits /etc to git. Execute (cd /etc && sudo git log) to see latest changes. Useful to keep track of things you and package control changes.

Kernel and system tweaks

  • Enable maximum file watches — needed for a lot of stuff, for example Dropbox, Docker.

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

  • Disable USB power control — sometimes can result in high CPU usage in kworker process.

Desktop tweaks

  • Remove snaps — Broken technology. See mount command output — it actually installs every package as a loopback device! What if you have 100 of them?!

sudo apt autoremove — purge snapd gnome-software-plugin-snap

  • Disable telemetry— Telemetry gathering for Ubuntu are implemented by using two packages. Remove them.

sudo apt remove ubuntu-report
sudo apt remove popularity-contest

  • Image Viewing — Remove shotwell image viewer and install nomacs — If you are a fan of IrfanView you will find that nomacs are actually quite decent image viewer. Set it as default image viewer in Settings. Nomacs 3.12 (not in repo) have a dark theme!

sudo apt remove shotwell
sudo apt install nomacs

sudo add-apt-repository ppa:linuxuprising/shutter
sudo apt install shutter

Gnome desktop

Use Communitheme.

  • This is modern, good looking theme. Install by running:

sudo add-apt-repository ppa:communitheme/ppa
sudo apt install ubuntu-communitheme-session

Install these important packages

  • gnome-tweak-tool Swiss army knife for Gnome. Install it to enable user themes and enable user extensions.
  • gnome-shell-extensions Enables shell extensions (see below)

Remove cruft

These, and some others are usually not used, but launched with desktop. You can remove them.

apt remove speech-dispatcher speech-dispatcher-audio-plugins
sudo apt remove gnome-todo gnome-todo-common

Keyboard shortcuts & mouse settings

  • Show all applications — Ctrl-Escape (like in Windows, does not interfere with terminal apps)
  • Show the run command prompt — Super+R (like in Windows, does not interfere with terminal apps)
  • Disable natural scrolling in Mouse & Touchpad

Important extensions

  • multi-monitor — displays task list and launcher menu on every monitor you connect, convenient if you work primarily on the external monitor after you connect it to the PC
  • USB eject menu — adds USB eject menu to the task list menu
  • Disable jack notification — Disables prompt when you connect headphones.

Gnome-terminal

Enable search on right click by building gnome-terminal from source using my patch.

Enable embedded dark mode.

Deja-dup

This is a default, integrated backup UI for duplicity. It is pretty basic but does its job.

Lower its priority level
You can run it with lower priority level so it will not interfere with interactive applications.

  • Copy /etc/xdg/autostart/org.gnome.DejaDup.Monitor.desktop to ~/.config/autostart folder
  • Open file by editor and prepend Exec=… with Exec=nice …

This way deja-dup will start with nice level 10 and all commands started by it (duplicity) will also be nice level 10.

Exclude more files (hidden)
Open dconf-editor at “org/gnome/deja-dup” and edit exclude-list to exclude .dot folders or files manually.

Slack

Lower its priority level
You can do the same trick as with Deja-dup and lower its priority by copying slack.desktop file and editing Exec= line.

Dropbox

Lower its priority level
The same trick will work for Dropbox! But rewrites its shortcut every time you launch it 😱. Make change and make “chmod a-w dropbox.desktop” so it will not be able to write shortcut file 😀

Midnight commander

Midnight Commander — sudoedit for root owned files.

Add to .bashrc following lines:

export EDITOR=mysudoedit
export SUDO_EDITOR=mcedit

Create file on $PATH mysudoedit:

mysudoedit

This way, if you try to edit file in Midnight Commander it will ask for password. This way you will not loose changes if you accidentially trying to edit file you can not write to.

Visual Studio Code — build from source

I really like vscodium project for giving me an option to build VSCode from source. It also removes all telemetry.

Use build instructions and it will create folder VSCode-linux-x64 with binaries. I don’t move it anywhere but just symlink it to my $HOME/bin folder.

VSCodium desktop entry
  1. Put desktop into ~/.local/share/applications.
  2. Put vscodium.png into ~/.local/share/icons.
  3. Make symbolic link “code” from $HOME/src/vscodium/VSCode-linux-x64 to $HOME/bin/code

Now you can start your code by typing “> code .” in any folder. Also you can start by desktop launcher.

Fonts

While Ubuntu by default have decent fonts installed, it is good to have other fonts to use in code editors or terminals. Here are some examples:

Conclusion

This way you get reliable, high performance development environment, which also looks nice 😎

Ruslan Gainutdinov

Written by

Tech Lead & Software engineer with a passion for #DevRel, Serverless, Java, and Javascript. https://ruslan.org

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade