# 准备一个4G容量的U盘,在mac之下创建安装盘:
diskutil list
# 如果mac下U盘被识别为设备 /dev/disk2
diskutil unmountDisk /dev/disk2
# 使用rdisk2速度会快一些
sudo dd if=path/to/arch.iso of=/dev/rdisk2 bs=1m
ip link
ip link set wlan0 up
wpa_passphrase "Vincent_wifi" "XXXXXX" >> /tmp/conf
wpa_supplicant -i wlan0 -c /tmp/conf &
# 设置静态IP和默认路由
ip addr add 192.168.77.245/24 dev wlan0
ip route add default via 192.168.77.1
passwd
systemctl start sshd
echo 'Server = http://mirrors.aliyun.com/archlinux/$repo/os/$arch'>/etc/pacman.d/mirrorlist
pacman -Syy
# 查看可用磁盘设备
lsblk
# 选择nvme类型的ssd作为系统盘,简单分成3个分区,boot、EFI和根分区,boot和EFI容量200M即可
# 删除已存在的分区
fdisk /dev/nvme0n1
# 设置分区类型为gpt,并分区
fdisk /dev/nvme0n1
g
# 输入g设置为GPT分区类型,分区步骤略,百度fdisk命令操作
# 分区格式化
mkfs.fat -F32 /dev/nvme0n1p1
mkfs.ext4 /dev/nvme0n1p2
mkfs.ext4 /dev/nvme0n1p3
# 分区挂载
mount /dev/nvme0n1p3 /mnt
mkdir /mnt/boot
mount /dev/nvme0n1p2 /mnt/boot
mkdir /mnt/boot/EFI
mount /dev/nvme0n1p1 /mnt/boot/EFI
pacstrap -i /mnt base base-devel linux linux-firmware \
man vim iw wpa_supplicant netctl dialog openssh git neofetch \
dosfstools grub efibootmgr
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt /bin/bash
echo 'vincent-laptop'>/etc/hostname
cat >>/etc/hosts<<EOF
127.0.0.1 localhost
::1 localhost
127.0.0.1 vincent-laptop
EOF
echo 'nameserver 223.5.5.5'>/etc/resolv.conf
echo 'LANG="en_US.UTF-8"' > /etc/locale.conf
echo -e 'en_US.UTF-8 UTF-8\nzh_CN.UTF-8 UTF-8'>>/etc/locale.gen
locale-gen
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
timedatectl set-ntp true
hwclock --systohc --utc
passwd
useradd -m -g users -s /bin/bash vincent
passwd vincent
sed -i 's/^root ALL=(ALL) ALL/&\nvincent ALL=(ALL) ALL/g' /etc/sudoers
cat >/etc/netctl/wireless-wpa-static<<EOF
Description='manual configure'
Interface=wlp7s0
Connection=wireless
Security=wpa
ESSID='Vincent_wifi'
Key='XXXXXXXX'
IP=static
Address='192.168.77.245/24'
Gateway='192.168.77.1'
DNS=('192.168.77.1')
EOF
netctl enable wireless-wpa-static
systemctl enable sshd
grub-install --target=x86_64-efi --efi-directory=/boot/EFI --recheck
grub-mkconfig -o /boot/grub/grub.cfg
# 非UEFI的虚拟机安装,fdisk时候使用dos格式,grub的安装命令如下
# mkinitcpio -p linux
# grub-install /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg
exit
umount -R /mnt
reboot
# 注意,重启后root远程登陆是被禁止的,使用创建的vincent用户登陆
cat >>/etc/pacman.conf<<\EOF
[archlinuxcn]
Server = https://mirrors.aliyun.com/archlinuxcn/$arch
EOF
cat >/etc/pacman.d/mirrorlist<<\EOF
Server = http://mirrors.aliyun.com/archlinux/$repo/os/$arch
Server = http://mirrors.163.com/archlinux/$repo/os/$arch
Server = http://mirrors.bfsu.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.bfsu.edu.cn/archlinux/$repo/os/$arch
Server = http://mirrors.cqu.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.cqu.edu.cn/archlinux/$repo/os/$arch
Server = http://mirrors.dgut.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.dgut.edu.cn/archlinux/$repo/os/$arch
Server = http://mirror.lzu.edu.cn/archlinux/$repo/os/$arch
Server = http://mirrors.neusoft.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.neusoft.edu.cn/archlinux/$repo/os/$arch
Server = http://mirrors.nju.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.nju.edu.cn/archlinux/$repo/os/$arch
Server = http://mirror.redrock.team/archlinux/$repo/os/$arch
Server = https://mirror.redrock.team/archlinux/$repo/os/$arch
Server = https://mirrors.sjtug.sjtu.edu.cn/archlinux/$repo/os/$arch
Server = http://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
Server = http://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.xjtu.edu.cn/archlinux/$repo/os/$arch
Server = http://mirrors.zju.edu.cn/archlinux/$repo/os/$arch
EOF
pacman -Syyu && pacman -S archlinuxcn-keyring
pacman -S mesa vulkan-intel libva-intel-driver intel-media-driver
pacman -S nvidia bbswitch optimus-manager-qt optimus-manager-qt-kde
# 需要重启生效显卡驱动,安装kde后可以在系统托盘选择默认使用的显卡
reboot
pacman -S xorg xorg-server
pacman -S xf86-input-libinput xf86-input-synaptics
pacman -S sddm sddm-kcm
systemctl enable sddm
pacman -S plasma kde-applications
pacman -S alsa-utils pulseaudio pulseaudio-alsa
pacman -S fcitx fcitx-im fcitx-configtool fcitx-cloudpinyin kcm-fcitx
cat >>/home/vincent/.xprofile<<EOF
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
EOF
pacman -S wqy-zenhei
pacman -S fcitx-qt4
# 需要手动输入y删除几个冲突包
pacman -S yay
yay -S ocs-url
# 注意使用非root用户进行安装
pacman -S variety
variety
# 注意使用非root用户启动,且在电脑上启动或者设置开机启动,不能在远程命令行启动
pacman -S latte-dock
pacman -S nautilus
pacman -S firefox firefox-i18n-zh-cn
yay -S netease-cloud-music
cat >>/etc/pacman.conf<<EOF
[multilib]
Include = /etc/pacman.d/mirrorlist
EOF
pacman -Syu steam steam-native-runtime lib32-nvidia-utils lib32-mesa lib32-mesa-libgl
pacman -S bluez bluez-utils bluedevil
systemctl enable bluetooth
systemctl start bluetooth
pacman -S pulseaudio-bluetooth
pacman -S ntfs-3g
mount -t ntfs-3g /dev/sdb1 /mnt/
pacman -S virtualbox
pacman -S linux-headers
vboxreload
[TOC]