Featured image of post 開発用クライアントPCのKubuntuのセットアップ

開発用クライアントPCのKubuntuのセットアップ

背景

  • 現状、Linux PCだけで7台も自分で使っている
  • そのため、毎回必要に応じて管理をするのが大変になってきた
  • 手元にあるすべてのコンピューターはWindowsからKubuntuに移行している
  • そのため、インストールメモを残す

インストール後の設定

最初に入れるもの

  • vivaldi
    • login
      • vivaldi user
      • 1password via mobile
      • github
    • Vivaldiの設定
      • Settings > Keyboard > “Alt Key for Main Menu”: off
      • Seetings > New Tab Page > https://www.google.co.jp
      • Settings > General > Default browser: on
      • Seetings > Search > Default Search Engine > https://www.google.co.jp
  • code
    • github login

GPGキーの設定

  • パスワードマネージャーからDLした鍵でGPGの登録をする
  • これによってcommitができるようになる
1
2
$ gpg --import secretkey.asc
$ shred --remove secretkey.asc

dotfilesのセットアップ

dotfileの初期化に必要な必須パッケージのインスコ。

1
$ sudo apt install git make -y

dotfilesをclone。

1
$ git clone https://github.com/3265/dotfiles

debやnix系のセットアップ

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
cd dotfiles
bash deb/sys/init.sh
bash deb/sys/drivers.sh
bash deb/sys/caps-lock.sh
bash deb/sys/fish.sh
bash deb/sys/font.sh
bash deb/sys/vim.sh
bash deb/sys/nix.sh
make link 
. ~/.nix-profile/etc/profile.d/nix.fish
make update

再起動する。

Konsoleの設定

以下の条件で新たなProfileを作りデフォルトにする:

  • General
    • Shell: /bin/fish
  • Appearance
    • Color: Dark Pastel or Solarized Dark
      • Background:
        • Transparency: 10%
    • Font: Hack Nerd
  • Mouse
    • Copy by select: on

マシンのsshキーの登録

次のgithub.shでsshキーを生成する。

1
2
3
4
$ cd dotifiles
$ sudo chmod +x setup/scripts/github.sh
$ sh setup/scripts/github.sh thinkpad
$ cat ~/.ssh/id_thinkpad_rsa.pub
  • Githubにログインして、公開鍵をgithubに貼り付ける
  • その後にSSHの疎通テストをする
1
$ ssh -T git@github.com

疎通ができたのでoriginを変更する。

1
2
$ git remote remove origin 
$ git remote add origin git@github.com:3265/dotfiles.git

日本語入力の設定

  • Add input method > mozcで追加する
  • Configure global options からLALTとRALTで入力切替の設定を追加する
  • Trigger input method: Control + Spaceを消す

最終的には次のような設定になる。

  • Input method
    • off: English
    • on: Mozc
  • Global options
    • Active input method: RALT
    • Deactive input method: LALT

KDEの基本設定

基本的なKDEの設定は以下になる。

  • System Settings:
    • Appearance
      • Theme: Dark theme
      • night color: always on
      • Compositor
        • Enable Compositor: off
    • Keyboard > Advanced > Caps lock Behavior:
      • Make cap lock an additional ctrl: on
    • Touchpad
      • natural scrolling
    • touchpadでmiddle clickをdisalbeedへ
    • Shortcuts
      • Spectacles
        • Capture Rectangle Region: Shift + PrintSc
        • Capture Active Window: PrintSc
        • Options
          • After taking a screenshot
            • Save to folder: on
            • Copy to Clipboard: on
    • Other notifications
      • Upgrade Notification: off
  • Dolphin
    • Show hidden file: on

Appendix

Taskbar

  • CPU / MemoryのPercentage Widget(左に)

Snap assist

  • KDE Snap Assistを入れる
  • KWin Scriptsでinstallする

OnlyOfficeのALTの設定

altの設定:

File > Advanced Settings > Workspace > Use Alt Key to…: false

Kate & Android Studio

  • Kate
    • 予めDropboxをインストールしておく sudo apt install -y nautilus-dropbox
    • 左Paneの非表示
      • 左Paneはアイコン上で右クリックから全て非表示にする
    • blankを開く
      • Settings > Configure Kate > Session > Application Startup Behavior > Load last used sesssion: checked
      • Settings > Configure Kate > Session > Application Save and Restore > Show welcome…: unchecked
    • vimモード
      • Settings > Configure Kate > Editing > General > Default Input Mode: Vi Input Mode
      • 手動の場合、Edit > Input Mode > Vi Mode
    • Top Header: off
      • Settings > Toolbars shown > all off
    • TOC
      • sudo snap install marksman
      • Settings > Configure Kate > LSP Client > User Server Settings
         1
         2
         3
         4
         5
         6
         7
         8
         9
        10
        11
        12
        
        {
          "servers":
          {
              "markdown":
              {
                  "command": ["marksman", "server"],
                  "rootIndicatorFileNames": [".git", ".marksman.toml"],
                  "url": "https://github.com/artempyanykh/marksman",
                  "highlightingModeRegex": "^Markdown$"
              }
          }
        }
        
      • projectとtocの表示
        • View > Slidebar Buttons > Show Symbol Outline Button: Check
        • View > Slidebar Buttons > Show Projects Button: Check
      • .kateprojectとして次をドキュメントルートに設置する
      1
      2
      3
      4
      5
      
      {
        "files": [
          { "directory": ".", "recursive": 1, "filters": ["*.md"] }
        ]
      }
      

Jetbrains Toolbox

  • Idea
    • Jetbrain Toolboxからインストールする
    • ToolboxからIdeaをインストールする
    • PluginでVimを入れる
  • Android Studio
    • Jetbrain Toolboxからインストールする
    • PluginでVimを入れる

タッチパッドの設定

タッチパッドはMacのように使えるようにするため、RubyとFusumaをインストールする。

1
2
3
4
5
$ sudo apt install -y ruby
$ sudo apt install -y libinput-tools 
$ sudo apt install -y xdotool
$ sudo gem install fusuma
$ sudo gpasswd -a $USER input

/dev/input/event*にアクセスするためinputグループへuser追加する必要がある。

Live USB

USBドライブのフォーマット

  • Windowsを使用した
  • Start > Right Click > Disk Managementで対応のドライブを選択
  • パーテーション(Volume)の削除とフォーマットをする

Disk Management

KubuntuのUSBドライブの作成

  • KubuntuのISOをDL
  • RufusでUSBに焼き付ける

ThinkPadのBIOSの修正

  • Thinkpadの場合はEnter > F12 > USBの選択でLive USBを起動できた
  • もしくは、BIOSの設定変更でUSBメディアの優先度を上げる

トラブルシューティング

ログインの問題

  • bash_profileにexecコマンドを持ったコマンドを入れたらログインできなくなった
  • alt + ctrl + f3でcliでログインして修正する必要があった

liveusbの問題

  • 以下のエラーが発生し、Live USBも起動しなかった
  • これはメインのSSDの致命的なエラーが原因だった

Windows Error

  • 解決策としては、WindowsのBlue Screenで出たリカバリーのoptionをいくつか試した
  • 特に、Savepointから1年前のSSDの状態に戻すことでrollbackがうまく行った
  • これによって、Live USBが起動するようになった

Rescatux

  • その後、Rescatux Linuxで修復コマンドを実行した
  • しかし、完全にはデバイスのエラーは直らなかった
  • そこで、Windowsのデータは諦めてフォーマットした
1
$ sudo gdisk /dev/nvme0n1

hackmdのバグ

  • vivaldiでhackmdのescバグがあった
  • その際は、:imap <C-[> <Esc>で代用した

重くなる問題

重いと思ったらx.orgが81%も使っていた。

 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
$ top
top - 00:18:55 up 2 days, 25 min,  1 user,  load average: 1.71, 1.49, 1.71
Tasks: 337 total,   2 running, 335 sleeping,   0 stopped,   0 zombie
%Cpu(s): 22.5 us,  7.9 sy,  0.0 ni, 69.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  15734.5 total,   3898.5 free,   8455.2 used,   5273.8 buff/cache
MiB Swap:   4608.0 total,   3107.3 free,   1500.7 used.   7279.3 avail Mem
 Unknown command - try 'h' for help
    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   1505 root      20   0  818184  98588  72352 R  81.8   0.6      8,51 Xorg
  51454 mike      20   0   33.0g 473540 258688 S  27.3   2.9  13:06.09 vivaldi-bin
  81287 mike      20   0 1393.9g 332628 151976 S  27.3   2.1   0:29.32 vivaldi-bin
  81655 mike      20   0   15616   5792   3616 R   9.1   0.0   0:00.01 top
      1 root      20   0   23200  12932   8832 S   0.0   0.1   0:09.81 systemd
      2 root      20   0       0      0      0 S   0.0   0.0   0:00.11 kthreadd
      3 root      20   0       0      0      0 S   0.0   0.0   0:00.00 pool_workqueue_release
      4 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/R-rcu_gp
      5 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/R-sync_wq
      6 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/R-slub_flushwq
      7 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/R-netns
      9 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/0:0H-events_highpri
     12 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/R-mm_percpu_wq
     13 root      20   0       0      0      0 I   0.0   0.0   0:00.00 rcu_tasks_kthread
     14 root      20   0       0      0      0 I   0.0   0.0   0:00.00 rcu_tasks_rude_kthread
     15 root      20   0       0      0      0 I   0.0   0.0   0:00.00 rcu_tasks_trace_kthread
     16 root      20   0       0      0      0 S   0.0   0.0   3:51.99 ksoftirqd/0
     17 root      20   0       0      0      0 I   0.0   0.0   1:11.27 rcu_preempt
     18 root      20   0       0      0      0 S   0.0   0.0   0:00.00 rcu_exp_par_gp_kthread_worker+
     19 root      20   0       0      0      0 S   0.0   0.0   0:00.01 rcu_exp_gp_kthread_worker
     20 root      rt   0       0      0      0 S   0.0   0.0   0:00.59 migration/0
     21 root     -51   0       0      0      0 S   0.0   0.0   0:00.00

そこで、ドライバを入れ替えた。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
$ sudo apt install inxi
$ inxi -G

Graphics:
  Device-1: Intel UHD Graphics 620 driver: i915 v: kernel
  Device-2: IMC Networks Integrated Camera driver: uvcvideo type: USB
  Display: x11 server: X.Org v: 21.1.11 with: Xwayland v: 23.2.6 driver: X:
    loaded: modesetting unloaded: fbdev,vesa dri: iris gpu: i915
    resolution: 1920x1080~60Hz
  API: EGL v: 1.5 drivers: iris,swrast platforms: gbm,x11,surfaceless,device
  API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa
    v: 24.2.8-1ubuntu1~24.04.1 renderer: Mesa Intel UHD Graphics 620 (KBL GT2)
  API: Vulkan v: 1.3.275 drivers: N/A surfaces: xcb,xlib

インテルドライバ(xf86-video-intel)をインストールした。

1
$ sudo apt install xserver-xorg-video-intel

ただ、原因は、KWinのコンポジタだった。 Alt + Shift + F12でコンポジたを一時的にOffにしたら爆速になった。

恒久的にOffにする場合は以下。

  • System Settings:
    • Enable Compositor: off

参考文献

Built with Hugo
テーマ StackJimmy によって設計されています。