Among the wide variety of GNU/Linux distributions, there is one that combines almost all advantages and disadvantages of these systems (of course, there are more advantages). It’s about Arch Linux. Developers still following their original principle that the system should be as simple and functional as possible.
New GNU/Linux users (and even those who have switched from Ubuntu, Mint, etc.) may consider Arch rather unfriendly and even rude. But the things are not like that. The distribution just communicates with the user in slightly more “smart” language, offering him all power over himself. This is a rather interesting step in studying the operation of the OS “from the inside”. The text describes how to install Arch Linux from USB Flash.
Step 1. Preparing for Arch Linux Installation
If you plan to install the system on a separate disk which is free and empty, then there is no preparatory operations are necessary. In another case, you must allocate disk space specially for the new OS. To do this in Windows 10:
- Open “Disk Management” via keyboard shortcut Win + X;
- Right-click on the desired disk and select “Shrink Volume…”;
- Specify the required value to reduce disk size and click “Shrink”;
Note! You can’t delete information by mistake with this operation. The program ensures against such cases and limits the volume of the sector to be separated so as not to affect available data.
After that, Unallocated section will appear in the list, on which Arch will be installed.
Step 2. Downloading and Verifying the Image
Arch Linux is distributed free of charge on the official website. It offers several download options, including via http.
Use magnet link or get a torrent file; it will be much faster than using http or other.
After downloading, it is considered a good practice to verify the image: whether it is the file (without modifications) that developers signed. This is usually necessary when downloading not from an official site.
To verify the MD5 sum in Windows 10, follow these steps:
- Press Win + X and select “Windows PowerShell”.
- Write this line in terminal:
Get-FileHash FILENAME -Algorithm MD5
where FILENAME is the name of the image with the path to it.
- Compare the value of the Hash field with the MD5 sum indicated on the site (case of letters does not matter). If data matches, everything is fine.
GNU/Linux uses md5sum console utility to verify hash sum.
Step 3. Burning Arch to USB-Flash
The file with the system takes ~600 MB, therefore, almost any flash drive is suitable.
There are several programs for recording an image, but one of them is especially simple and convenient―Etcher. It is cross-platform and allows you to complete the whole procedure in three clicks.
- Get and install the Etcher from the official website.
Also, there is the ability to download a portable version without installing.
- Run the program. Follow the simple instructions provided by the program to burn the image.
Step 4. Booting With USB-Flash
After recording the image, restart the PC. When a computer is at the stage of POST test (at this moment motherboard logo appears or a text prompts you to press function keys), press the Boot Menu key (depending on motherboard, it can be assigned differently). Usually, it is F11 or F12. After that, select a USB-Flash with Arch Linux.
When a start screen appears with a system logo, just press Enter to select the first line.
Step 5. Connecting to the Internet
After 20 seconds, a console with a ZSH shell will appear in front of you. All actions will be executed under superuser, so be careful.
Small distribution’s size means that all necessary components will be taken from the Web. If you are using a cable, run:
DHCP client will be enabled, after that check Internet access with the line:
ping -с4 google.com
4 packages will be sent to the remote server. If they return successfully, this will be written with fixation of return’s time.
If you are using Wi-Fi, launch the utility:
Here, select the desired network and, if necessary, input a password.
Step 6. Choosing a Timezone
To determine and fix the desired timezone, run the following command:
timedatectl set-timezone America/Lima
Change America/Lima up to your region. ZSH will tell you what to do if after set-timezone you’ll press Tab twice. A list of all zones opens. Use arrows and Enter to select the desired zone.
After that, apply the changes:
timedatectl set-ntp true
To fix the time correctly even after reboot, enter:
hwclock --systohc --localtime
Step 7. Partitioning
This Arch Linux installation step is slightly different depending on use of BIOS or UEFI, which will be mentioned below.
To find out which device will be used for the new system, run:
The desired device is /dev/sda. First, run a disk management utility with this device:
- Specify the type of dos markup to create;
- With the arrows select “New” and press Enter.
You must create 2 sections: root and swap. Allocate a user’s folder on a separate section if desired. Here in the VirtualBox, this is not done;
- Enter 27G (formula: SIZE_OF_DISK – SIZE_OF_RAM) for root;
- Next choose “primary”;
- After that, the newly created section will appear. Now we need to indicate that it will be bootable. Select “Bootable” and press Enter. An asterisk appears in the Boot field to confirm this action;
- For the “Free space” section after creation, select the type with ID 82;
- Apply the changes with the “Write” menu item (confirm by entering the word “yes”), and then “Quit”;
- Format the root section:
mkfs.ext4 /dev/sda1 -L root Make swap on another partition: mkswap /dev/sda2 -L swap
FOR UEFI: Here you also must allocate section for a bootloader.
Important! Do not overwrite existing bootloader with Windows 10, otherwise, you won’t be able to start it later. Then just connect the partition with this bootloader and write it in /etc/fstab.
The process differs from the above in the following:
- After launching cfdisk select type gpt;
- First allocate a primary section on 100M and specify the type “EFI System”;
- Next, allocate a root sector (type “Linux filesystem”) and swap (type “Linux swap”) in accordance with the method described above in the “FOR BIOS” section. As a result, disk layout should look something like this:
- Apply the actions and quit from the utility;
- Format the “EFI System” section:
mkfs --type=vfat /dev/sda1
mkfs --type=ext4 /dev/sda2
Note! According to many users, swap isn’t a required section if the PC has a lot of RAM. The fact is that correct cleaning of memory pages occurs due to swap section. And it does not depend on the size of the RAM. Otherwise, there may be malfunctions in a system in the form of freezes.
Step 8. Mounting Partitions
Next, you must connect the new sections to the /tmp directory, then start installing system on them.
mount /dev/sda1 /tmp
mount /dev/sda2 /tmp
Make a folder for the GRUB:
mkdir -p /tmp/efi
Connecting “EFI System” there:
mount /dev/sda1 /tmp/efi
Step 9. Choosing a Server for Downloading Packages
You have no guarantee that servers available for download are located as close to you as possible. Therefore, you must manually change a configuration file, where all available servers are indicated, namely, move the one that you need to the top.
- Edit the file with mirrors:
- Press j (up) and k (down) keys to move to the line where the address of a server closest to you is entered in Server variable (a country is commented out above for convenient search).
- Press d twice to cut a string under a cursor to buffer.
- Press p to paste the cut text before a first server.
- To quit from the editor and save changes to the file, press the key sequence:
And press Enter. A colon is required at first. To quit without writing, run:
Step 10. Installing Basic Packages
Now basic packages are downloaded and installed in the /tmp directory, forming a new system there:
pacstrap /tmp base base-devel
This will take several minutes depending on the server you selected previously.
Step 11. Configuring the OS
After installation, it is necessary to carry out a basic system configuration.
First you must create a fstab file for Arch so that you can write auto-mount disks to it:
genfstab -t UUID /tmp >> /tmp/etc/fstab
Next, go to the directory where our Arch is located:
Writing own name for the PC:
echo “mypc” > /etc/hostname
Tell the file /etc/hosts about the newly created name:
echo -e “127.0.0.1 localhost n::1 localhost n127.0.1.1 mypc.localdomain mypc” >> /etc/hosts
Also, we need to set up time. For this create a soft link to file that defines a time zone in the /etc/localtime directory:
ln -sf /usr/share/zoneinfo/America/Lima /etc/localtime
Step 12. Localization setup
To enable full support for English, you must include the appropriate locale in the /etc/locale.gen file:
To activate the locale, first remove the “#” character in the desired line by placing the cursor on it and pressing the x key once.
Uncomment other locales if necessary. Write and quit from editor with the already known sequence :wq.
Next make the included locales:
It remains to make the locale.conf and LANG variable in there indicating this locale:
echo “LANG=en_US.UTF-8” > /etc/locale.conf
Step 13. Installing Bootloader
Now setup bootloader, which will boot OS after POST test:
pacman -S grub
pacman -S grub efibootmgr
After that, enter this line to setup GRUB to disk used for Arch:
If you encounter an error at this step (not just a warning), add the –force flag before /dev/sda (this often happens when installing in VirtualBox or VMware):
grub-install --force /dev/sda
If using multiple systems on a computer, also enter:
pacman -S os-prober mtools fuse
Next, update GRUB configuration file:
grub-mkconfig -o /boot/grub/grub.cfg
When using a wireless connection, also supply the appropriate utility:
pacman -S dialog wpa_supplicant
Step 14. Finish
Arch has been successfully installed. Before exiting, set a password for superuser, in order to preserve security of the system at least before creating another user. Run the command
You’ll be prompted to enter a new password, then again to confirm. Please note that even asterisks do not appear on screen during password entry.
Now logout from /tmp with the exit command and umount previously attached partitions:
After that, restart the PC and run the disk with installed Arch. Only root user account with the password set earlier will be available to you. After login, start and write Internet-daemon dhcpcd (if you are using cable) in autorun:
systemctl start dhcpcd systemctl enable dhcpcd