Arch安装

Arch安装

# Arch安装

基于VirtualBox中的虚拟机进行安装,虚拟机开启了EFI。

# 安装步骤记录

# 阶段一

ls /sys/firmware/efi/efivars

ping archlinux.org

timedatectl set-ntp true

fdisk -l fdisk /dev/sda 注意修改ESP分区为EFI System,LVM分区类型为LVM

lvmdiskscan

pvcreate /dev/sda1 pvdisplay

vgcreate arch_vg /dev/sda1 vgdisplay

lvcreate -L 5G arch_vg -n lvm4root lvcreate -L 500M arch_vg -n lvm4data lvcreate -L 500M arch_vg -n lvm4var lvcreate -L 500M arch_vg -n lvm4home lvcreate -l 100%FREE arch_vg -n lvm4swap lvdisplay

modprobe dm_mod vgscan vgchange -ay

mkfs.fat -F32 /dev/sda1 mkfs.ext4 /dev/mapper/arch_vg-lvm4root mkfs.ext4 /dev/mapper/arch_vg-lvm4data mkfs.ext4 /dev/mapper/arch_vg-lvm4var mkfs.ext4 /dev/mapper/arch_vg-lvm4home mkswap /dev/mapper/arch_vg-lvm4swap swapon /dev/mapper/arch_vg-lvm4swap

lsblk -f

mount /dev/mapper/arch_vg-lvm4root /mnt mkdir /mnt/boot mkdir /mnt/data mkdir /mnt/var mkdir /mnt/home mount /dev/sda1 /mnt/boot mount /dev/mapper/arch_vg-lvm4data /mnt/data mount /dev/mapper/arch_vg-lvm4var /mnt/var mount /dev/mapper/arch_vg-lvm4home /mnt/home

lsblk -f

vim /etc/pacman.d/mirrorlist 此处可修改为阿里云或其它速度较快的源。 pacstrap /mnt base

genfstab -U /mnt >> /mnt/etc/fstab vim /mnt/etc/fstab

arch-chroot /mnt

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

hwclock --systohc

vim /etc/locale.gen locale-gen

vim /etc/locale.conf LANG=en_US.UTF-8

vim /etc/hostname ArchYun

vim /etc/hosts 127.0.0.1 localhost ::1 localhost 127.0.1.1 ArchYun.localdomain ArchYun

/etc/mkinitcpio.conf HOOKS=(base udev ... block lvm2 filesystems) Edit the file and insert lvm2 between block and filesystems.

mkinitcpio -p linux

passwd

pacman -S grub efibootmgr grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch grub-mkconfig -o /boot/grub/grub.cfg pacman -S intel-ucode grub-mkconfig -o /boot/grub/grub.cfg

if use vbox: cp /boot/EFI/Arch/grubx64.efi /boot/EFI/BOOT/BOOTX64.efi

exit umount -R /mnt reboot

# 阶段二

检查是否能够自动开启SWAP分区:输入free,如果swap相关选项不全为0,则成功开启了SWAP。

useradd -m -s /bin/bash devops passwd devops pacman -S sudo

pacman -S --needed base-devel pacman -S git 通过“makepkg -si”,安装AUR中的包

参考资料: