Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Arch Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to install Arch Linux", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to install Arch Linux" this article.

Arch Linux is a lightweight, simple distribution, I personally feel that this is the most suitable for novice distribution, it is also very convenient to use, but many people find it troublesome to install. In fact, if everything is very simple, then why do you have to learn? I think a complete Arch Linux installation is also the best opportunity for a novice to get in touch with Linux and give him a basic understanding of Linux. Below I will introduce in detail the installation of the basic system of Arch Linux. (ps. This article focuses on system installation, so burning images and so on will no longer focus on description, but will start directly from the installation.

1. Installation preparation

1.1 enter livecd to start the installation

I am using the UEFI+GPT environment installation, if it is Legacy startup, the display interface will be a little different. This article also focuses only on the installation of UEFI+GPT mode.

1.2 Select the appropriate mirror source

Edit / etc/pacman.d/mirrorlist, move the appropriate mirror source to the first item, and set it as the first choice. The mirror sources of 163, China University of Science and Technology and Tsinghua University are relatively stable. Of course, don't forget to test whether the current network is normal before that.

1.3 create Partition

Because you are using GPT partitions, use gdisk to partition. The command is:

# gdisk / dev/sdx

The sdx here refers to your hard disk name, which may also be nvme0n1 if you use nvme's ssd. Gdisk is used in the same way as fdisk, with "n" to create a new partition, "d" to delete the created partition, "w" to save the configuration, and "p" to view the current partition, as long as you know these four instructions. If you really can't remember the time, you can enter "?" Come to see help.

The specific zoning scheme depends on individual needs. Personally, I recommend that beginners can only be divided into three areas: boot, /, EFI (ps. If it is Legacy+MBR, you can ignore the EFI partition. Here is my zoning plan, for reference only.

1.4 formatting partitions

There are many file system formats, such as ext4, VFAT, BtrFS, F2FS, XFS, ReiserFS and so on. There are more or less differences between each file system, such as ReiserFS has better performance on fragmented file processing lines, XFS has better performance on large files, and so on. For those who are new to Linux, you only need to know a little bit about this, and you don't have to go deep.

To get back to the point, the above is divided into three sections. EFI is formatted into vfat format for compatibility requirements. The command is:

# mkfs.vfat-F32 / dev/sda1

The boot partition is formatted as ext4, and the command is:

# mkfs.ext4 / dev/sda2

Because the capacity of my root directory is small, it is formatted as ReiserFS with the command:

# mkfs.reiserfs / dev/sda3

Note that the above sda1, sda2, sda3 are my personal division, be sure to see their own partition name replacement, do not blindly copy and paste.

1.5 Mount Partition

The partition scheme is: EFI, boot, /. First of all, we need to mount the root directory, which is usually directly mounted under the mnt directory, and then create a boot directory and an EFI directory respectively, and then mount them respectively. The command is as follows:

# mount / dev/sda3 / mnt

# mkdir / mnt/boot

# mount / dev/sda2 / mnt/boot

# mkdir / mnt/boot/EFI

# mount / dev/sda1 / mnt/boot/EFI

This is the introduction and usage command for all file systems.

At this point, all the preparations are complete and the system installation begins below.

2. Installation

The installation is very simple and requires only one command:

# pacstrap / mnt

If you have other software that needs to be installed, you can also add it directly to this command. For example, if you want to use aur, you need to add base-devel. The implementation command is as follows:

# pacstrap-I / mnt base base-devel

Then there is a long wait until the installation is over and the configuration begins.

3. Configure the system

3.1 generate Fstab

Use genfstab to generate the fstab file, with the following command:

# genfstab-U / mnt > > / mnt/etc/fstab

The-U parameter here specifies that each partition is identified by UUID in the file, and can be replaced by the-L parameter if you want to use the volume label to identify the partition.

3.2 Chroot enters the new system

# arch-chroot / mnt / bin/bash

Use this command to enter the new system.

3.3 installation Boot

There are many options for booting, such as systemd-boot, rEFInd, Clover, GRUB, and so on. Due to space constraints, we will only introduce two bootstraps that support UEFI. (ps. Choose one of the two and never install more than one boot. )

3.3.1 GRUB

The first step is to install GRUB and related software.

# pacman-S dosfstools grub efibootmgr

Pacman is the package manager for Arch Linux,-S is the installation parameter, and the three words followed by the parameter are the package name.

# grub-install-target=x86_64-efi-efi-directory=/boot/EFI-bootloader-id=arch_grub-recheck

Grub-install is the GRUB installation command;-- target parameter indicates why the system installs GRUB, now Arch Linux no longer supports 32-bit system maintenance, here only describes the installation mode of efi, so this parameter can be copied;-- efi-directory parameter specifies the installation location;-- bootloader-id parameter specifies the name of this system boot displayed in the boot options, which can be changed according to your preferences.

# grub-mkconfig-o / boot/grub/grub.cfg

Here is more concise, automatic configuration of GRUB.

3.3.2 rEFInd

Install rEFInd first.

# pacman-S refind-efi

# refind-install-usedefault / dev/sda1

The refind-install command is the installation command for refind.-- the usedefault parameter specifies to install with the default configuration, and / dev/sda1 is my installation path. Be sure to fill in the volume label of your efi partition here, and don't copy and paste blindly.

# mkrlconf

This command is used to generate the configuration file for refind, and then edit the generated configuration file / boot/refind_linux.con

Delete other useless items, ": wq" save and exit.

3.4 restart

Enter the exit command to exit chroot mode, and then restart using the reboot command. After rebooting, your own Arch Linux will be displayed in front of you. Of course, this is only the most basic system, and there is some additional installation to work properly.

4. Configuration after installation

4.1 set hostname

# echo myhostname > / etc/hostname

The echo command is similar to printf, outputting the following parameters to the screen; the > symbol overwrites the output to the / etc/hostnam file, which will be created if it doesn't exist.

4.2 set time zone

# ln-s / usr/share/zoneinfo/Asia/Shanghai / etc/localtime

The function of the ln command is to create a connection and-s is to create a soft connection. (ps. If there is anything wrong with the execution of this command, you can delete / etc/localtime directly and then execute it. )

# hwclock-systohc-utc

Set the time standard to UTC.

4.3 Locale

If you want the system to support Chinese, edit / etc/locale.gen comment out the language you want to support, generally speaking, comment out two items: en_US.UTF-8 UTF-8 and zh_CN.UTF-8 UTF-8. (ps. Chinese support here does not mean that tty supports Chinese. )

# locale-gen

This command is used to generate a new localization file after changing the / etc/locale.gen file.

# echo LANG=en_US.UTF-8 > / etc/locale.conf

Set the locale language, but it is not recommended to set Chinese locale here, which will lead to tty garbled.

4.4 create a new user

The command to create a new user is useradd, for example:

# useradd-m dahu

The-m parameter lets the computer create the user's home folder at the same time as the user is created. Dahu is the user name that will be created.

# passwd dahu

Passwd is the command to change the password, followed by the user name to be changed. If it is not followed by the user name, it defaults to the current user. The password of the root account should also be changed after turning on. Root accounts without passwords will not work properly in many places where root permission is needed. (ps. The specific performance is as follows: some operations require a root password but do not support an empty password. )

5. Conclusion

All right, everything has been configured, and then please enjoy your... It seems that the command line alone has nothing to appreciate:-d. If it is used as a desktop computer, it is really not decent to have a desktop. But there are too many desktops in Linux, such as kde, dde, xfce, gnome and so on. You can all try it and choose your favorite. Personal aesthetics are different, so I won't repeat them here. (ps. Lazy people suggest that using gnome,pacman-S gnome,gnome will treat Xserver, gdm, etc., as dependent automatic installation, and gnome is also very useful out of the box and does not require too many additional settings. As for the graphics card driver, it is another big hole:-P, it is recommended to refer to the official wiki entries AMD_Catalyst and NVIDIA.

These are all the contents of the article "how to install Arch Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report