Skip to content

Instantly share code, notes, and snippets.

@netmarkjp
Created April 1, 2020 00:04
Show Gist options
  • Save netmarkjp/fb00c39a366a0382c4a9c8a6ff9e5585 to your computer and use it in GitHub Desktop.
Save netmarkjp/fb00c39a366a0382c4a9c8a6ff9e5585 to your computer and use it in GitHub Desktop.
install arch example
loadkeys jp106
wpa_passphrase ssid_name passphrase > /etc/wpa_supplicant/wpa_supplicant.conf
# vi /etc/wpa_supplicant/wpa_supplicant.conf
# して scan_ssid=1 を追記
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
dhcpcd wlan0
passwd
systemctl start sshd
root@archiso ~ # fdisk -l
Disk /dev/nvme0n1: 476.96 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: WDC PC SN730 SDBQNTY-512G-1001
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 6C8B4F83-C77D-4EDB-BB25-2A7FA662254E

Device             Start        End   Sectors   Size Type
/dev/nvme0n1p1      2048     534527    532480   260M EFI System
/dev/nvme0n1p2    534528     567295     32768    16M Microsoft reserved
/dev/nvme0n1p3    567296  998166527 997599232 475.7G Microsoft basic data
/dev/nvme0n1p4 998166528 1000214527   2048000  1000M Windows recovery environment


Disk /dev/sda: 7.53 GiB, 8076132352 bytes, 15773696 sectors
Disk model: USB Flash Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3372b9d9

Device     Boot Start     End Sectors  Size Id Type
/dev/sda1  *        0 1333247 1333248  651M  0 Empty
/dev/sda2         164  131235  131072   64M ef EFI (FAT-12/16/32)


Disk /dev/loop0: 534.78 MiB, 560738304 bytes, 1095192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
loadkeys jp106
timedatectl set-ntp true
parted /dev/nvme0n1 mklabel gpt \
    -s mkpart ESP fat32 1MiB 513Mib \
    -s set 1 boot on \
    -s mkpart primary xfs 513Mib 100%
parted /dev/nvme0n1 print all

# /: (/dev/nvme0n1p2) encrypted with dm-crypt
cryptsetup -y -v luksFormat /dev/nvme0n1p2

cryptsetup open /dev/nvme0n1p2 cryptroot

pvcreate /dev/mapper/cryptroot
vgcreate myvol /dev/mapper/cryptroot
lvcreate -L 17GB myvol -n swap
lvcreate -l 100%FREE myvol -n root

mkfs.xfs /dev/mapper/myvol-root
mount -t xfs /dev/mapper/myvol-root /mnt
mkswap /dev/mapper/myvol-swap
swapon /dev/mapper/myvol-swap

# /boot: (/dev/nvme0n1p2)
mkfs.vfat -F32 /dev/nvme0n1p1
mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot

cp -a /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
grep -A 1 --no-group-separator '^## Japan' /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist

pacman -Sy gnupg archlinux-keyring
pacman-key --init
pacman-key --populate archlinux
pacman-key --refresh-keys

pacstrap /mnt linux base base-devel lvm2 openssh dhcpcd linux-firmware wpa_supplicant
genfstab -U /mnt >> /mnt/etc/fstab
cp /etc/wpa_supplicant/wpa_supplicant.conf /mnt/etc/wpa_supplicant/wpa_supplicant.conf
arch-chroot /mnt

ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
hwclock --systohc
sed -i 's/^#en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen
sed -i 's/^#ja_JP.UTF-8/ja_JP.UTF-8/' /etc/locale.gen
locale-gen
cat << EOT > /etc/locale.conf
LANG=ja_JP.UTF-8
LC_ALL=
EOT
echo 'KEYMAP=jp106' > /etc/vconsole.conf
sed -i -E 's/^(HOOKS=.*) block filesystems keyboard (.*)/\1 keyboard keymap block encrypt lvm2 filesystems \2/' /etc/mkinitcpio.conf
mkinitcpio --preset linux

bootctl --path=/boot install
echo "default arch" >> /boot/loader/loader.conf
echo "timeout 5" >> /boot/loader/loader.conf
UUID_CRYPTDEVICE=$(find /dev/disk/by-uuid -lname ../../nvme0n1p2 -printf "%f\n" | head -n 1)
cat << EOT > /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options cryptdevice=UUID=${UUID_CRYPTDEVICE}:cryptroot root=/dev/mapper/myvol-root rw intel_pstate=no_hwp
EOT

exit
umount -R /mnt
reboot
@netmarkjp
Copy link
Author

AURを使うためにyayをインストール(rootではなく普通のユーザで実施)

sudo pacman -S git

# MAKEFLAGS="-j4" ※CPUコア数に合わせる
sudo vim /etc/makepkg.conf

# install yay
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment