Contents

Setup Ubuntu 20.04

Abstract
Installing Ubuntu 20.04 and setting it up with wataash’s personal preferences.
Warning
This is just personal notes, or an instruction for friends. Don’t expect it to be a good reference.

new-pc, ssh-pc, and old-pc

Let’s call three PCs as:

  • new-pc: to which will be installed and set-upped Ubuntu 20.04
  • ssh-pc: operates new-pc via ssh and VNC
  • old-pc: which was previous main PC (Ubuntu 19.04); maybe ==new-pc or ==ssh-pc
1
2
3
4
                         setup via ssh/VNC               .
new-pc (Ubuntu 20.04) <--------------------- ssh-pc      .
                                                         .
  old-pc (Ubuntu 19.04)                                  .

During setting-up new-pc, I don’t operate new-pc itself directly because:

  • I can’t do an efficient operation on fresh Ubuntu (maybe 2x slower than hacked Ubuntu). e.g. “Japanese-Kana-key+W to open Chrome” is not available.
  • Prevent applications from creating default configuration files. e.g. start fish will create ~/.local/share/fish/fish_history, which will conflict with dotfiles

Get info of old-pc

1
2
3
4
# ssh-pc
mkdir ~/logs/
ssh <old-pc IP> apt list --installed > ~/logs/ubuntu_apt-list.old.txt
ssh <old-pc IP> snap list            > ~/logs/ubuntu_snap-list.old.txt

Install Ubuntu

Boot with USB stick.

/ubuntu_setup/2020-08-10-13-28-17.png
Check: Install third-party software for graphics and Wi-Fi hardware and additional media formats
/ubuntu_setup/2020-08-10-15-28-57.png
TODO: if Secure Boot is enabled, I recommend turn off it; Secure Boot sometimes requires deep knowledge about low-layer things for trouble-shooting
/ubuntu_setup/2020-08-10-15-17-29.png
Installation type: Erase disk and install Ubuntu: Use LVM with the new Ubuntu installation, Encrypt the new Ubuntu installation for security
/ubuntu_setup/2020-08-10-15-19-10.png
Choose a security key (so-called LUKS key)
/ubuntu_setup/2020-08-10-15-22-26.png
User password can be same as LUKS-key; But I use different ones

TODO:

apt upgrade

1
2
3
4
# new-pc
sudo apt update
sudo apt upgrade
sudo reboot

Install sshd

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# new-pc
sudo apt install openssh-server
# logout

# ssh-pc
ssh <new-pc IP>
# new-pc via ssh
mkdir ~/.ssh/
chmod 700 ~/.ssh/
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
vi ~/.ssh/authorized_keys  # add ssh-pc's public key

From here, all commands are executed on “new-pc via ssh”, unless otherwise noted.

Proxy

1
2
3
export  http_proxy=http://192.2.0.1:8080
export https_proxy=http://192.2.0.1:8080
export   ftp_proxy=http://192.2.0.1:8080

Prevent sleep when closing new-pc laptop’s lid closing at login screen (gdm3)

https://askubuntu.com/a/1131749/764025

1
2
3
4
5
sudo vi /etc/systemd/logind.conf
# #HandleLidSwitch=suspend
# HandleLidSwitch=ignore

sudo reboot

Unlock LUKS via ssh

TODO (sudo apt install dropbear-initramfs, sudo vi /etc/dropbear-initramfs/authorized_keys, sudo update-initramfs -u, cryptroot-unlock)

connect Wi-Fi in dropbear seems to be hard (I didn’t tried though), prepare an ethernet NIC.

Sync dotfiles

Such like: https://github.com/wataash/dotfiles

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
sudo apt install git
git init
git remote add origin https://github.com/wataash/dotfiles-private-repo.git
git fetch
git checkout h  # conflicts: .config/mimeapps.list .ssh/config
cp -v .config/mimeapps.list .config/mimeapps.list.orig
cp -v .ssh/config           .ssh/config.orig
git checkout -f h
diff  .config/mimeapps.list .config/mimeapps.list.orig  # resolve later
diff  .ssh/config           .ssh/config.orig            # resolve later

apt, snap, flatpak

Setup Ubuntu 20.04 (apt, snap, flatpak)

VNC

TODO: free VNC instead of RealVNC

Application settings (primary or heavy)

heavy:

  • does lots of networking
  • takes long time to build/sync/etc.

Rust

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup -v update
~/.cargo/bin/cargo install -v \
bat \
cargo-generate \
dua-cli \
exa \
fd-find \
git-delta \
hyperfine \
rbspy \
;

Haskell

TODO

xkb

See changes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
sudo cp -v /usr/share/X11/xkb/symbols/inet /usr/share/X11/xkb/symbols/inet.orig
sudo cp -v /usr/share/X11/xkb/symbols/jp   /usr/share/X11/xkb/symbols/jp.orig

# ssh-pc

delta ~/usr/share/X11/xkb/symbols/inet_ubu1904_orig (ssh $NEW_PC_IP cat /usr/share/X11/xkb/symbols/inet | psub)
delta ~/usr/share/X11/xkb/symbols/jp_ubu1804_orig   (ssh $NEW_PC_IP cat /usr/share/X11/xkb/symbols/jp   | psub)  # ubuntu 20.04: no diff

ssh $NEW_PC_IP cat /usr/share/X11/xkb/symbols/inet > ~/usr/share/X11/xkb/symbols/inet_ubu2004_orig
# patch
delta ~/usr/share/X11/xkb/symbols/inet_ubu1904_orig ~/usr/share/X11/xkb/symbols/inet
delta ~/usr/share/X11/xkb/symbols/inet_ubu2004_orig ~/usr/share/X11/xkb/symbols/inet
code ~/usr/share/X11/xkb/symbols/inet_ubu2004_orig  # copy
code ~/usr/share/X11/xkb/symbols/inet  # paste, apply patch
delta ~/usr/share/X11/xkb/symbols/inet_ubu2004_orig ~/usr/share/X11/xkb/symbols/inet
git add ...

# new-pc via ssh
sudo vi /usr/share/X11/xkb/symbols/inet
sudo vi /usr/share/X11/xkb/symbols/jp
~/.cargo/bin/delta /usr/share/X11/xkb/symbols/inet.orig /usr/share/X11/xkb/symbols/inet
~/.cargo/bin/delta /usr/share/X11/xkb/symbols/jp.orig   /usr/share/X11/xkb/symbols/jp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--- /usr/share/X11/xkb/symbols/inet.orig	2020-08-12 17:13:23.281056773 +0900
+++ /usr/share/X11/xkb/symbols/inet	2020-08-12 17:24:44.121288077 +0900
@@ -104,9 +104,22 @@
 // Commented out because HZTG has same keycode as TLDE
 //    key <HZTG>   {      [ Zenkaku_Hankaku       ]       };
 
-    key <HKTG>   {      [ Hiragana_Katakana     ]       };
-    key <HENK>   {      [ Henkan                ]       };
-    key <MUHE>   {      [ Muhenkan              ]       };
+//    key <HKTG>   {      [ Hiragana_Katakana     ]       };
+//    key <HENK>   {      [ Henkan                ]       };
+//    key <MUHE>   {      [ Muhenkan              ]       };
+
+//    key <HKTG>   {      [ F16                   ]       };
+//    key <HENK>   {      [ F15                   ]       };
+//    key <MUHE>   {      [ F14                   ]       };
+//    modifier_map Mod2 { F14 };
+//    modifier_map Mod3 { F15 };
+//    modifier_map Mod5 { F16 };
+
+    key <HKTG> { [ ], actions[Group1] = [SetMods(modifiers=Mod5)] };
+    key <HENK> { [ ], actions[Group1] = [SetMods(modifiers=Mod3)] };
+//    key <MUHE> { [ ], actions[Group1] = [SetMods(modifiers=Mod2)] };
+    key <MUHE> { [ Control_L ], actions[Group1] = [SetMods(modifiers=Control)] };
+
     key <KATA>   {      [ Katakana              ]       };
     key <HIRA>   {      [ Hiragana              ]       };
     key <RO>     {      [ Romaji                ]       };
--- /usr/share/X11/xkb/symbols/jp.orig	2020-08-12 17:13:25.545043279 +0900
+++ /usr/share/X11/xkb/symbols/jp	2020-08-12 17:25:20.676948927 +0900
@@ -44,7 +44,12 @@
     key <AD11> { [ at, grave		] };
     key <AD12> { [ bracketleft,	braceleft ] };
 
-    key <CAPS> { [ Eisu_toggle, Caps_Lock ] };
+//     key <CAPS> { [ Eisu_toggle, Caps_Lock ] };
+//     key <CAPS> { [ Control_R ] };
+//     key <CAPS> { [ F13 ] };
+//     key <CAPS> { [ F13 ], actions[Group1] = [SetMods(modifiers=Lock)] };
+//     key <CAPS> { actions[Group1] = [SetMods(modifiers=Lock)] };
+     key <CAPS> { [ ], actions[Group1] = [SetMods(modifiers=Lock)] };
 
     key <AC01> { [ a, A			] };
     key <AC02> { [ s, S			] };
@@ -70,7 +75,10 @@
     key <AB09> { [ period, greater	] };
     key <AB10> { [ slash, question	] };
     key <AB11> { [ backslash, underscore] };
-    key <LCTL> { [ Control_L		] };
+
+// swap lctrl, muhe
+    key <LCTL> { [ Control_L        ] };
+//    key <LCTL> { [ Control_L ], actions[Group1] = [SetMods(modifiers=Mod2)] };
 
     key <NFER> { [ Muhenkan		] };
 
@@ -321,3 +329,4 @@
 	xkb_symbols "sun_type7" {
 	include "sun_vndr/jp(sun_type7)"
 };
+

needs reboot

Google Chrome

1
2
3
cd /tmp/
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb

new-pc GUI: Start sync.

JetBrains Toolbox

Note
Needs JetBrains license

Get link to latest tar.gz on https://www.jetbrains.com/toolbox-app/

1
2
3
4
5
6
cd /tmp/
wget https://download.jetbrains.com/toolbox/jetbrains-toolbox-1.17.7391.tar.gz
tar xvf jetbrains-toolbox-*.tar.gz
# GUI
/tmp/jetbrains-toolbox-*/jetbrains-toolbox
# installed in ~/.local/share/JetBrains/Toolbox/, so /tmp/jetbrans... can be removed
  • Login
  • Generate shell scripts: ~/opt/jetbrains/bin
    • manual mkdir is not needed
  • Install many

Dropbox

https://www.dropbox.com/install-linux

1
2
3
cd /tmp/
wget -O dropbox.deb 'https://www.dropbox.com/download?dl=packages/ubuntu/dropbox_2020.03.04_amd64.deb'
sudo dpkg -i dropbox.deb

new-pc: GUI: start Dropbox

Japanese

http://www.ubuntulinux.jp/japanese

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
cat /etc/lsb-release  # 20.04 focal
# Ubuntu 20.04 LTSの場合:
wget -q https://www.ubuntulinux.jp/ubuntu-ja-archive-keyring.gpg -O- | sudo apt-key add -
wget -q https://www.ubuntulinux.jp/ubuntu-jp-ppa-keyring.gpg -O- | sudo apt-key add -
sudo wget https://www.ubuntulinux.jp/sources.list.d/focal.list -O /etc/apt/sources.list.d/ubuntu-ja.list
sudo apt update
# 3. 以下のコマンドを実行し、パッケージをアップグレードします。
sudo apt-get update  # Hit:2 http://jp.archive.ubuntu.com/ubuntu focal InRelease
sudo apt-get install ubuntu-defaults-ja
---
The following additional packages will be installed:
  firefox-locale-ja fonts-noto-cjk-extra language-pack-gnome-ja language-pack-gnome-ja-base language-pack-ja
  language-pack-ja-base libzinnia0v5 mozc-utils-gui
Suggested packages:
  ibus-qt5
The following NEW packages will be installed:
  firefox-locale-ja fonts-noto-cjk-extra language-pack-gnome-ja language-pack-gnome-ja-base language-pack-ja
  language-pack-ja-base libzinnia0v5 mozc-utils-gui ubuntu-defaults-ja
0 upgraded, 9 newly installed, 0 to remove and 3 not upgraded.

/ubuntu_setup/2020-08-12-15-22-32.png
Windows key -> Language Support
/ubuntu_setup/2020-08-12-15-20-33.png
The language support is not installed completely -> Install, input password

Online accounts

/ubuntu_setup/2020-08-12-17-30-18.png
Skip, Next, Next, Next, Done

gnome-control-center (Settings)

/ubuntu_setup/2020-08-12-17-35-27.png
gnome-control-center (Settings) left panel
/ubuntu_setup/2020-08-12-17-36-54.png
Appearance
/ubuntu_setup/2020-08-12-17-40-14.png
Privacy: File History & Trash: Automatically Delete Temporary Files
/ubuntu_setup/2020-08-12-17-41-28.png
Privacy: Screen Lock
/ubuntu_setup/2020-08-12-17-44-07.png
Power
/ubuntu_setup/2020-08-12-17-50-20.png
Mouse & Touchpad

gnome-tweak-tool (Tweaks)

/ubuntu_setup/2021-02-10-11-24-34.png
Workspace Matrix settings

https://askubuntu.com/a/598202/764025

1
2
3
4
5
6
7
ll ~/.config/autostart/
cat > ~/.config/autostart/xbindkeys.desktop <<'EOS'
[Desktop Entry]
Name=xbindkeys
Exec=xbindkeys_autostart
Type=Application
EOS

/ubuntu_setup/2020-08-12-18-00-50.png
General; Animations off: workspace switching (ctrl+win+arrow) becomes fast
/ubuntu_setup/2020-08-12-18-03-24.png
Extensions; GPaste: enable, delete all defualt shortcuts
/ubuntu_setup/2020-08-12-18-04-11.png
Delete all GPaste shortcuts
/ubuntu_setup/2020-08-12-18-32-04.png
Startup Applications
/ubuntu_setup/2020-08-12-18-14-42.png
Top Bar
/ubuntu_setup/2020-08-15-18-10-23.png
Windows
/ubuntu_setup/2020-08-12-18-10-23.png
Workspaces

Visual Studio Code

https://code.visualstudio.com/Download

1
2
3
cd /tmp/
wget https://az764295.vo.msecnd.net/stable/91899dcef7b8110878ea59626991a18c8a6a1b3e/code_1.47.3-1595520028_amd64.deb
sudo dpkg -i code_*.deb

misc

1
2
# win+right drag to resize
gsettings set org.gnome.desktop.wm.preferences resize-with-right-button true

Application settings (etc)

From now on, operate new-pc directly.

TODO