This is the 8th day of my participation in the November Gwen Challenge. Check out the event details: The last Gwen Challenge 2021
background
Arch Linux is a Linux distribution based on the x86-64 architecture. The system consists mainly of free and open source software and supports community participation. The system design is guided by the KISS principle (Keep it simple and Stupid), focusing on correct, elegant and minimalist code, expecting users to be willing to understand the operation of the system.
It was originally released in 2002 by Canadian programmer and guitarist Judd Vinet.Unlike other Linux distributions, Arch Linux does not have a complete GUI installation environment where users simply need to go to the next step to install Arch Linux. Instead, Arch Linux uses the traditional character command mode, which requires manual configuration of various system variables to install Arch Linux.
This design pattern certainly raises the bar for those who want to get started with Arch Linux, but its elegant appearance keeps people trying it out.
Let’s try the entire installation.
1. Environment preparation
- Arch Linux ISO image
- System USB flash drive (not required for VM users)
- Burning software
First, the Arch Linux ISO image can be downloaded from the official website, and the burn software can be used with floppy disk or balenaEtcher.This is the following software, ready for the next step.There are already many tutorials on the web, so I won’t go into them again. The key part of this demonstration, in order to facilitate screenshots, I use virtual machine demonstration here, the physical machine operation is the same.
2. Load and start
When booting normally with image, you will see the system startup menu, the first item by default.After a while, you enter the system configuration character interface.
2.1 Setting the Network
If a wired network connection is used, the system automatically obtains the IP address. You can run the following command to view the IP address:
IP a s # Test whether you can access the InternetCopy the code
If you want to use a wireless network connection (not recommended), you can set up a WIFi connection as shown in the figure.Ensure that you can access the Internet properly, because you need to download the software package later.
2.2 Viewing the System Boot Mode
To determine whether the OS boots using traditional BIOS or UEFI, run the following command:
ls /sys/firewall/efi
Copy the code
If I get an error like this, there is no UEFI boot file and it is a traditional BIOS. Distinguishing this is slightly different for later Settings.
2.3 Configuring Time Synchronization
Use the following command to enable time synchronization. If the status is yes (see figure), it is enabled.
# timedatectl set-ntp true
Copy the code
2.4 Creating Disk Partitions
If the system identifies a disk, it is allocated as a block device, such as /dev/sda, /dev/nvme0n1, or /dev/mmcblk0. You can use LSBLK or fdisk to check: for example, I have only one disk, /dev/sda, with 50GB disk space.According to the previous traditional BIOS and UEFI boot different disk partition, you can refer to the following figure.According to the official graphics, traditional BIOS requires two partitions and UEFI requires three. I’m using traditional BIOS to demonstrate that UEFI operates similarly.
# create the first SWAP partition fdisk /dev/sda n p press Enter +1G # create the second root partition n p press Enter w # save the configuration and give all the remaining disk space to the rootCopy the code
This will take care of the disk partition.
2.5 Formatting Partitions
The two partitions created earlier need to be initialized here.
Ext4 /dev/sda2 # Mount /dev/sda2 # mount /dev/sda2 / MNTCopy the code
2.6 Installing Required Software Packages
Install base software package and Linux kernel as well as regular hardware firmware:
# pacstrap /mnt base linux linux-firmware
Copy the code
2.7 Configuring the System
Genfstab -u/MNT > > / MNT/etc/fstab # change root to the newly installed system arch - ln chroot/MNT # set time zone - sf/usr/share/zoneinfo/Asia/Shanghai /etc/localtime hwclock --systohcCopy the code
Install some necessary software packages for your system:
pacman -S vim
pacman -S grub
Copy the code
Change /etc/locale.gen and cancel en_us. utf-8 utF-8
Vim/etc/locale. Gen... En_us. utf-8 UTF-8 # After the change, run the locale-gen commandCopy the code
3. Perform other configurations
Initramfs configuration
mkinitcpio -P
Copy the code
Set the root password, which will be used to officially enter the system.
passwd
Copy the code
4. Add boot
Where /dev/sda is the disk (not the partition) on which GRUB is to be installed, such as /dev/sda, /dev/nvme0n1, or /dev/mmcblk0, not /dev/sda1.
grub-install --target=i386-pc /dev/sda
Copy the code
If UEFI is used, the following configuration is used:
grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id=GRUB
Copy the code
Generate a boot file:
grub-mkconfig -o /boot/grub/grub.cfg
Copy the code
Exit, cancel the mount, and restart the system.
exit
cd / && umount /mnt
reboot
Copy the code
5. Start Arch Linux
When you reboot and see the boot menu, you’re halfway there.When you see the character interface, the installation is successful.
conclusion
Are you using Arch Linux? Welcome to comment. Next, install the GRAPHICAL interface for Arch Linux.