242 lines
No EOL
6.4 KiB
Markdown
242 lines
No EOL
6.4 KiB
Markdown
Arch Installation in usb flash drive
|
|
|
|
Arch Installation for a removable USB flash drive:
|
|
|
|
|
|
-> Installing on a 64-bit UEFI non-CSM system.
|
|
-> using GPT partition style.
|
|
|
|
Requirements:
|
|
|
|
-> A USB flash drive with bootable arch linux installation media.
|
|
-> Another USB where linux is going to be installed, recommended size: 32 GB.
|
|
-> A desktop computer or laptop for installing arch which supports UEFI.
|
|
|
|
Pre-Installation:
|
|
|
|
1. Insert both of the USB flash drive.
|
|
2. Boot from the USB with the arch installation media.
|
|
|
|
Follow along in the next unit for installing arch on the USB flash drive.
|
|
|
|
Installation:
|
|
|
|
1. Connect to the internet either by ethernet or wifi.
|
|
|
|
-> For wifi, use the iwctl utility.
|
|
-> Open it using the 'iwctl' command.
|
|
|
|
root@archiso~# iwctl
|
|
|
|
-> inside it, get the list of all the network devices using the following command.
|
|
|
|
[iwd]# device list
|
|
|
|
-> Use the wireless adapter to get scan and get a list of all the available networks.
|
|
|
|
[iwd]# station <device> scan
|
|
[iwd]# station <device> get-networks
|
|
|
|
-> Connecting to the wireless network.
|
|
|
|
[iwd]# station <device> connect <netowrk_name>
|
|
|
|
-> Enter the passphrase and check for connectivity using the following.
|
|
|
|
[iwd]# station <device> show
|
|
|
|
-> if connected, use the 'exit' command to exit the utility.
|
|
|
|
2. Check you internet connectivity using the following.
|
|
|
|
root@archiso~# ping <URL>
|
|
|
|
3. Update the system clock.
|
|
|
|
root@archiso~# timedatectl set-ntp true
|
|
|
|
4. List all the disks.
|
|
|
|
root@archiso~# lsblk
|
|
|
|
-> disks are in the format of /dev/sd<x>.
|
|
-> Here, recognise the USB drive disk where arch has to be installed.
|
|
|
|
5. Partition the disks.
|
|
|
|
-> Use the gdisk/ fdisk/ cfdisk command for partitioning the disk.
|
|
eg. gdisk /dev/sd<x>
|
|
|
|
-> In this tutorial, I am using 3 partitions for the Linux EFI system, swap and the root.
|
|
-> Here, <x> denotes the disk letter.
|
|
|
|
-> Recommended sizes for partitions:
|
|
|
|
(i) /dev/sd<x>1 -> EFI Partition: 550M
|
|
(ii) /dev/sd<x>2 -> Swap Partition: 2G
|
|
(iii) /dev/sd<x>3 -> Root partition: Any of the left space.
|
|
|
|
6. Format the disks.
|
|
|
|
-> Format the disks using the following commands.
|
|
-> Taking into conideration that the number of paritions is 3 and same as of the above.
|
|
|
|
-> Formating the EFI partition.
|
|
root@archiso~# mkfs.fat -F32 /dev/sd<x>1
|
|
|
|
-> Formating the swap partition.
|
|
root@archiso~# mkswap /dev/sd<x>2
|
|
|
|
-> Formatting the root partition.
|
|
-> Turning off Journaling.
|
|
root@archiso~# mkfs.ext4 -o "^has_journal" /dev/sd<x>3
|
|
|
|
7. Mounting the partitions.
|
|
|
|
-> Mounting swap partition.
|
|
root@archiso~# swapon /dev/sda2
|
|
|
|
-> Mounting the root partition.
|
|
root@archiso~# mount /dev/sd<x>3 /mnt
|
|
|
|
-> Mounting the EFI partition.
|
|
root@archiso~# mkdir -p /mnt/boot/efi
|
|
root@archiso~# mount /dev/sd<x>1 /mnt/boot/efi
|
|
|
|
8. Installing the required packages.
|
|
|
|
-> I am using the vim editor in this tutorial.
|
|
|
|
root@archiso~# pacstrap /mnt base linux linux-firmware vim
|
|
|
|
9. Generating the format style table.
|
|
|
|
root@archiso~# genfstab -U /mnt >> /mnt/etc/fstab
|
|
|
|
-> -U option for using the UUIDs.
|
|
|
|
10. Change root to the mount directory using the 'arch-chroot /mnt' command.
|
|
|
|
11. Set your timezone and sync the harware clock.
|
|
|
|
[root@archiso /]# ln -sf /usr/share/zoneinfo/<region>/<city> /etc/localtime
|
|
|
|
-> Replace <region> and <city> with your region and city.
|
|
eg: ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
|
|
|
|
-> Syncing the harware clock.
|
|
[root@acrhiso /]# hwclock --systohc
|
|
|
|
12. Set your locale.
|
|
|
|
[root@archiso /]# vim /etc/locale.gen
|
|
|
|
-> The above command will open the locale.gen in vim. Here locate your locale, un-comment it and save the file.
|
|
-> I will be using the 'en_US.UTF8' locale throught the tutorial.
|
|
|
|
13. Generate the locale using the 'locale-gen' command.
|
|
|
|
14. Add locale to the locale.conf file.
|
|
|
|
[root@archiso /]# echo "LANG=en_US.UTF-8" > /etc/locale.conf
|
|
|
|
14. Set the host name.
|
|
|
|
[root@archiso /]# echo "ArchUSB" > /etc/hostname
|
|
|
|
-> Replace ArchUSB with your hostname.
|
|
|
|
15. Edit the hosts file.
|
|
|
|
[root@archiso /]# vim /etc/hosts
|
|
|
|
-> The above command will open the hosts file in vim. Here, add the following text (replace the hostname)
|
|
below the comments in the file.
|
|
|
|
"""
|
|
127.0.0.1 localhost
|
|
::1 localhost
|
|
127.0.1.1 ArchUSB.localdomain ArchUSB
|
|
"""
|
|
|
|
-> Save the file and quit.
|
|
|
|
16. Edit the mkinitcpio.conf file.
|
|
|
|
-> As this is a USB flash drive and is going to plugged in more than a single PC, some of the hooks in the
|
|
mkinitcpio.conf file have to be moved ahead in the order for excepting a normal boot on multiple systems.
|
|
|
|
[root@archiso /]# vim /etc/mkinitcpio.conf
|
|
|
|
-> In the file that opens, find the HOOKS variable and move block and keyboard ahead of autodetect as shown below.
|
|
|
|
-> before
|
|
HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block filesystems fsck)
|
|
|
|
-> after
|
|
HOOKS=(base udev block keyboardautodetect modconf kms keymap consolefont filesystems fsck)
|
|
|
|
17. Generate Initramfs using the 'mkinitcpio -P linux' command.
|
|
|
|
18. Add a user and create a password.
|
|
|
|
[root@archiso /]# useradd -mG wheel <user>
|
|
|
|
-> Replace <user> with your username.
|
|
|
|
[root@archiso /]# passwd <user>
|
|
|
|
18. Set a password for root.
|
|
|
|
[root@archiso /]# passwd root
|
|
|
|
19. Install the required packages.
|
|
|
|
[root@archiso /]# pacman -S grub base-devel efibootmgr linux-headers mtools dosfstools reflector networkmanager linux-headers git os-prober nm-connection-editor
|
|
|
|
20. Install grub.
|
|
|
|
[root@archiso /]# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB --removable --recheck
|
|
|
|
21. Generate grub configuration file.
|
|
|
|
[root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg
|
|
|
|
22. Update sudo privileges.
|
|
|
|
[root@archiso /]# editor=vim visudo
|
|
|
|
-> The above command will open the visudo file. Here, un-comment the line matching the one below.
|
|
|
|
"%wheel ALL=(ALL) ALL"
|
|
|
|
-> Save it and exit the file.
|
|
|
|
23. Exit to the archiso using the 'exit' command.
|
|
24. Unmount all the partitions using the 'unmount -a' command.
|
|
25. Reboot the system using the 'reboot' command.
|
|
|
|
26. After rebooting, boot from the USB where arch was installed.
|
|
27. Login into the used which was added in the installation.
|
|
|
|
28. Edit the system journal file.
|
|
|
|
-> This is necessary to make the system know that the journal has to be stored in the RAM instead.
|
|
-> Follow the below command to create and update the journal file.
|
|
|
|
# mkdir /etc/systemd/journal.conf.d
|
|
# vim /etc/systemd/journal.conf.d/usbstick.conf
|
|
|
|
-> In the file that opens, save the text below.
|
|
|
|
"""
|
|
[Journal]
|
|
Storage=volatile
|
|
MaxRuntimeUse=30M
|
|
"""
|
|
|
|
-> MaxRuntimeUse set to 30M as recommended by the ArchWiki.
|
|
|
|
29. So, Arch is now successfully installed on your system.
|
|
|
|
Reached a new milestone: "BTW, I use Arch!" |