Skip to main content

How to install Arch Linux?

What is arch linux?
Arch Linux is a GNU/Linux distribution, which aims at providing the latest stable version of most of the softwares by following a rolling release model. It defines simplicity without adding unnecessary modifications. It is designed to boot on-line, so that you will get the latest version of Arch in any way. If you have already arch installed on your system then you can always upgrade it by using [pacman -Syu] command. When you boot arch Linux from USB it will automatically start DHCPCD and drop a ZSH shell. you can use nano, VIM to modify any file.

Before installation:
- Verify the boot mode [ls /sys/firmware/efi/efivars]
If the directory does not exist then your system might be booted in BIOS or CSM mode, else it is UEFI.
- Connect to Internet:
If Arch did not get any IP address do run [dhcpcd] manually.

- for wireless connectivity:-
[iw dev] to get wireless interface name.
[iw dev INTERFACE link] to get the status of the interface.
[iw dev INTERFACE scan | grep SSID: | sort | uniq] to get all the WIFIs around you.
[wpa_supplicant -i INTERFACE -c ("SSID" "KEY")] to connect the SSID from terminal.
[dhcpcd INTERFACE] to get dhcp started on the interface.

- Update the system clock:
[timedatectl status] to get current status.
[timedatectl set-ntp true] to enable NTP, so that it could update time from internet.

- Preparing disks:
Partitions required: '/', 'swap', 'efi' [for UEFI systems only]
[cfdisk /dev/sda] to start partitioning, then write it and exit.
[mkfs.ext4 /dev/sda1] to formart /dev/sda1 with ext4 assuming sda1 as '/'
[mount /dev/sda1 /mnt] to mount sda1 in /mnt
[mkdir /mnt/boot] [mount /dev/sda2 /mnt/boot] to create boot directory inside mnt and to mount optionally created sda2[efi or boot partition].
## genfstab will later detect mounted file systems and swap space.
[swapon /dev/sda3] to enabling sda3 as swap assuming sda3 as swap partition.

Start installing the OS:
- Installing the base package:
[pacstrap /mnt base] It would install base packages if you want extra packages such as base-devel then
[pacstam /mnt base base-devel] instead of above command
[genfstab -U /mnt >> /mnt/etc/fstab] (Use -U or -L to define UUID or Lables respectively) It is to generate fstab configuration file in the new system.

- Change root into the new system:
[arch-chroot /mnt]

- Setting Timezone:
[ln -sf /usr/share/zoneinfo/REGION/CITY /etc/localtime]

- Locale:
Uncomment the en_US.UTF-8 UTF-8 and other needed  localizations in the /etc/locale.gen using nano or vi
[locale-gen] to generate locale

- Hostname:
[echo HOSTNAME > /etc/hostname] to create hostname file with the name HOSTNAME

- INITRAMFS:
[mkinitcpio -p linux] to create initramfs.
NOTE: Creating a new initramfs is not required as pacstrap has already done this. If you want any special changes then configure mkinitcpio.conf file and recreate initramfs using above command.

- Root password:
[passwd root]

BOOT LOADERS:
In order to boot arch linux, a linux capable bootloader must be installed to Master Boot Record(MBR) or the GUID Partition Table(GPT). It is the first piece of software started by the BIOS or UEFI. It is responsible for loading the kernel with the wanted kernel parameters and initial RAM disk (initramfs) before initiating the boot process.
NOTE:
- Boot loaders only need to support the file systems on which kernel and initramfs reside (the file system of the partition on which /boot is located)
- As GPT is part of the UEFI specification, all UEFI boot loaders support GPT disks. GPT on BIOS systems is possible, using either "hybrid booting", or the new GPT-only protocol. This may cause issues with certaion BIOS implementations.

- GRUB installation:
You should be more careful while installing GRUB, specially when you are dual or triple booting your system.
Arch wiki on GRUB installation
[pacman -S grub-bios] to sync grub-bios
[grub-install /dev/sda] to install the grub. follow above Linux to get appropriate command for your system configuration.
[grub-mkconfig -o /boot/grub/grub.cfg] to generate grub configuration file.

- Generate FSTAB:
[exit] to exit from chroot environment.
[genfstab /mnt >> /mnt/etc/fstab] It would read all your partitions and store in fstab file so that the partitions would be mounted the next time you boot up your Linux.

- Reboot:
Before rebooting unmount /mnt [umount -R /mnt] if error occurs then use fuser command to check the busy processes.

You are all set to use your new Arch Linux.
Enjoy...

Thanks
Ayush

Comments

Popular posts from this blog

What is Master Boot Record (MBR) ?

Master Boot Record is the information stored in the first sector (cylinder 0, head 0) of a disk, which contains primary bootloader, which is a 512 byte image. It contains both program and a partition table. 446 bytes out of 512 bytes contains executable codes and error messages text. Next 64 bytes are partition table. Each table of 16 bytes. That is the reason why in MBR labled disks, maximum 4 partitions can be created (16 * 4 = 64 bytes). Last 2 bytes is for validation check for MBR. The job of the primary boot loader is to find stage-2 or secondary bootloader from the partition table. Then it loads boot record from the device into RAM. MBR content can be extracted by running dd command as a root user. [ dd if=/dev/sda of=/tmp/mbr bs=512 count=1 ] where /dev/sda is our HDD, /tmp/mbr is the destination file where MBR will be extracted to. As MBR is of size 512 byte,  512 block size is mentioned. As it is in binary format, to view this file in ASCII format enter [ od -xa /tmp...

GNU/Linux

WHAT IS LINUX? People often consider Linux as a complete operating system, but technically it is an operating system kernel, which is the part originally developed by Linus Torvalds. WHAT IS GNU/LINUX? Linux is a kernel which makes system hardware usable by providing an interface to the operating system, but only cosidering linux is of no use. We need an operating system with bunch of applications which would use the hardware resources by the help of kernel to get our jobs done. Richard Stallman's free software foundation had created many softwares but what they were missing was the kernel, which Torvald had developed. So they merged to get a complete operational OS, which is known as GNU/Linux today. GNU/Linux is licenced under GNU General Public License(GPL) which allows distribution and sale of possibly modified and unmodified versions of Linux but requires that all those copies be released under the same license and be accompanied by the complete correspoding source co...