設定
デバイス#
PC Master Race
- OS: Kubuntu 26.04 LTS
- CPU: AMD Ryzen 5 3600
- GPU: AMD Radeon RX 6800 16 GB
- RAM: 32 GB (4×8 GB GeIL Super Luce DDR4 3200 MHz)
- NVMe: 1 TB (2×512 GB Adata XPG Spectrix S40G)
- マザーボード: ASUS TUF Gaming X570-PRO (Wi-Fi)
- マウス: Logitech G305
- キーボード: HyperX Alloy Origins Core、Razer Pink PBTキーキャップ付き
- ヘッドホン: Audio-Technica ATH-M50x (FiiO BTA10付き) と Sony Inzone H9
ベースインストール#
Kubuntu 26.04をUEFIモードでインストール:
- Btrfs
- Swap file
- LUKS有効
レイアウト: サブボリューム/@、/@home、/@swap、swap fileは/swap/swapfile、ディスクはLUKSで暗号化。
BIOS#
- 最適化デフォルトを読み込む
- DOCP/XMPでRAMを3200 MHzに設定
- Above 4G Decodingを有効化
- Resizable BARを有効化
- SVM Mode / AMD-Vを有効化
- Secure Bootを有効化
- CSMを無効化
- ファンカーブを静音寄りに調整
Linux#
GRUB#
for p in preempt=full pcie_aspm=off; do
grep -q "$p" /etc/default/grub || sudo sed -i "s/GRUB_CMDLINE_LINUX_DEFAULT=\([\"']\)\(.*\)\1/GRUB_CMDLINE_LINUX_DEFAULT=\1\2 $p\1/" /etc/default/grub
done && sudo update-grub
preempt=full- スケジューリングレイテンシを下げる。pcie_aspm=off- Intel AX200 WiFiがD3coldで固まる問題のワークアラウンド。quietは使わない。boot時にもっと情報を見たいので。cryptdevice=...とroot=...はインストールごとに違う。
LUKS performance#
sudo dmsetup table
sudo cryptsetup --perf-no_read_workqueue --perf-no_write_workqueue --allow-discards --persistent refresh luks-blablabla
no_read_workqueue/no_write_workqueue- NVMeでレイテンシが下がる。allow-discards- SSDでTRIMを有効化。
Btrfs mounts#
Kubuntuがサブボリュームとswap fileを作ってくれる。/tmp はsystemdで最初からtmpfs。変えるのはmount optionsだけ。
sudo nvim /etc/fstab
/ と /home で、autodefrag があれば消して compress=zstd を足す:
/dev/mapper/luks-blablabla / btrfs subvol=/@,defaults,noatime,compress=zstd 0 0
/dev/mapper/luks-blablabla /home btrfs subvol=/@home,defaults,noatime,compress=zstd 0 0
noatime- 書き込みを減らす。compress=zstd- 透過圧縮。
sysctl#
sudo tee /etc/sysctl.d/90-zram.conf > /dev/null << 'EOF'
vm.swappiness = 150
EOF
sudo sysctl --system
zram#
sudo apt install systemd-zram-generator && \
sudo tee /etc/systemd/zram-generator.conf > /dev/null << 'EOF'
[zram0]
zram-size = ram / 2
compression-algorithm = zstd
swap-priority = 100
EOF
sudo systemctl daemon-reload && sudo systemctl start dev-zram0.swap
Btrfs swap file#
sudo swapoff /swap/swapfile && \
sudo rm -f /swap/swapfile && \
sudo btrfs filesystem mkswapfile --size 4G /swap/swapfile && \
sudo swapon /swap/swapfile
ディスクswapはzramが埋まった時のfallback。
OOM#
sudo apt install systemd-oomd && \
sudo systemctl enable --now systemd-oomd.service
CPU#
powerprofilesctl set performance
amd-pstate active+ governorperformance+ EPPperformance- NVMe scheduler
noneはNVMeでは通常すでにデフォルト。
Intel AX200 WiFi#
sudo tee /etc/modprobe.d/iwlwifi-fix.conf > /dev/null << 'EOF'
options iwlwifi power_save=0
options iwlmvm power_scheme=1
EOF
sudo tee /etc/NetworkManager/conf.d/99-disable-wifi-powersave.conf > /dev/null << 'EOF'
[connection]
wifi.powersave=2
EOF
sudo systemctl restart NetworkManager
SDDM AMDGPU#
KDEのみ。Kubuntu 26.04で起動時に黒画面になる可能性があるSDDMとGPU初期化の競合に対するワークアラウンド(LP: #2063143)。
sudo mkdir -p /etc/systemd/system/sddm.service.d && \
sudo tee /etc/systemd/system/sddm.service.d/udev-settle.conf > /dev/null << 'EOF'
[Unit]
After=systemd-udev-settle.service
Wants=systemd-udev-settle.service
EOF
sudo systemctl daemon-reload
NetworkManager#
sudo systemctl disable --now NetworkManager-wait-online.service
sudo tee /etc/NetworkManager/conf.d/99-mac-address-policy.conf > /dev/null << 'EOF'
[connection]
wifi.cloned-mac-address=stable
EOF
sudo systemctl restart NetworkManager
パッケージ#
apt#
sudo apt install \
7zip adb antiword aria2 aspell-es atuin audacity autoconf automake axel bat \
bear ble.sh bleachbit brightnessctl btop build-essential buildah \
ca-certificates cabextract clamav clang cmake cmatrix cockpit cockpit-podman cowsay \
criu curl ddcui ddcutil diffoscope direnv distrobox dnsutils duf \
editorconfig expect eza fastboot fcitx5-mozc fd-find ffmpeg ffmpegthumbnailer filelight \
firejail flatpak fortune-mod fzf gamemode gdb ghostty gifsicle \
git glab gnupg golang-go gwenview handbrake hashcat httpie hugo \
hunspell-en-us hunspell-es hw-probe hyperfine hyphen-en-us hyphen-es \
inotify-tools iotop-c isoimagewriter jo jq just kcalc kde-config-flatpak \
lazygit libfuse-dev libfuse3-dev libtool libvirt-daemon-system lolcat \
magic-wormhole meson moreutils mpv mythes-en-us mythes-es ncdu needrestart \
neovim nethogs ninja-build nload nmap nvtop okular openrgb optipng pamixer \
pandoc pdfgrep pipx pkg-config plasma-discover-backend-flatpak playerctl \
pngquant podman podman-docker podman-toolbox poppler-utils pre-commit procs \
python-is-python3 python3 python3-dev python3-full python3-venv \
qemu-system-x86 redis-server redis-tools ripgrep-all shellcheck shfmt sl \
speedtest-cli ssh sshpass starship tealdeer thefuck tidy timeshift tmux \
toilet torbrowser-launcher trash-cli tree tshark ufw ugrep universal-ctags \
unrar unzip valgrind virt-manager vlc wget whois wireshark xmlstarlet ydotool yt-dlp \
zoxide
mkdir -p ~/.local/bin && \
ln -sfn "$(command -v fdfind)" ~/.local/bin/fd
ユーザーパーミッション#
sudo usermod -aG kvm,libvirt,wireshark "$USER"
ログアウトして再度ログイン。
ROCm#
sudo apt install rocm rocm-podman-support && \
sudo usermod -aG render,video "$USER"
ログアウトして再度ログイン。
APT security auto-updates#
sudo apt install unattended-upgrades && \
sudo tee /etc/apt/apt.conf.d/20auto-upgrades > /dev/null << 'EOF'
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";
EOF
Ubuntu Pro#
https://ubuntu.com/pro/dashboard でトークンを取得。
sudo pro attach <トークン>
pro status
外部リポジトリ#
extrepo#
extrepo は Debian がメンテする外部リポジトリ管理ツール。インターネットから適当なスクリプトを落として root で走らせるんじゃなくて、審査済みのカタログから有効化する。GPG キーとリポジトリ定義はすでに含まれてる。extrepo search で検索、extrepo enable で有効化。
sudo apt install extrepo
sudo extrepo enable brave_release google_chrome librewolf steam tailscale vscode
sudo apt update
sudo apt install brave-browser code google-chrome-stable librewolf steam tailscale
sudo tailscale up
パッケージマネージャーとランタイム#
Homebrew#
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && \
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && \
brew install croc fnm gh topgrade uv yq
Topgrade config#
mkdir -p ~/.config
cat > ~/.config/topgrade.toml << 'EOF'
[misc]
assume_yes = true
cleanup = true
ask_retry = false
notify_end = "on_failure"
EOF
pnpm global#
eval "$(fnm env --use-on-cd --shell bash)" && \
fnm install --lts --use && \
fnm default "$(fnm current)" && \
(command -v corepack >/dev/null || npm install --global corepack@latest) && \
corepack enable pnpm && \
corepack install --global pnpm@latest && \
mkdir -p ~/.local/share/pnpm && \
pnpm config set global-bin-dir ~/.local/share/pnpm --location=global
npm / pnpm セキュリティ#
サプライチェーン攻撃向けの hardening。インストールスクリプトをブロックして、公開されたばかりのパッケージを避ける。
# npm: サードパーティのスクリプトを実行させない
cat > ~/.npmrc << 'EOF'
ignore-scripts=true
EOF
# pnpm 11+: 公開後1日未満のパッケージを避ける組み込みポリシー
# bun: スクリプトと公開されたばかりのパッケージをブロック
cat > ~/.bunfig.toml << 'EOF'
[install]
ignoreScripts=true
minimumReleaseAge=86400
EOF
これで npm は依存関係の preinstall と postinstall を実行しない。Bun はスクリプトと公開後1日未満のパッケージをブロックする(86400 秒)。pnpm 11+ は非strictモードで公開後1日の組み込みポリシーを適用するため、追加のグローバル設定は不要。
スクリプトインストール#
# Bun
curl -fsSL https://bun.sh/install | bash
# Rust / Cargo
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
アプリ#
Nerd Fonts#
brew install --cask font-hack-nerd-font font-ubuntu-mono-nerd-font && fc-cache -fv
Flatpak#
flatpak remote-add --if-not-exists flathub \
https://flathub.org/repo/flathub.flatpakrepo
flatpak install flathub \
com.github.wwmm.easyeffects \
com.github.PintaProject.Pinta com.github.tchx84.Flatseal \
com.obsproject.Studio com.obsproject.Studio.Plugin.OBSVkCapture//stable \
com.spotify.Client com.stremio.Stremio com.usebottles.bottles \
com.vysp3r.ProtonPlus dev.vencord.Vesktop io.github.flattool.Warehouse \
io.github.hedge_dev.hedgemodmanager io.podman_desktop.PodmanDesktop \
it.mijorus.gearlever net.lutris.Lutris net.retrodeck.retrodeck \
org.freedesktop.Platform.VulkanLayer.OBSVkCapture//25.08 org.gimp.GIMP \
org.kde.kdenlive org.kde.krita org.kde.yakuake org.libreoffice.LibreOffice \
org.localsend.localsend_app org.qbittorrent.qBittorrent org.signal.Signal \
org.telegram.desktop
Android Studio#
sudo snap install android-studio --classic
Setup WizardがSDKを~/Android/Sdkへダウンロードする。
Zed#
curl -f https://zed.dev/install.sh | sh
Codex#
curl -fsSL https://chatgpt.com/codex/install.sh | sh
Codex Desktop#
macOS公式DMGから作る非公式のCodex Desktop Linux build: https://github.com/ilysenko/codex-desktop-linux。
ネイティブパッケージ(Kubuntu/Ubuntuなら.deb)で入れて、Computer Use UIとremote/mobileも有効にする:
sudo apt install ydotool xdg-desktop-portal-kde
sudo usermod -a -G input "$USER"
systemctl --user enable --now ydotool.service
flatpak permission-set kde-authorized remote-desktop "" yes
git clone https://github.com/ilysenko/codex-desktop-linux.git ~/Documents/codex-desktop-linux
cd ~/Documents/codex-desktop-linux
cat > linux-features/features.json << 'EOF'
{
"enabled": [
"open-target-discovery",
"remote-control-ui",
"remote-mobile-control"
]
}
EOF
mkdir -p ~/.config/codex-desktop
echo '{"codex-linux-computer-use-ui-enabled": true}' > ~/.config/codex-desktop/settings.json
make bootstrap-native
make bootstrap-nativeは依存関係を入れて、Codex.dmgを落として、codex-app/を生成して、ネイティブパッケージを作ってインストールする。依存関係がもうあるならmake install-nativeを使う。
Computer Useで入力操作まで使うには、ユーザーをinputグループに追加したあとログアウトして入り直す。
kde-authorizedはapp_idなしのホストアプリでKDEのRemote Controlポップアップを飛ばす。便利だが範囲は広い。
Trezor Suite#
Trezor SuiteをAppImageでダウンロードしてGear Leverで管理する。
Timeshift#
sudo timeshift-gtk
設定:
- タイプ: Btrfs
- ロケーション: システムと同じBtrfsディスク
- スケジュール: 毎日 + boot時
- 保持: 3個の毎日、3個のboot、2個の毎週
/home: ユーザーデータは含めない
Shellとターミナル#
Ghostty#
mkdir -p ~/.config/ghostty && \
tee ~/.config/ghostty/config.ghostty > /dev/null << 'EOF'
background-opacity = "0.9"
font-family = "UbuntuMono Nerd Font"
font-size = "14"
theme = "Dark Pastel"
window-height = "32"
window-width = "100"
EOF
profile#
~/.profile:
# path helper
path_prepend() {
[ -d "$1" ] || return 0
case ":$PATH:" in
*":$1:"*) ;;
*) export PATH="$1:$PATH" ;;
esac
}
# local bin
path_prepend "$HOME/bin"
path_prepend "$HOME/.local/bin"
# android sdk
export ANDROID_HOME="$HOME/Android/Sdk"
path_prepend "$ANDROID_HOME/cmdline-tools/latest/bin"
path_prepend "$ANDROID_HOME/emulator"
path_prepend "$ANDROID_HOME/platform-tools"
# bun
export BUN_INSTALL="$HOME/.bun"
path_prepend "$BUN_INSTALL/bin"
# homebrew
if [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
# pnpm
export PNPM_HOME="$HOME/.local/share/pnpm"
path_prepend "$PNPM_HOME"
# rust/cargo
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
bashrc#
~/.bashrc:
# ble.sh - load first, attach last
[[ $- == *i* && -f /usr/share/blesh/ble.sh ]] && source -- /usr/share/blesh/ble.sh --attach=none
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return 0 ;;
esac
HISTCONTROL=ignoreboth:erasedups
shopt -s histappend
HISTSIZE=100000
HISTFILESIZE=100000
shopt -s checkwinsize
shopt -s globstar
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# PS1 is handled by starship (see below)
if [ -x /usr/bin/dircolors ]; then
if [ -r ~/.dircolors ]; then
eval "$(dircolors -b ~/.dircolors)"
else
eval "$(dircolors -b)"
fi
alias grep='grep --color=auto'
alias egrep='grep -E --color=auto'
alias fgrep='grep -F --color=auto'
fi
# aliases
alias ls='eza'
alias ll='eza -l'
alias la='eza -la'
alias cat='batcat --paging=never'
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
# fnm
command -v fnm >/dev/null && eval "$(fnm env --use-on-cd --shell bash)"
# starship
command -v starship >/dev/null && eval "$(starship init bash)"
# thefuck - lazy load
fuck() {
unset -f fuck
eval "$(thefuck --alias)"
fuck "$@"
}
# fzf
command -v fzf >/dev/null && eval "$(fzf --bash)"
# zoxide
command -v zoxide >/dev/null && eval "$(zoxide init --cmd cd bash)"
# atuin
if command -v atuin >/dev/null; then
if [[ ${BLE_VERSION-} ]]; then
eval "$(atuin init bash --disable-up-arrow)"
ble-bind -x 'C-r' '__atuin_history'
else
eval "$(atuin init bash)"
fi
fi
# ble.sh attach
[[ ! ${BLE_VERSION-} ]] || ble-attach
サービスとネットワーク#
Podman socket#
systemctl --user enable --now podman.socket
SSH#
sudo systemctl enable --now ssh
UFW#
sudo ufw default deny incoming && \
sudo ufw default allow outgoing && \
sudo ufw allow OpenSSH && \
sudo ufw allow kdeconnect && \
sudo ufw enable
ゲーム#
Eden#
Eden(Nintendo Switchエミュレータ)のAppImageをダウンロードして、Gear Leverで管理。amd64 PGOビルドが一番速い。
Sonic Unleashed Recompiled#
Unleashed Recompiled からFlatpakをダウンロードしてインストール。Sonic UnleashedのXbox 360版ゲームファイル(USまたはEU)とタイトルアップデートが必要。DLCはオプションだけど強く推奨(高品質ライティング付き)。
wget -O /tmp/UnleashedRecomp-Flatpak.zip \
https://github.com/hedge-dev/UnleashedRecomp/releases/latest/download/UnleashedRecomp-Flatpak.zip && \
unzip -o /tmp/UnleashedRecomp-Flatpak.zip -d /tmp/UnleashedRecomp && \
flatpak install /tmp/UnleashedRecomp/*.flatpak && \
rm -rf /tmp/UnleashedRecomp /tmp/UnleashedRecomp-Flatpak.zip
Steam#
- Steam Playを有効化
- ゲームごとの起動オプション:
gamemoderun %command%
- ProtonPlusでProton-CachyOSかProton-GEを入れる
Half-Life / Portal / Counter-Strike#
-vulkan -novid -fullscreen
Sonic Adventure#
Linux上でSonic Adventure DXとSonic Adventure 2のmodを設定するためにAdventure Modsを使う。Steamのインストールを検出し、mod manager、mod、依存関係、プリセット、ベース設定をインストールする。
AppImageをGitHub ReleasesからダウンロードしてGear Leverでインストールする。
GTA IV#
SteamからGrand Theft Auto IV: The Complete Editionをインストールする。
FusionFixをインストール: GTAIV.EFLC.FusionFix.zipをダウンロードして、.exeがあるゲームのルートフォルダに展開する。
Steamの起動オプション:
WINEDLLOVERRIDES="dinput8=n,b" %command%
Git#
git config --global user.name "astrovm"
git config --global user.email "[email protected]"
git config --global init.defaultBranch main
git config --global pull.rebase true
git config --global rebase.autoStash true
git config --global core.autocrlf input
git config --global core.pager batcat
git config --global fetch.prune true
git config --global rerere.enabled true
ssh-keygen -t ed25519 -C "[email protected]"
eval "$(ssh-agent -s)" && \
ssh-add ~/.ssh/id_ed25519 && \
cat ~/.ssh/id_ed25519.pub
公開鍵を https://github.com/settings/ssh に貼る。