fallrain hat die Gist bearbeitet . Zu Änderung gehen
1 file changed, 30 insertions, 11 deletions
arch-install-btrfs.sh
| @@ -1,29 +1,48 @@ | |||
| 1 | + | #!/bin/bash | |
| 2 | + | ||
| 3 | + | # Variables | |
| 1 | 4 | ESP=/dev/nvme0n1p1 | |
| 2 | 5 | ROOT=/dev/nvme0n1p2 | |
| 3 | 6 | SWAPFILESIZE=2G | |
| 7 | + | # Optimization: Added discard=async for NVMe, removed redundant nodiratime | |
| 8 | + | MOUNT_OPTIONS="noatime,compress=zstd,space_cache=v2,discard=async,ssd" | |
| 4 | 9 | ||
| 5 | - | mkfs.btrfs -L ROOT $ROOT | |
| 10 | + | # 1. Format the partition | |
| 11 | + | mkfs.btrfs -L ROOT $ROOT -f | |
| 6 | 12 | ||
| 13 | + | # 2. Create Flat Subvolume Layout | |
| 7 | 14 | mount $ROOT /mnt | |
| 8 | 15 | btrfs sub create /mnt/@ | |
| 9 | - | btrfs sub create /mnt/@swap | |
| 10 | 16 | btrfs sub create /mnt/@home | |
| 11 | 17 | btrfs sub create /mnt/@pkg | |
| 12 | 18 | btrfs sub create /mnt/@snapshots | |
| 13 | 19 | btrfs sub create /mnt/@vm | |
| 20 | + | btrfs sub create /mnt/@log | |
| 21 | + | btrfs sub create /mnt/@swap | |
| 14 | 22 | umount /mnt | |
| 15 | 23 | ||
| 16 | - | # For configure mount options, see https://btrfs.wiki.kernel.org/index.php/FAQ#Can_I_mount_subvolumes_with_different_mount_options.3F | |
| 17 | - | mount -o noatime,nodiratime,compress=zstd,space_cache=v2,ssd,subvol=@ $ROOT /mnt | |
| 18 | - | mkdir -p /mnt/{boot,home,var/cache/pacman/pkg,.snapshots,btrfs,/var/lib/libvirt} | |
| 19 | - | mount -o noatime,nodiratime,compress=zstd,space_cache=v2,ssd,subvol=@home $ROOT /mnt/home | |
| 20 | - | mount -o noatime,nodiratime,compress=zstd,space_cache=v2,ssd,subvol=@pkg $ROOT /mnt/var/cache/pacman/pkg | |
| 21 | - | mount -o noatime,nodiratime,compress=zstd,space_cache=v2,ssd,subvol=@snapshots $ROOT /mnt/.snapshots | |
| 22 | - | mount -o noatime,nodiratime,compress=zstd,space_cache=v2,ssd,subvol=@vm $ROOT /mnt/var/lib/libvirt | |
| 23 | - | mount -o noatime,nodiratime,compress=zstd,space_cache=v2,ssd,subvolid=5 $ROOT /mnt/btrfs | |
| 24 | + | # 3. Mount Root Subvolume | |
| 25 | + | mount -o $MOUNT_OPTIONS,subvol=@ $ROOT /mnt | |
| 26 | + | ||
| 27 | + | # 4. Create Mount Points | |
| 28 | + | mkdir -p /mnt/{boot,home,var/cache/pacman/pkg,var/log,var/lib/libvirt,.snapshots,btrfs} | |
| 29 | + | ||
| 30 | + | # 5. Mount Other Subvolumes | |
| 31 | + | mount -o $MOUNT_OPTIONS,subvol=@home $ROOT /mnt/home | |
| 32 | + | mount -o $MOUNT_OPTIONS,subvol=@pkg $ROOT /mnt/var/cache/pacman/pkg | |
| 33 | + | mount -o $MOUNT_OPTIONS,subvol=@snapshots $ROOT /mnt/.snapshots | |
| 34 | + | mount -o $MOUNT_OPTIONS,subvol=@log $ROOT /mnt/var/log | |
| 35 | + | mount -o $MOUNT_OPTIONS,subvolid=5 $ROOT /mnt/btrfs | |
| 36 | + | ||
| 37 | + | # 6. Specialized Subvolume Mounting (NoCOW for VMs) | |
| 38 | + | mount -o $MOUNT_OPTIONS,subvol=@vm $ROOT /mnt/var/lib/libvirt | |
| 39 | + | chattr +C /mnt/var/lib/libvirt # Disable Copy-on-Write for VM performance | |
| 40 | + | ||
| 41 | + | # 7. Mount ESP | |
| 24 | 42 | mount $ESP /mnt/boot | |
| 25 | 43 | ||
| 26 | - | # Create swapfile | |
| 44 | + | # 8. Create Swapfile on Btrfs | |
| 45 | + | # btrfs-progs automatically handles NoCOW and compression exclusion for swapfiles | |
| 27 | 46 | btrfs filesystem mkswapfile --size $SWAPFILESIZE --uuid clear /mnt/btrfs/@swap/swapfile | |
| 28 | 47 | swapon /mnt/btrfs/@swap/swapfile | |
| 29 | 48 | ||
fallrain hat die Gist bearbeitet . Zu Änderung gehen
1 file changed, 1 insertion, 34 deletions
after-reboot.sh
| @@ -1,43 +1,10 @@ | |||
| 1 | - | systemctl enable NetworkManager | |
| 2 | 1 | echo "export EDITOR=nvim" >> ~/.bash_profile | |
| 3 | 2 | source ~/.bash_profile | |
| 4 | 3 | useradd -m -G wheel -s /bin/bash frain | |
| 5 | 4 | passwd frain | |
| 6 | 5 | visudo | |
| 7 | - | pacman -S plasma-meta konsole dolphin | |
| 8 | - | systemctl enable sddm | |
| 9 | - | systemctl start sddm | |
| 10 | - | ||
| 11 | - | # Chinese Input Method | |
| 12 | - | sudo pacman -S fcitx5-im | |
| 13 | - | sudo pacman -S fcitx5-chinese-addons | |
| 14 | - | cat << EOF >> /etc/environment | |
| 15 | - | GTK_IM_MODULE=fcitx | |
| 16 | - | QT_IM_MODULE=fcitx | |
| 17 | - | XMODIFIERS=@im=fcitx | |
| 18 | - | SDL_IM_MODULE=fcitx | |
| 19 | - | GLFW_IM_MODULE=ibus | |
| 20 | - | EOF | |
| 21 | - | # use fcitx5-configtool to configure | |
| 22 | - | ||
| 23 | - | cat << EOF >> /etc/pacman.conf | |
| 24 | - | [archlinuxcn] | |
| 25 | - | Server = https://mirror.nju.edu.cn/archlinuxcn/$arch | |
| 26 | - | EOF | |
| 27 | - | sudo pacman-key --lsign-key "[email protected]" | |
| 28 | - | sudo pacman -Sy archlinuxcn-keyring | |
| 29 | 6 | ||
| 30 | 7 | su frain | |
| 31 | 8 | sudo pacman -S chezmoi | |
| 32 | - | sudo pacman -S zsh zsh-completions zsh-syntax-highlighting zsh-autosuggestions zsh-theme-powerlevel10k | |
| 33 | - | sudo pacman -S noto-fonts-cjk ttf-fira-code ttf-fira-sans ttf-nerd-fonts-symbols ttf-twemoji | |
| 34 | - | chezmoi init https://github.com/Richard-Zheng/dotfiles.git | |
| 9 | + | chezmoi init [email protected]:6957efbbba2d7df023d9a849/dotfiles.git | |
| 35 | 10 | chezmoi apply | |
| 36 | - | ||
| 37 | - | sudo pacman -S keyd | |
| 38 | - | sudo cp ~/.config/keyd/* /etc/keyd | |
| 39 | - | sudo systemctl enable keyd | |
| 40 | - | sudo systemctl start keyd | |
| 41 | - | ||
| 42 | - | sudo pacman -S neovim python-neovim xclip paru | |
| 43 | - | paru -S nvim-lazy | |
fallrain hat die Gist bearbeitet . Zu Änderung gehen
1 file changed, 1 insertion
after-reboot.sh
| @@ -18,6 +18,7 @@ XMODIFIERS=@im=fcitx | |||
| 18 | 18 | SDL_IM_MODULE=fcitx | |
| 19 | 19 | GLFW_IM_MODULE=ibus | |
| 20 | 20 | EOF | |
| 21 | + | # use fcitx5-configtool to configure | |
| 21 | 22 | ||
| 22 | 23 | cat << EOF >> /etc/pacman.conf | |
| 23 | 24 | [archlinuxcn] | |
fallrain hat die Gist bearbeitet . Zu Änderung gehen
2 files changed, 12 insertions, 1 deletion
after-reboot.sh
| @@ -28,4 +28,15 @@ sudo pacman -Sy archlinuxcn-keyring | |||
| 28 | 28 | ||
| 29 | 29 | su frain | |
| 30 | 30 | sudo pacman -S chezmoi | |
| 31 | + | sudo pacman -S zsh zsh-completions zsh-syntax-highlighting zsh-autosuggestions zsh-theme-powerlevel10k | |
| 32 | + | sudo pacman -S noto-fonts-cjk ttf-fira-code ttf-fira-sans ttf-nerd-fonts-symbols ttf-twemoji | |
| 31 | 33 | chezmoi init https://github.com/Richard-Zheng/dotfiles.git | |
| 34 | + | chezmoi apply | |
| 35 | + | ||
| 36 | + | sudo pacman -S keyd | |
| 37 | + | sudo cp ~/.config/keyd/* /etc/keyd | |
| 38 | + | sudo systemctl enable keyd | |
| 39 | + | sudo systemctl start keyd | |
| 40 | + | ||
| 41 | + | sudo pacman -S neovim python-neovim xclip paru | |
| 42 | + | paru -S nvim-lazy | |
arch-install-btrfs.sh
| @@ -27,4 +27,4 @@ mount $ESP /mnt/boot | |||
| 27 | 27 | btrfs filesystem mkswapfile --size $SWAPFILESIZE --uuid clear /mnt/btrfs/@swap/swapfile | |
| 28 | 28 | swapon /mnt/btrfs/@swap/swapfile | |
| 29 | 29 | ||
| 30 | - | pacstrap -K /mnt base linux linux-firmware intel-ucode sof-firmware networkmanager man-db man-pages neovim grub efibootmgr zsh | |
| 30 | + | pacstrap -K /mnt base linux linux-firmware intel-ucode sof-firmware networkmanager man-db man-pages neovim grub efibootmgr zsh sudo | |
fallrain hat die Gist bearbeitet . Zu Änderung gehen
1 file changed, 1 insertion, 1 deletion
after-reboot.sh
| @@ -21,7 +21,7 @@ EOF | |||
| 21 | 21 | ||
| 22 | 22 | cat << EOF >> /etc/pacman.conf | |
| 23 | 23 | [archlinuxcn] | |
| 24 | - | Server = http://mirrors.gdut.edu.cn/archlinuxcn/$arch | |
| 24 | + | Server = https://mirror.nju.edu.cn/archlinuxcn/$arch | |
| 25 | 25 | EOF | |
| 26 | 26 | sudo pacman-key --lsign-key "[email protected]" | |
| 27 | 27 | sudo pacman -Sy archlinuxcn-keyring | |
fallrain hat die Gist bearbeitet . Zu Änderung gehen
1 file changed, 4 insertions
arch-install-chroot.sh
| @@ -23,4 +23,8 @@ echo 'LANG=en_US.UTF-8' > /etc/locale.conf | |||
| 23 | 23 | grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB | |
| 24 | 24 | grub-mkconfig -o /boot/grub/grub.cfg | |
| 25 | 25 | ||
| 26 | + | systemctl enable NetworkManager | |
| 27 | + | # enable ssh root login | |
| 28 | + | #sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config | |
| 29 | + | ||
| 26 | 30 | passwd root | |
fallrain hat die Gist bearbeitet . Zu Änderung gehen
1 file changed, 1 insertion, 1 deletion
arch-install-chroot.sh
| @@ -1,7 +1,7 @@ | |||
| 1 | 1 | # Replace hostname with the name for your host | |
| 2 | 2 | export HOST=hostname | |
| 3 | 3 | # Replace Europe/London with your Region/City | |
| 4 | - | export TZ="Europe/London" | |
| 4 | + | export TZ="Asia/Shanghai" | |
| 5 | 5 | ||
| 6 | 6 | echo $HOST > /etc/hostname | |
| 7 | 7 | cat << EOF >> /etc/hosts | |
fallrain hat die Gist bearbeitet . Zu Änderung gehen
1 file changed, 7 insertions
after-reboot.sh
| @@ -19,6 +19,13 @@ SDL_IM_MODULE=fcitx | |||
| 19 | 19 | GLFW_IM_MODULE=ibus | |
| 20 | 20 | EOF | |
| 21 | 21 | ||
| 22 | + | cat << EOF >> /etc/pacman.conf | |
| 23 | + | [archlinuxcn] | |
| 24 | + | Server = http://mirrors.gdut.edu.cn/archlinuxcn/$arch | |
| 25 | + | EOF | |
| 26 | + | sudo pacman-key --lsign-key "[email protected]" | |
| 27 | + | sudo pacman -Sy archlinuxcn-keyring | |
| 28 | + | ||
| 22 | 29 | su frain | |
| 23 | 30 | sudo pacman -S chezmoi | |
| 24 | 31 | chezmoi init https://github.com/Richard-Zheng/dotfiles.git | |
fallrain hat die Gist bearbeitet . Zu Änderung gehen
1 file changed, 3 insertions
after-reboot.sh
| @@ -19,3 +19,6 @@ SDL_IM_MODULE=fcitx | |||
| 19 | 19 | GLFW_IM_MODULE=ibus | |
| 20 | 20 | EOF | |
| 21 | 21 | ||
| 22 | + | su frain | |
| 23 | + | sudo pacman -S chezmoi | |
| 24 | + | chezmoi init https://github.com/Richard-Zheng/dotfiles.git | |
fallrain hat die Gist bearbeitet . Zu Änderung gehen
2 files changed, 26 insertions
after-reboot.sh(Datei erstellt)
| @@ -0,0 +1,21 @@ | |||
| 1 | + | systemctl enable NetworkManager | |
| 2 | + | echo "export EDITOR=nvim" >> ~/.bash_profile | |
| 3 | + | source ~/.bash_profile | |
| 4 | + | useradd -m -G wheel -s /bin/bash frain | |
| 5 | + | passwd frain | |
| 6 | + | visudo | |
| 7 | + | pacman -S plasma-meta konsole dolphin | |
| 8 | + | systemctl enable sddm | |
| 9 | + | systemctl start sddm | |
| 10 | + | ||
| 11 | + | # Chinese Input Method | |
| 12 | + | sudo pacman -S fcitx5-im | |
| 13 | + | sudo pacman -S fcitx5-chinese-addons | |
| 14 | + | cat << EOF >> /etc/environment | |
| 15 | + | GTK_IM_MODULE=fcitx | |
| 16 | + | QT_IM_MODULE=fcitx | |
| 17 | + | XMODIFIERS=@im=fcitx | |
| 18 | + | SDL_IM_MODULE=fcitx | |
| 19 | + | GLFW_IM_MODULE=ibus | |
| 20 | + | EOF | |
| 21 | + | ||
arch-install-chroot.sh
| @@ -19,3 +19,8 @@ echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen | |||
| 19 | 19 | #echo "zh_CN.UTF-8 UTF-8" >> /etc/locale.gen | |
| 20 | 20 | locale-gen | |
| 21 | 21 | echo 'LANG=en_US.UTF-8' > /etc/locale.conf | |
| 22 | + | ||
| 23 | + | grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB | |
| 24 | + | grub-mkconfig -o /boot/grub/grub.cfg | |
| 25 | + | ||
| 26 | + | passwd root | |