I have been changing my computer setup for many years now. I invested quite a lot of time into it, so I thought others should benefit from it as well. My main operating system is Linux Mint (a distribution of GNU/Linux). Since few manufacturers ship computers without operating systems and since I am already paying for a Windows license, I always keep Windows on the side, just in case. I am a big fan of FOSS (Free/libre open source software) and admire the people, who do everything to promote it, but at the same time, I am not sufficiently dedicated, so often I opt for convenience over philosophy.

1 Dual boot

1.1 Create Windows bootable USB

  1. Download iso file from the Microsoft website

  2. Create bootable USB drive using Microsoft’s Media creation tool or Rufus if it does not work or you already downloaded the iso. (Rufus worked for me flawlessly)

1.2 Reformat drives and install clean Windows

With modern Windows, you can log in with your Microsoft account and link the Windows license to it. That allows you to easily reinstall Windows on the same machine. Since you probably want to partition your hard drive differently and because most Windows computers come with loads of bloatware, it makes sense to do a clean installation.

  1. Boot from the USB.

  2. Delete all partitions. Make one partition of a desired size for Windows, but fill all other space with other empty partitions. Windows will create some smaller partitions within the space of the main Windows partition, but should not touch the other “space occupying” partitions. (If you left just empty space outside of the Windows partition, it could do something with it.)

  3. Install Windows.

1.3 Change boot settings

  1. Disable Fast startup:
    Control Panel >Hardware and Sound >Power Options >System Settings >Choose what the power buttons do and uncheck the Turn on fast startup box)

  2. Disable UEFI secure boot: See here how

1.4 Create bootable Linux USB

  1. Download iso, e.g. from linuxmint.com

  2. Checksum the iso

  3. Create bootable USB drive

1.5 Make partitions and install the OS

  1. Boot from Linux USB Drive

  2. Use the “Something different" option

  3. Make partitions:

    • EFI (cca 1 GB for bootloader)

    • root (system and programs)

    • home (user files, this is not necessary, but helps prevent data loss if you have OS problems)

    • swap (for "extending" RAM. If you want to use hibernation, you must have at least the same amount as your RAM)

  4. Install (allow for codecs and other proprietary software, unless your philosophy is opposed to it)

    (It should automatically make Grub the default bootloader and Ubuntu the default system. If it does not, running this command in Windows may help.

            bcdedit /set "{bootmgr}" path \EFI\ubuntu\grubx64.efi
    

2 Linux configuration

2.1 Update software and repositories

  1. Update software using Update manager

  2. Use recommanded drivers using Driver manager ( proprietary graphics driver may be offered, which are likely ot work better)

2.1.1 Switching graphic cards if you have two

Linux Mint has a nice applet called nvidia-prime-applet that makes switching very easy and which should appear automatically after switching to the proprietary drivers. Otherwise, the main GUI is ‘Nvidia X Server Settings’. Can also use commands:\

sudo prime-select intel
sudo prime-select nvidia
prime-select query

2.2 Decrease swap use

Swap is a part fo the hard drive used when the system runs out of RAM. However, by default on Ubuntu/Mint the settings makes the system use swap more than usually necessary.

  1. Check your current swappiness setting using:
    cat /proc/sys/vm/swappiness

    The result will probably be 60. That means that when 60% of RAM is free, it will start using swap. For any system with a reasonable RAM size (>2 GB), we want this to be more like 10.

  2. Edit or create the file /etc/sysctl.conf, e.g. using vim sudo vim /etc/sysctl.conf, and add the following line to the bottom:
    vm.swappiness=10

  3. Close the text file, reboot your computer and check the swappiness again. Now it should be 10. Which means that when 10% of RAM is free, it will start using the swap area.

2.3 Turn on firewall

Either:
sudo ufw enable
or install gufw (Firewall Configuration, preinstalled on Mint under the name Firewall Configuration). Can check the current status using:
sudo ufw status verbose.

2.4 Have bluetooth turned off by default

On Mint, the first time you open the Bluetooth Manager app (blueman-manager), it asks you whether you want Bluetooth on by default. Apart from that, you can also do it using the method below.

Edit /etc/rc.local by adding rfkill block bluetooth before exit 0 or create such file. This script is executed at the end of each multiuser runlevel. Make sure that the script will "exit 0" on success or any other value on error. Resulting code may look like:

    #!/bin/sh -e
    rfkill block bluetooth
    exit 0

If the file does not exist, create it and make it executable:
sudo chmod +x /etc/rc.local

2.5 Install useful proprietary software and fonts

(If you’re into convenience over freedom)

2.5.1 For Mint:

No need to install full ubuntu-restricted-extras, since most codecs are already included (mint-meta-codecs). If needed, can install Microsoft Core fonts manually:
sudo apt-get install ttf-mscorefonts-installer (Use Tab, Enter to accept the EULA)

2.5.2 For Ubuntu:

sudo apt-get install ubuntu-restricted-extras
(Use Tab, Enter to accept the EULA)

2.6 Install battery optimisation tools

For TLP:
sudo apt install tlp tlp-rdw
sudo tlp start
Everything else is automatic. It should automatically whitelist input devices from sleep (turning off when not in use)

Install package powertop for monitoring usage of power. To see usage do:
sudo powertop

2.7 Qt interface

2.7.1 Dark theme

I like dark themes and some of my favourite programs, like Okular and TeXstudio use Qt for its GUI. If they do not listen to your overall system preference or have the wrong colours of icons, you can use the method below. Also the cursor may not be your default one for qt5 apps.

To set dark theme globally, open Qt5 Settings (qt5ct), set e.g. Style: Fusion, Colour scheme: Darker, Icons: Mint-Y-Dark

2.7.2 Mouse cursor

If it does not change automatically to the system one, use: sudo update-alternatives –config x-cursor-theme

2.8 Redshift

This automatically makes the screen yellow in the evenings. Add it to the Startup Applications and configure it by creating ~/.config/redshift.conf with e.g. the following contents:

[redshift]
; Semicolon denotes comments
; Set the day and night screen temperatures
temp-day=5800
temp-night=1500
dawn-time=05:30
dusk-time=19:00-19:30

; Enable/Disable a smooth transition between day and night
; 0 will cause a direct change from day to night screen temperature.
; 1 will gradually increase or decrease the screen temperature
;transition=0

; Set the screen brightness. Default is 1.0
;brightness=0.9
; It is also possible to use different settings for day and night since version 1.8.
;brightness-day=0.7
;brightness-night=0.4
; Set the screen gamma (for all colors, or each color channel individually)
;gamma=0.9

;gamma=0.8:0.7:0.8
; Set the location-provider: 'geoclue', 'gnome-clock', 'manual'
; type 'redshift -l list' to see possible values
; The location provider settings are in a different section.
;location-provider=manual

; Set the adjustment-method: 'randr', 'vidmode'
; type 'redshift -m list' to see all possible values
; 'randr' is the preferred method, 'vidmode' is an older API
; but works in some cases when 'randr' does not.
; The adjustment method settings are in a different section.
adjustment-method=randr

; Configuration of the location-provider:
; type 'redshift -l PROVIDER:help' to see the settings
; e.g. 'redshift -l manual:help'
;[manual]
;lat=43
;lon=1

; Configuration of the adjustment-method
; type 'redshift -m METHOD:help' to see the settings
; ex: 'redshift -m randr:help'
; In this example, randr is configured to adjust screen 1.
; Note that the numbering starts from 0, so this is actually the second screen.
[randr]
;screen=0

2.9 Set up a backup

Use cron (For continuously running computers) or anacron (for computers that can be off or sleep and you want them to run the script next time they wake up), to set up a backup script. In case of anacron, keep in mind that the script will be run as the root user, so any ssh keys must be installed also for the root user. Alternatively, you can make the command itself run it as the specified user, e.g.

    sudo -u my_user ...

An example for anacrontab is

    # /etc/anacrontab: configuration file for anacron
    
    # See anacron(8) and anacrontab(5) for details.
    
    SHELL=/bin/sh
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    HOME=/root
    LOGNAME=root
    
    # These replace cron's entries
    1       5       cron.daily      run-parts --report /etc/cron.daily
    7       10      cron.weekly     run-parts --report /etc/cron.weekly
    @monthly        15      cron.monthly    run-parts --report /etc/cron.monthly
    1       5       backup  sudo -u ada bash -l -c "desktop_backup.sh"

2.10 Configuring Cinnamon (Mint only)

Hot corners

Application “Hot Corners”. I use both top corners to “Show all workspaces” and both bottom corners for “Show all windows”

Keyboard layout switching shortcut

Open app Keyboard, Layouts, Options, Switching to another layout.

2.11 Configuring GNOME (Ubuntu only)

Setting solid colour background

All of these settings can also be accessed using dconf-editor

    # Getting the values of variables
    gsettings get org.gnome.desktop.background primary-color
    gsettings get org.gnome.desktop.background picture-uri
    # Setting the values of variables
    # Remove background picture
    gsettings set org.gnome.desktop.background picture-uri ''
    # Set background colour
    gsettings set org.gnome.desktop.background primary-color '#111111'
    # Set secondary colour used for drawing gradients
    gsettings set org.gnome.desktop.background secondary-color '#111111'
    # Set shading type (solid is default)
    gsettings set org.gnome.desktop.background color-shading-type 'solid'

Gnome Multi Monitors Add-On

For reasonable workspaces with multiple screens.

Enable hot corner

Gnome tweak tools Top Bar - Activities Overview Hot Corner alternatively use dconf-editor or command line to change
gsettings set org.gnome.desktop.interface enable-hot-corners true

2.12 SSH keys

Keys would be usually stored in ~/.ssh. Create this folder if it does not exist. Then generate the keys using the command

    ssh-keygen -t rsa

This creates a pair of files, one of them being the private and the other one the public key (.pub). The public key has to be appended to the file ~/.ssh/authorized_keys on the server. To do this manually, you can copy the the public key over using scp and then

    cat ~/id_rsa.pub >> ~/.ssh/authorized_keys

Alternatively, you can do this automatically using the command

    ssh-copy-id -i ~/.ssh/mykey user@host

When you reinstall the system, and preserve or copy the .ssh folder, you still have the correct private keys. However, you need to change the permissions for it to work properly.

    chmod 400 ~/.ssh/id_rsa

3 How to install programs on Linux?

3.1 Using GUI Software manager

Linux Mint has Software Manager and Ubuntu has something similar. On Mint, the manager seems to see all the packages in APT and Flatpak repositories. Theoretically Flatpak has advantages over ATP (one package for all versions of all distributions), but currently the support of the developers is not great, and the Flatpak distributions sometimes do not work as good as ATP.

3.2 Using APT

This is the the native package manager for Debian-based distributions (Debian, Mint, Ubuntu). It has a command line interface apt or apt-get and GUI provided by package synaptic.

sudo apt-get install program1 program2
# installs programs program1 and program2

apt-cache search keyword
# searches for a package 'keyword' in repositories

update-alternatives --display program
# searches for alternatives of `program`

update-alternatives --config program
# to set a link to `program` (if more than one version installed)

3.3 Adding repositories

If your program is not in one of the official repositories and the developer provides a PPA repository, it can be added to APT. This is dangerous, since whatever the developer puts in his repository will be downloaded as an update, even if it is malicious. Therefore, add repositories only from parties that you trust. You do it by: (Do not forget to update the repositories afterwards.)

sudo apt-add-repository ppa:newrepo # Adds a repository newreop
sudo apt-get update # Download info from repositories

3.4 Downloading manually

From the website you can download:

  • .deb - Use gdebi to install.

  • .AppImage - Just make executable and run.

  • .sh - Installation bash script. Run bash file.sh

4 Linux programs from standard repos

My recommendations for useful programs

4.1 Preinstalled on Linux Mint:

  • exfat-fuse - Allows reading and writing ExFAT file systems

  • gdebi - For installation of local deb files

  • synaptic - GUI for apt

  • inxi - Generates hardware list using infi -Fx

  • gufw - GUI for the firewall

  • firefox - Web browser To disable sideways scrolling of tabs, go to page about:config and set browser.tabs.tabMinWidth to a small value.

  • thunderbird - E-mail client

  • libreoffice - Office package

  • grub-customizer - GUI for customizing GRUB (e.g. the boot menu)

4.2 Not preinstalled

  • vim - ViM text editor (should also install vim-runtime)

  • git - Git version control

  • htop - A more ‘graphical’ resource manager than top

  • meld - Graphical diff tool

  • gparted - Graphical partition manager

  • catfish - GUI file finder

  • qlipper - clipboard manager

  • pavucontrol - Audio control GUI tool

  • dconf-editor - More detailed desktop environment adjustments

  • pdfarranger - Rearrange PDF pages (a.k.a. pdfshuffler).

  • okular and okular-extra-backends (for more file formats like djvu) If you have broken icons, try this 1

  • xournal - PDF editing and annotation

  • texlive-full - The LaTeX distribution to have, including all standard packages.

  • vlc - Video and audio player. (Can play almost anything.)

  • audacity - Sound editor.

  • gimp - Raster graphics editor.

  • inkscape - Vector graphics editor.

  • calibre - Ebook organiser and convertor.

  • digikam - Photo manager.

  • filezilla - GUI for ssh, ftp, etc.

  • handbrake - Video convertor

  • kdenlive - Video editor

  • transmission - Torrent client

  • ffmpeg - Prerequisite of obs-studio

  • gramps - Genealogy software

  • font-manager - Simple font manager.

5 Linux FOSS not in standard repos

FOSS = Free and Open-Source Software (Free as in freedom)

  • texstudio - My favourite LaTeX editor. My configuration.2
    Repo: ppa:sunderme/texstudio.
  • fontforge - Font editor. Repo versions are outdated.
    Download AppImage from https://fontforge.org/

  • obs-studio - Screen recording and streaming. ffmpeg is prerequisite
    Repo: ppa:obsproject/obs-studio

  • audio-recorder - Simple audio recorder that can merge multiple sources.
    Repo: ppa:audio-recorder/ppa.

  • FoxitReader - PDF reader that allows easy signing of documents.
    Download installer from: https://www.foxitsoftware.com/pdf-reader/

  • signal - Signal messenger, for tray icon do3
    Download from: https://signal.org

  • zettlr - a Markdown editor aimed at academic use

  • zotero - a citation manager

  • font-manager - Simple font manager.
    Repo: ppa:font-manager/staging

6 Linux proprietary software

  • obsidian - a Markdown editor aimed at personal knowledge base creation
  • chrome - Google Chrome web browser
  • enpass - Enpass password manager. Most common free alternative is Bitwarden
  • dropbox - Dropbox cloud storage service.
    Download from https://www.dropbox.com/
  • skype - Skype online videocall service.
    Download from https://www.skype.com/
  • zoom - Online conferencing.
    Download from: https://zoom.us/

  • spotify - music streaming service. Install ideally via a Debian package.
    Installation instructions on https://www.spotify.com/

  • mathematica - Wolfram Mathematica

  • MATLAB - MATLAB computational software.

7 Coding etc.

7.1 Anaconda

anaconda - Python (and other) package and environment manager.
Download installer from https://www.anaconda.com/\

  • Do not use sudo to run the installer. It only messes things up.

  • At the end of installation do init, to have things added to .bashrc

  • Prevent (base) prompt like this:

    Use the base env’s activation hook

    For each env, any scripts in the etc/conda/activate.d directory will be executed post-activation (likewise etc/conda/deactivate.d scripts for deactivation). You need to add a script to remove the (base).

    Create this directory:

    mkdir -p anaconda3/etc/conda/activate.d

    Create a text file (e.g. remove_base_ps1.sh) with one line:

    PS1="$(echo "$PS1" | sed s/(base) //)"

    NB: These need to be typewriter quotes, not the smart quotes.

7.2 Compilers

First install gcc, g++ and gfortran. If you get broken packages etc. use the smart package installer aptitude

sudo aptitude install packagename

Note that the first thing that it may offer you is to do nothing. If you say no, then it will offer you to downgrade some packages, which is what you want.

Then, you want to install the Intel stuff. This is now install vie the oneAPI toolkits. You want Intel oneAPI Base Toolkit (C++ compilers and MKL) and Intel oneAPI HPC toolkit (old C++ compilers, MPI and the Fortran compiler). Install first base and then HPC.

Download the offline installers. Then do

bash filename -x

which will extract the installer

then go to the extracted folder and execute the installer with sudo:

sudo ./install.sh

It will open a GUI which will guide you through the installation. Then put this in your .bashrc

source /opt/intel/oneapi/setvars.sh >> /dev/null

and

export I_MPI_CXX=icpc
export OMPI_CXX=icpc
export I_MPI_CC=icc
export OMPI_CC=icc

If anything goes wrong, then you can uninstall things by going to

/opt/intel/oneapi/installer

and do

sudo ./installer

This will open GUI that will allow you to modify or remove things.

7.3 Neovim

I really like the ViM editor, but if you want to go a little more fancy, you can try neovim. Since neovim can read your vimrc, you can easily use both side by side.

1) Set up vim with .vim folder (i.e. instead of having ~/.vimrc have in ~/.vim/vimrc) 2) Install neovim 3) Copy over .config/nvim/init.vim For lualine: 4) install vim-plug as described here https://github.com/junegunn/vim-plug#neovim 5) Run :PlugInstall 6) Download and install nerdfonts https://www.nerdfonts.com/ 7) Change your terminal to one of the nerdfonts to get correct icons.

My vimrc

" Don't try to be vi compatible
set nocompatible

filetype off
" Attempt to determine the type of a file based on its name and possibly its
" contents. Use this to allow intelligent auto-indenting for each filetype,
" and for plugins that are filetype specific.
filetype indent plugin on

" Choose colorscheme
colorscheme myscheme
"colorscheme default-light
" Turn on syntax highlighting
syntax on

" Show line numbers
set number

" Show file stats
set ruler

" Instead of failing a command because of unsaved changes, instead raise a
" dialogue asking if you wish to save changed files.
set confirm

" Allow backspacing over autoindent, line breaks and start of insert action
set backspace=indent,eol,start

" Indentation settings for using 4 spaces instead of tabs.
" Do not change 'tabstop' from its default value of 8 with this setup.
set shiftwidth=4
set softtabstop=4
set expandtab

" Enable use of the mouse for all modes
"set mouse=a

" Restricting Vim to the 16 colours of the terminal scheme to allow easier
" control over colours via a terminal colour scheme
set t_Co=16

"Have 81st column coloured
set colorcolumn=82
highlight ColorColumn ctermbg=8

" Makes broken lines appear at the indentation level
set breakindent

"maps F3 inside Vim to a time stamp
nmap <F3> i<C-R>=strftime("%Y-%m-%d \%H:\%M:\%S")<CR><Esc>
imap <F3> <C-R>=strftime("%Y-%m-%d \%H:\%M:\%S")<CR>
"maps F4 inside Vim to a C++ dividing line
nmap <F4> o//******************************************************************************<Esc>
imap <F4> //******************************************************************************
"maps F5 inside Vim to a Python dividing line
nmap <F5> o#*******************************************************************************<Esc>
imap <F5> #*******************************************************************************
"Set text width for hard wrapping
"set textwidth=80

My init.vim

" Plugins will be downloaded under the specified directory.
call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')

" Declare the list of plugins.
Plug 'nvim-lualine/lualine.nvim'
" If you want to have icons in your statusline choose one of these
Plug 'kyazdani42/nvim-web-devicons'
" List ends here. Plugins become visible to Vim after this call.
call plug#end()

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath=&runtimepath
source ~/.vim/vimrc
set guicursor=

lua << END

local colors = {
  black   = '#000000',
  maroon  = '#800000',
  green   = '#008000',
  olive   = '#808000',
  navy    = '#000080',
  purple  = '#800080',
  teal    = '#008080',
  silver  = '#c0c0c0',
  gray    = '#808080',
  red     = '#ff0000',
  lime    = '#00ff00',
  yellow  = '#ffff00',
  blue    = '#0000ff',
  fuchsia = '#ff00ff',
  aqua    = '#00ffff',
  white   = '#ffffff',
}

local custom_16color = require'lualine.themes.16color'
custom_16color.normal = {
    a = { fg = colors.white, bg = colors.navy, gui = 'bold' },
    b = { fg = colors.white, bg = colors.gray },
    c = { fg = colors.silver, bg = colors.black },
    }
custom_16color.insert = {
    a = { fg = colors.white, bg = colors.green, gui = 'bold' }
    }
custom_16color.visual = {
    a = { fg = colors.white, bg = colors.purple, gui = 'bold' }
    }
custom_16color.replace = {
    a = { fg = colors.white, bg = colors.red, gui = 'bold' }
    }
custom_16color.inactive = {
    a = { fg = colors.silver, bg = colors.gray, gui = 'bold' },
    b = { fg = colors.gray, bg = colors.black },
    c = { fg = colors.silver, bg = colors.black },
    }
require'lualine'.setup{
    options = {theme = custom_16color}
}


END

7.4 Jekyll

I use Jekyll to compile tis website. this is how I set it up 1) Install ruby using apt (probably already there) 2) Install ruby-dev using apt 3) Install RubyGems (probably already there) 4) Install newest Bundler gem install --user-install bundler 5) If you get a warning that the place where it is installed is not in your path, add it to your path 6) Set bundler to do things in user directory as bundle config set --local path '/home/username/.local/share/gem' 7) Do bundle install in a place with your Gemfile

  1. sudo apt install breeze-icon-theme qt5ct and then qt5ct –platformtheme qt5ct and set the icon-theme to breeze. (You may do other modifications as you wish). Then set the environment variables by editing the text file sudo vim /etc/environment and adding this line: QT_QPA_PLATFORMTHEME="qt5ct" Reboot. 

  2. Go to TeXstudio Options > Configure > Editor and toggle options for replacing tabs with spaces and turn on the line numbers. Tick ‘Show advanced options’ at the bottom and in ‘Advanced editor’ make whitespace visible. 

  3. Add --use-tray-icon to the relevant line of signal-desktop.desktop. The results should look like e.g. Exec=/opt/Signal/signal-desktop --use-tray-icon –no-sandbox %U or whatever was the line originally. These .desktop files can be usually found in: /usr/share/applications/ or ~/.local/share/applications/ For Windows: Press the Windows key to open the start menu, and search for Signal. When you see the Signal menu entry appear, right click on it to open up the context menu, then click Open file location. In the Explorer window that opens, right click on the Signal shortcut to open the context menu, and click on Properties. In the Signal Properties window that opens, change the Target field to C:\Users\Admin\AppData\Local\Programs\signal-desktop\Signal.exe --use-tray-icon then click OK.