#author("2022-07-23T04:57:05+09:00","","")
*ノートPC実機にArchLinux投入するメモ [#a6e2e192]

**USBメモリを準備 [#w07987bf]

/dev/sdb になったりするので、sdx とか ISOの XX 部分をよみかえつつ...
 $ sudo dd bs=4M if=archlinux-202X.XX.01-x86_64.iso of=/dev/sdx conv=fsync oflag=direct status=progress

**EFI ブート設定を変更 [#wcb6a636]
ブートプロセスをLegacyにして、それからUSBブートする (UEFIの場合、セキュアブートの絡みで強制的にブート失敗する)

**ブート [#fe5fccad]

root で自動ログインするため、ここから設定を叩く。

 # loadkeys jp106
 (日本語キーボードにする)
 # systemctl enable iwd
 # systemctl start iwd
 # iwctl
 [iwd]# device list
 [iwd]# station wlan0 get-access-points
 [iwd]# station wlan0 connect SSID
 [iwd]# quit
 
 # ping www.google.co.jp
 (ping 確認)
 # ip addr
 (IPアドレス確認)

***ネットワークが通じたら...  [#efcbdf8c]

 # passwd
 (root のパスワード暫定設定)

ここから、ssh でノートPCにつなぎにいく。root/(rootpass) でログイン。[[MBR(暗号化)>Tips/Lin/Arch/InstMBR/Crypted]]を参考に環境構築を開始する。

***パーティションの切り直し [#k5f16550]

Windowsが生きてたら、sda1~sda6までgpt - Windowsで埋まってますが、全部消します。

 # fdisk -l
 # fdisk /dev/sda
 
 Welcome to fdisk (util-linux 2.38).
 Changes will remain in memory only, until you decide to write them.
 Be careful before using the write command.
 
 Command (m for help):o
 Command (m for help): p
 
 Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
 Disk model: TOSHIBA MQ01ABF0
 Units: sectors of 1 * 512 = 512 bytes
 Sector size (logical/physical): 512 bytes / 4096 bytes
 I/O size (minimum/optimal): 4096 bytes / 4096 bytes
 Disklabel type: dos
 Disk identifier: 0xdeadbeef
 
 Command (m for help):n
 Partition type
    p   primary (0 primary, 0 extended, 4 free)
    e   extended (container for logical partitions)
 Select (default p): p
 Partition number (1-4, default 1): 
 First sector (2048-976773167, default 2048):
 Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-976773167, default 976773167): +512M
 
 Created a new partition 1 of type 'Linux' and of size 512 MiB.
 
 Command (m for help): n
 Partition type
    p   primary (1 primary, 0 extended, 3 free)
    e   extended (container for logical partitions)
 Select (default p): p
 Partition number (2-4, default 2):
 First sector (1050624-976773167, default 1050624):
 Last sector, +/-sectors or +/-size{K,M,G,T,P} (1050624-976773167, default 976773167): +400G
 
 Created a new partition 2 of type 'Linux' and of size 400 GiB.
 Command (m for help): n
 Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)
 Select (default p): p
 Partition number (3,4, default 3):
 First sector (839911424-976773167, default 839911424):
 Last sector, +/-sectors or +/-size{K,M,G,T,P} (839911424-976773167, default 976773167): +8G
 
 Created a new partition 3 of type 'Linux' and of size 8 GiB.
 
 Command (m for help): t
 Partition number (1-3, default 3):
 Hex code or alias (type L to list all): 82
 
 Changed type of partition 'Linux' to 'Linux swap / Solaris'.
 
 Command (m for help): n
 Partition type
    p   primary (3 primary, 0 extended, 1 free)
    e   extended (container for logical partitions)
 Select (default e): p
 
 Selected partition 4
 First sector (856688640-976773167, default 856688640):
 Last sector, +/-sectors or +/-size{K,M,G,T,P} (856688640-976773167, default 976773167):
 
 Created a new partition 4 of type 'Linux' and of size 57.3 GiB.
 
 Command (m for help): t
 Partition number (1-4, default 4): 4
 Hex code or alias (type L to list all): 0c
 
 Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.
 
 Command (m for help): a
 Partition number (1-4, default 4): 1
 
 The bootable flag on partition 1 is enabled now.
 
 Command (m for help):p
 Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
 Disk model: TOSHIBA MQ01ABF0
 Units: sectors of 1 * 512 = 512 bytes
 Sector size (logical/physical): 512 bytes / 4096 bytes
 I/O size (minimum/optimal): 4096 bytes / 4096 bytes
 Disklabel type: dos
 Disk identifier: 0xdeadbeef
 
 Device     Boot     Start       End   Sectors  Size Id Type
 /dev/sda1  *         2048   1050623   1048576  512M 83 Linux                 # /boot
 /dev/sda2         1050624 839911423 838860800  400G 83 Linux                 # / (暗号化予定)
 /dev/sda3       839911424 856688639  16777216    8G 82 Linux swap / Solaris  # swap
 /dev/sda4       856688640 976773167 120084528 57.3G  c W95 FAT32 (LBA)       # /dos (FAT32)
 
 Command (m for help): w
 The partition table has been altered.
 Calling ioctl() to re-read partition table.
 Syncing disks.

***時刻系統の調整 [#qe35c0e4]
 # timedatectl set-ntp true
 (NTP同期スタート)
 # timedatectl set-timezone Asia/Tokyo
 (EFI/BIOS時刻を日本時間準拠に)
 # timedatectl status
 (日本時間設定とNTP同期ONの確認)

***ファイルシステム生成 [#t752bb16]

 # mkfs.ext4 /dev/sda1
 # mkfs.vfat -F32 /dev/sda4
 # mkswap /dev/sda3
 # swapon /dev/sda3

 # cryptsetup -v --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 --use-random --verify-passphrase luksFormat /dev/sda2
 WARNING!
 ========
 This will overwrite data on /dev/sda2 irrevocably.
 
 Are you sure? (Type 'yes' in capital letters):
 ( *** YES と「大文字で」入力 *** )
 Enter passphrase for /dev/sda2:
 Verify passphrase:
 Key slot 0 created.
 Command successful.
 
 # cryptsetup open --type luks /dev/sda2 cryptroot
 Enter passphrase for /dev/sda2:
 
 # mkfs.ext4 /dev/mapper/cryptroot
 (sda2 は cryptroot に転写されるのでそこを初期化)
 
 # mount /dev/mapper/cryptroot /mnt
 # mkdir -p /mnt/boot
 # mount /dev/sda1 /mnt/boot
 ( /mnt に暗号化パーティションの雛形をつくる)
 
 #

***基本システムのインストール [#b979a2d5]

 # cd /etc/pacman.d/
 # cp mirrorlist mirrorlist.org
 # reflector | grep .jp > ./mirrorlist
 # nano mirrorlist
 (juniorjpdj.pl 鯖の行を全部削除、.jp ドメインだけにする)
 
 # pacstrap /mnt base linux linux-firmware
 Linux本体を /mnt に放り込むおまじない
 
 # mkdir /mnt/dos
 # mount /dev/sda4 /mnt/dos
 
 # genfstab -U /mnt >>/mnt/etc/fstab

***GRUBの準備 [#p188c689]
 # arch-chroot /mnt
 ルートが /mnt になる
 # passwd
 rootのパスワード登録(締め出し防止)
 # pacman -S iwd systemd dhcpcd
 WiFi関係、systemd、dhcpcdインストール
 # pacman -S grub sudo openssh nano vim bash-completion networkmanager
 Grub等をまとめて投入 ※grub以外は1stCustom の内容先取りしてます。

***GRUBじゅんび [#addead12]
 # nano /etc/default/grub
 ( GRUB_CMDLINE_LINUX  を検索、"" の中に...)
    cryptdevice=/dev/sda2:cryptroot     と追記する
 # nano /etc/mkinitcpio.conf 
  (この行を)
    HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)
  (こういうふうに追記する。block / filesystems のまんなかに encrypt)
    HOOKS=(base udev autodetect modconf block encrypt filesystems keyboard fsck)
 
 # mkinitcpio -p linux
 Image generation successful
 
 # grub-install --target=i386-pc --recheck /dev/sda
 (MBRにgrub登録。ここからは共通)
 # grub-mkconfig -o /boot/grub/grub.cfg
 (grubの設定ファイル書き出し)

***あとしまつ [#n36a3f0e]
 # exit
 (chroot 終了)
 # umount /mnt/boot
 # umount /mnt/dos
 # umount /mnt
 (アンマウント)
 # cryptsetup close cryptroot
 (暗号ディスクのクローズ)
 # reboot


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS