ubuntu_install.md (10530B)
1 Ubuntu install with UEFI boot 2 ============================= 3 4 This provides a basic rundown of process of a minimal Ubuntu Linux install with 5 the following setup: 6 7 * UEFI boot 8 * LVM filesystem 9 * Sway WM using Wayland 10 11 Rather than using the Ubuntu Desktop install media, we start with Ubuntu server 12 to generate a more minimal installation. By default, Ubuntu installs GDM and 13 the Gnome desktop, which makes using non X-based desktops more difficult. 14 15 This guide assumes a wired ethernet connection and a working DHCP server. 16 17 18 Create USB boot disk 19 -------------------- 20 21 Download an install image from https://ubuntu.com/download/server, then write 22 it to a disk using `dd`. Reboot the machine to be imaged and use the machin's 23 BIOS features to boot from the USB drive in UEFI mode. 24 25 26 Walk through the Ubuntu installer 27 --------------------------------- 28 29 Rough notes for installer (TODO: fill this out): 30 * When prompted for whether to download the updated installer, download it. 31 * When prompted to partition the disk, select to use the whole disk with LVM. 32 * When prompted to verify the LVM partitioning, adjust the space allocated to 33 each volume, partition, as necessary. 34 * When prompted for which service to install, select none. Install the OpenSSH 35 server if desired. 36 37 Reboot the machine. 38 39 Verify the machine booted into UEFI mode: 40 41 ls /sys/firmware/efi/efivars 42 43 If the directory does not exist, the system is likely booted in BIOS mode. You 44 will want to enter BIOS and enable UEFI boot, then reboot from the USB drive in 45 UEFI mode and restart installation. 46 47 Next, we'll apply any immediate updates and remove any leftover unnecessary 48 packages from the install process. 49 50 sudo apt upgrade 51 sudo apt autoremove 52 sudo apt clean 53 54 Next we'll purge any leftover config files from any removed packages: 55 56 dpkg -l | grep '^rc '| awk '{print $2}' | xargs sudo dpkg -P 57 58 59 Disable password/challenge-response ssh 60 --------------------------------------- 61 62 Edit `/etc/ssh/sshd_config` to set the following: 63 64 PasswordAuthentication no 65 ChallengeResponseAuthentication no 66 67 Then restart sshd with: 68 69 sudo systemctl restart ssh 70 71 72 Configure the system 73 -------------------- 74 75 ### Install language packs 76 77 Install languages we care about. 78 79 sudo apt install language-pack-en 80 sudo apt install language-pack-fr 81 sudo apt install language-pack-ja 82 83 Not doing this results in many tools emitting error messages and falling 84 back to the "C" locale. 85 86 ### Generate localisations 87 88 Edit `/etc/locales.gen` and uncomment locales that we care about. 89 90 en_AU.UTF-8 91 en_CA.UTF-8 92 en_GB.UTF-8 93 en_US.UTF-8 94 fr_CA.UTF-8 95 ja_JP.UTF-8 96 97 Then, regenerate the localisation files. 98 99 sudo locale-gen 100 101 102 ### Set the system time zone 103 104 To get a list of available time zones: 105 106 timedatectl list-timezones 107 108 Next, let's set the time zone then restart the `timedatectl` service: 109 110 sudo timedatectl set-timezone America/Vancouver 111 systemctl restart systemd-timedated 112 113 Finally, we'll verify the time zone is set correctly: 114 115 timedatectl 116 117 118 ### Install zsh 119 120 Next we'll install zsh and set it as our default shell. 121 122 sudo apt install zsh zsh-doc 123 chsh -s /usr/bin/zsh 124 125 126 ### Install vim 127 128 We're not going to live on a system that doesn't have a reasonable text editor. 129 130 sudo apt install vim 131 132 133 ### Get audio working 134 135 First, we'll install ALSA: 136 137 sudo apt-get install libasound2 libasound2-plugins alsa-utils alsa-oss 138 139 Then, we'll install PulseAudio: 140 141 sudo apt-get install pulseaudio pulseaudio-utils 142 143 Next, we'll add ourselves to the audio groups. 144 145 sudo usermod -aG pulse,pulse-access,audio chris 146 147 Next let's check the state of audio devices. 148 149 pacmd list-sinks 150 151 At this point things will be broken until you reboot. So reboot. 152 153 sudo shutdown -r now 154 155 When you log back in, run `alsamixer` and use the arrow keys to navigate to the 156 master channel and unmute it, then increase the volume. Press ESC to exit. 157 158 Audio should work at this point, but the easiest way to confirm that is with a 159 web browser, so next we'll get a window manager, terminal, and browser 160 installed. 161 162 163 ### Install nvidia drivers if necessary 164 165 On Debian systems, to install nvidia drivers, you'll first need to enable 166 `contrib` and `non-free` package repositories. Edit `/etc/apt/sources.list` 167 and patch the main distro soures to add those two repos. 168 169 deb http://deb.debian.org/debian/ buster main contrib non-free 170 deb-src http://deb.debian.org/debian/ buster main contrib non-free 171 172 Once that's done, update the local package store. 173 174 sudo apt update 175 176 Then install and run `nvidia-detect`. 177 178 sudo apt install nvidia-detect 179 sudo nvidia-detect 180 181 This should detect your hardware and suggest next steps. Assuming it tells you to install `nvidia-driver`, do so now. 182 183 sudo apt install nvidia-driver 184 185 You'll need to reboot at this point. 186 187 188 Install the Sway window manager and useful apps 189 ----------------------------------------------- 190 191 Next let's install the Wayland-based Sway tiling window manager and 192 suckless-tools for the dmenu launcher. 193 194 sudo apt install sway sway-backgrounds swaybg swayidle swaylock \ 195 suckless-tools 196 197 We'll want a security daemon that works to cache ssh keys, such as 198 gnome-keyring: 199 200 sudo apt install gnome-keyring 201 202 For a terminal emulator, rxvt is lightweight and works well. We'll install the 203 256-colour unicode variant: 204 205 sudo apt install rxvt-unicode-256color 206 207 For a Wayland-native terminal emulator, Alacritty is a good choice. The one 208 major downside as of March 2020 is that it doesn't have IME support for 209 inputting Japanese text under Wayland. Alacritty relies on the FreeDesktop 210 xdg-utils package to launch URLs from the terminal. 211 212 sudo add-apt-repository ppa:mmstick76/alacritty 213 sudo apt install alacritty 214 sudo apt install xdg-utils 215 216 217 ### Install fonts 218 219 We'll install the Noto family of fonts as a fallback font with broad coverage 220 of character sets. 221 222 sudo apt install fonts-noto-core \ 223 fonts-noto-mono \ 224 fonts-noto-extra \ 225 fonts-noto-cjk \ 226 fonts-noto-cjk-extra \ 227 fonts-noto-color-emoji 228 229 Next we'll install the Japanese IPA Fonts. IPA Font and IPAex Font are produced 230 by the Dokuritsu Kyousei Houjin's Information-technology Promotion Agency (IPA) 231 and distributed under a permissive licence. 232 233 sudo apt install fonts-ipafont fonts-ipaexfont 234 235 236 ### Install Dunst 237 238 [Dunst][dunst_site] is a lightweight daemon for displaying notifications to be 239 presented to the user over dbus. We'll also install the default Gnome icon 240 theme and the notify-send command-line tool. 241 242 sudo apt install dunst 243 sudo apt install libnotify-bin 244 sudo apt install gnome-icon-theme 245 246 247 ### Install Firefox 248 249 Next, we'll install Firefox. Since we want to be able to decode media, we also 250 install the non-free ubuntu-restricted-extras package. 251 252 sudo apt install firefox ubuntu-unrestricted-extras 253 254 On high-resolution displays, Firefox can look pretty tiny. You can change the 255 scale factor by going to `about:config`. Then change the logical to physical 256 pixel ratio. 257 258 layout.css.devPixelsPerPx = 1.3 259 260 To reset this value to the default, change it to -1.0. 261 262 263 Get Japanese working 264 -------------------- 265 266 First, we'll get an input manager installed. Input managers have two parts, the 267 input system (ibus, uim, fcitx) and the converion engine (anthy, mozc). As of 268 March 2020 uim nor fcitx are unsupported on Wayland, but ibus works well. Anthy 269 development has effectively been dead since 2009, so instead we'll use mozc. 270 271 sudo apt install ibus-mozc mozc-utils-gui 272 ibus-setup 273 /usr/lib/mozc/mozc_tool --mode=config_dialog 274 275 Add the following environment variables in `.zshenv`. 276 277 # Use ibus for Japanese IME. 278 export GTK_IM_MODULE=ibus 279 export XMODIFIERS=@im=ibus 280 export QT_IM_MODULE=ibus 281 282 And on Sway startup, we'll want to launch `ibus-daemon` from the Sway config in 283 `~/.config/sway/config`. 284 285 exec ibus-daemon --xim 286 287 288 Install developer tools 289 ----------------------- 290 291 Next, let's install some software development tools. 292 293 ### Basic developer tools 294 295 First, we'll start with the essentials. 296 297 sudo apt install make 298 sudo apt install clang lldb lld clang-format 299 sudo apt install git tig 300 sudo apt install universal-ctags cscope 301 302 Next, we'll pick one or more languages you want to develop in. 303 304 sudo apt install nasm 305 sudo apt install python3 306 sudo apt install golang 307 308 It's likely, at least in 2020, that some tools still depend on Python 2.7. If 309 it's not installed, but turns out to be required, we can install a minimal 310 install. 311 312 sudo apt install python-minimal 313 314 Rust install instructions exist at https://www.rust-lang.org/tools/install. As 315 of March 2020, these look like: 316 317 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh 318 319 Then customise the install to not alter the PATH, since any sane person would 320 prefer to hand-maintain their dotfiles themselves. If you haven't already, go 321 add `~/.cargo/bin` to your `PATH` environment variable. 322 323 Ninja is used by a bunch of build systems these days. 324 325 sudo apt install ninja-build 326 327 If we need gn (generate ninja), we can build from source: 328 329 git clone https://gn.googlesource.com/gn 330 cd gn 331 ./build/gen.py 332 ninja -j8 -C out/ 333 ./out/gn_unittests 334 mkdir -p ~/bin 335 cp ./out/gn ~/bin 336 337 If we need bazel, we can pull from the upstream repository. Bazel wants zip and 338 unzip installed too: 339 340 curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - 341 echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | \ 342 sudo tee /etc/apt/sources.list.d/bazel.list 343 sudo apt update && sudo apt install bazel 344 sudo apt install unzip zip 345 346 Bazel also likely wants gcc and g++ installed: 347 348 sudo apt install gcc g++ gdb 349 350 Troubleshooting 351 --------------- 352 353 ### multipathd 354 355 If you're seeing a lot of errors of the sort: 356 357 Jun 2 21:06:10 hostname multipathd[687]: sda: add missing path 358 Jun 2 21:06:10 hostname multipathd[687]: sda: failed to get udev uid: Invalid argument 359 Jun 2 21:06:10 hostname multipathd[687]: sda: failed to get sysfs uid: Invalid argument 360 Jun 2 21:06:10 hostname multipathd[687]: sda: failed to get sgio uid: No such file or directory 361 362 Edit `/etc/multipath.conf` and add the following entry: 363 364 blacklist { 365 devnode "sda" 366 } 367 368 Then restart `multipathd`: 369 370 sudo systemctl restart multipathd