Before
家里有台联想G400老古董,之前装了ubuntu,太卡,这次决定换成arch试试 (也是第一次装,记录一下安装过程)。
arch的逻辑和ubuntu不同,基本什么都要自己动手安装配置,下面从制作启动盘开始介绍:
步骤
下载&制作启动盘
1 2 3 4 5 6 7 8
| wget wget https://geo.mirror.pkgbuild.com/iso/2024.01.01/archlinux-2024.01.01-x86_64.iso wget https://geo.mirror.pkgbuild.com/iso/2024.01.01/b2sums.txt
b2sum -c b2sums.txt
cat path/to/archlinux-version-x86_64.iso > /dev/disk/by-id/usb-My_flash_drive
|
然后插上U盘,切换到主板的引导界面
启动盘系统的配置
从u盘启动后会进入一个shell,这是启动盘的系统,运行在ram,所作的配置重启后会消失。
1 2 3 4 5
| timedatectl set-ntp true timedatectl status
pacman -Sy pacman-mirrorlist
|
硬盘分区&挂载
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| lsblk -l
cfdisk /dev/sda
mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
mount /dev/sda2 /mnt mount --mkdir /dev/sda1 /mnt/boot
pacstrap -K /mnt base linux linux-firmware
genfstab -U /mnt >> /mnt/etc/fstab
|
系统预设
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| arch-chroot /mnt
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc
pacman -S vim grub efibootmgr intel-ucode networkmanager openssh zsh git
vim /etc/locale.gen locale-gen echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "j1900" > /etc/hostname passwd
|
安装引导(GRUB)
1 2 3 4 5 6 7 8 9 10 11 12 13
|
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --removable
vim /etc/default/grub grub-mkconfig -o /boot/grub/grub.cfg
exit umount -R /mnt reboot
|
配置zsh(可选)
1 2 3 4 5 6 7 8 9 10 11 12
| sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
plugins=( zsh-autosuggestions zsh-syntax-highlighting )
|
配置ssh
1 2 3 4 5
| ssh-keygen
cat key.pub > ~/.ssh/authorized_keys
|
注意
- 退出u盘系统后发现启动失败不要慌,插上u盘后重新挂载硬盘,进入启动盘系统操作。
- networkmanager需要提前装好,不然装好的系统没法联网
安装桌面(可选)
1 2 3 4 5 6 7 8 9 10
| pacman -S xorg xorg-xinit gnome
export XDG_SESSION_TYPE=x11 export GDK_BACKEND=x11 exec gnome-session
systemctl enable gdm
startx
|
注意最好不要直接root登陆桌面,新建一个用户
参考
https://wiki.archlinux.org/title/Installation_guide
https://arch.icekylin.online/guide/rookie/basic-install.html