timedatectl set-ntp true && timedatectl set-timezone Europe/Moscow
root@archiso ~ # timedatectl Local time: Tue 2018-08-14 13:42:03 MSK Universal time: Tue 2018-08-14 10:42:03 UTC RTC time: Tue 2018-08-14 10:42:04 Time zone: Europe/Moscow (MSK, +0300) System clock synchronized: yes NTP service: active RTC in local TZ: no
root@archiso ~ # fdisk -l /dev/vda Disk /dev/vda: 15 GiB, 16106127360 bytes, 31457280 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
root@archiso ~ # gdisk /dev/vda GPT fdisk (gdisk) version 1.0.4 Command (? for help): o This option deletes all partitions and creates a new protective MBR. Proceed? (Y/N): y
Command (? for help): n Partition number (1-128, default 1): First sector (34-31457246, default = 2048) or {+-}size{KMGTP}: Last sector (2048-31457246, default = 31457246) or {+-}size{KMGTP}: +512M Current type is 'Linux filesystem' Hex code or GUID (L to show codes, Enter = 8300): <b>EF00</b> Changed type of partition to 'EFI System'
Command (? for help): n Partition number (2-128, default 2): First sector (34-31457246, default = 1050624) or {+-}size{KMGTP}: Last sector (1050624-31457246, default = 31457246) or {+-}size{KMGTP}: <b>Current type is 'Linux filesystem' Hex code or GUID (L to show codes, Enter = 8300): Changed type of partition to 'Linux filesystem'</b>
Command (? for help): w Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!! Do you want to proceed? (Y/N): y OK; writing new GUID partition table (GPT) to /dev/vda. The operation has completed successfully.
root@archiso ~ # mkfs.vfat /dev/vda1 mkfs.fat 4.1 (2017-01-24)
root@archiso ~ # cryptsetup -v luksFormat /dev/vda2 WARNING! ======== This will overwrite data on /dev/vda2 irrevocably. Are you sure? (Type uppercase yes): YES Enter passphrase for /dev/vda2: Verify passphrase: Command successful.
root@archiso ~ # cryptsetup luksOpen /dev/vda2 container Enter passphrase for /dev/vda2:
root@archiso ~ # ls -l /dev/mapper | grep container lrwxrwxrwx 1 root root 7 Aug 14 14:01 container -> ../dm-0
root@archiso ~ # pvcreate /dev/mapper/container Physical volume "/dev/mapper/container" successfully created. root@archiso ~ # vgcreate rootvg /dev/mapper/container Volume group "rootvg" successfully created root@archiso ~ # lvcreate -L1G -n swap rootvg Logical volume "swap" created. root@archiso ~ # lvcreate -L5G -n root rootvg Logical volume "root" created. root@archiso ~ # lvcreate -L2G -n home rootvg Logical volume "home" created. root@archiso ~ # lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert home rootvg -wi-a----- 2.00g root rootvg -wi-a----- 5.00g swap rootvg -wi-a----- 1.00g
root@archiso ~ # mkfs.ext4 -L root /dev/mapper/rootvg-root mke2fs 1.44.3 (10-July-2018) ... Writing superblocks and filesystem accounting information: done [root@archiso ~]# mkfs.ext4 -L home /dev/mapper/rootvg-home mke2fs 1.44.3 (10-July-2018) Creating filesystem with 524288 4k blocks and 131072 inodes ... Writing superblocks and filesystem accounting information: done [root@archiso ~]# mkswap -L swap /dev/mapper/rootvg-swap ... LABEL=swap, UUID=98b0bc31-1c62-4fec-bb97-e1913d1e8cb4
[root@archiso ~]# mount /dev/mapper/rootvg-root /mnt/ [root@archiso ~]# mkdir -p /mnt/{home,boot/efi}
[root@archiso ~]# mount /dev/vda1 /mnt/boot/efi/ [root@archiso ~]# mount /dev/mapper/rootvg-home /mnt/home/ [root@archiso ~]# swapon /dev/mapper/rootvg-swap
[root@archiso ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 462.5M 1 loop /run/archiso/sfs/airootfs sr0 11:0 1 573M 0 rom /run/archiso/bootmnt vda 254:0 0 15G 0 disk ├─vda1 254:1 0 512M 0 part /mnt/boot/efi └─vda2 254:2 0 14.5G 0 part └─container 253:0 0 14.5G 0 crypt ├─rootvg-swap 253:1 0 1G 0 lvm [SWAP] ├─rootvg-root 253:2 0 5G 0 lvm /mnt └─rootvg-home 253:3 0 2G 0 lvm /mnt/home
pacstrap /mnt base base-devel
genfstab -pU /mnt >> /mnt/etc/fstab
[root@archiso ~]# arch-chroot /mnt
ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime && \ hwclock --systohc && \ echo luks-test > /etc/hostname
[root@archiso /]# passwd root New password: Retype new password: passwd: password updated successfully
[root@archiso /]# vi /etc/locale.gen [root@archiso /]# grep -v '^#' /etc/locale.gen en_US ISO-8859-1 en_US.UTF-8 UTF-8 ru_RU.UTF-8 UTF-8 ru_RU ISO-8859-5
[root@archiso /]# locale-gen Generating locales... en_US.ISO-8859-1... done en_US.UTF-8... done ru_RU.UTF-8... done ru_RU.ISO-8859-5... done Generation complete
[root@archiso /]# echo LANG=en_US.UTF-8 > /etc/locale.conf [root@archiso /]# echo KEYMAP=ru > /etc/vconsole.conf [root@archiso /]# echo FOND=cyr-sun16 >> /etc/vconsole.conf
vi /etc/mkinitcpio.conf
HOOKS=(base udev autodetect modconf block keymap encrypt lvm2 resume filesystems keyboard fsck)
[root@archiso /]# mkinitcpio -p linux ==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default' -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img ==> Starting build: 4.17.14-arch1-1-ARCH -> Running build hook: [base] -> Running build hook: [udev] -> Running build hook: [autodetect] -> Running build hook: [modconf] -> Running build hook: [block] -> Running build hook: [keymap] -> Running build hook: [encrypt] -> Running build hook: [lvm2] -> Running build hook: [resume] -> Running build hook: [filesystems] -> Running build hook: [keyboard] -> Running build hook: [fsck] ==> Generating module dependencies ==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img ==> Image generation successful
[root@archiso /]# pacman -S grub dosfstools efibootmgr mtools
vim /etc/default/grub
# Uncomment to enable booting from LUKS encrypted devices GRUB_ENABLE_CRYPTODISK=y
GRUB_CMDLINE_LINUX="cryptdevice=UUID=5ad7c9ad-fb17-4839-925e-479432516c07:container"
[root@archiso /]# blkid | grep vda2 /dev/vda2: UUID="5ad7c9ad-fb17-4839-925e-479432516c07" TYPE="crypto_LUKS" PARTLABEL="Linux filesystem" PARTUUID="667a1243-17ff-4f03-952c-5afd5e3415cc"
[root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg Generating grub configuration file ... WARNING: Failed to connect to lvmetad. Falling back to device scanning. Found linux image: /boot/vmlinuz-linux Found initrd image: /boot/initramfs-linux.img Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img WARNING: Failed to connect to lvmetad. Falling back to device scanning. done
[root@archiso /]# grub-install /dev/vda Installing for x86_64-efi platform. ... Installation finished. No error reported.
echo "container /dev/vda2 none" >> /etc/crypttab
[root@archiso /]# exit exit [root@archiso ~]# reboot Welcome back!
Source: https://habr.com/ru/post/420081/
All Articles