Install ArchLinux on Win10 (BIOS Boot)

This document records the process of tossing arch linux on win10 for the first time

1. Matters needing attention

  • Disk for BIOS boot

Second, the installation process

1. Install the package

2. Disk Preparation

  • The original installed is ubuntu 16.04 LTS, after deleting it, there is 200G left

3. U disk installation

3.1 Enter the Linux system

  • Restart and find the shortcut key of your computer to enter the BIOS (F2, F10, F12, etc. are messy, press and try, it really doesn't work, google it)

  • Select your own U disk as the boot item

  • chooseBoot Arch Linux (x86_64)

  • If all goes well, you will enter a command prompt only interface:

    Arch Linux 4.15.14-1-ARCH(tty1)
    
    archiso login: root (automatic login)
    root@archiso ~ # _

So far, it has successfully entered arch linux

3.2 Check the boot mode

root@archiso ~ # ls /sys/firmware/efi/efivars
ls: cannot access '/sys/firmware/efi/efivars': No such file or directory

The above output indicates booting in BIOS mode, otherwise EFI

3.3 Networking

  • Wired (my laptop has no network cable interface, only wireless = =)

  • wireless

    • I adopted it wifi-menu, just input it directly on the command line, you can open a visual interface, the operation is quite convenient

    • If you want to change the wifi, assuming that the name of the wifi you are currently connected to is stored in, you enter XWIFI (don't tell me you forgot, there will be a = = by default), you can find it in /etc/netctlthis directory, if you don't want it, just deleted, right?

    root@archiso ~ # rm -rf /etc/netctl/XWIFI
    • Network status detection: a necessary tool for scientific Internet access, if google is to help you search, then baidu is to help you detect network status
    root@archiso ~ # ping www.baidu.com

3.4 Update system time

root@archiso ~ # timedatectl set-ntp true

No news is the best news

3.5 (FBI WARNING) Partitioning and Formatting

Be careful with this part

  • View partition status

    root@archiso ~ # fdisk -l
    Disk /dev/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 sectors
    ... ...
    Device            Boot    Start       End     Sectors     Size    Id  Type
    /dev/nvme0n1p1    *       4096    209965055   209960960   100.1G  7 HPFS/NTFS/exFAT
    /dev/nvme0n1p2        209965056   629395455   419430400   200G    7 HPFS/NTFS/exFAT

    /dev/nvme0n1p1It is the boot partition of win10, there is a lot of space after/dev/nvme0n1p2 it , this piece is the unallocated space, used for arch linuxEnd

  • Create boot partition

    BIOS skip

  • Create root partition

    see figure

    • My hard drive is not brand new, so if your hard drive is brand new be sure to refer to the original text to create
    • In addition, it should be noted that if your unallocated space is between two partitions, you must be optimistic about Start and End when entering the start and end sectors, instead of hitting Enter by default!
    • If you have any wrong operation wbefore , you can enter qand exit directly, so that the wrong operation will not be saved. But if you've already typed it in w, figure it out for yourself...
  • Format the partition you just created

    See clearly what your partition is called, don't hit the command when you see it...

    root@archiso ~ # mkfs.ext4 /dev/nvme0n1p3

    md is wrong. . . I haven't figured out the specific reason, it's okay anyway, you don't have anything yet. Go back to win10 and re-format the partition to start. This time I chose to connect /dev/nvme0n1p1and /dev/nvme0n1p2together, but logically this thing has no effect

3.6 Mount partition

See clearly what your partition is called, don't hit the command when you see it...

This is the command for the BIOS boot mode

root@archiso ~ # mount /dev//dev/nvme0n1p3

3.7 Select mirror source

The choice of mirror source needs to be determined according to your own region. I believe that most of the people who read this article are from the PR China region, so we choose the source of Tsinghua University.

root@archiso ~ # vim /etc/pacman.d/mirrorlist
Server = http://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch

:wqsave and exit

3.8 Install the base package

This step is to install the most basic ArchLinux package, which requires networking

root@archiso ~ # pacstrap /mnt base base-devel

no error output

3.9 Configuring fstab

Generate fastabfiles

root@archiso ~ # genfstab -L /mnt >> /mnt/etc/fstab

There is no output in the console, you need to check whether the output file is correct:

root@archiso ~ # cat /mnt/etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/nvme0n1p3 UUID=...
# /dev/nvme0n1p3    /   ext4    rw,relatime,data=ordered    0 1

Be careful to check if your new partition is mounted to the root partition

3.10 Chroot(Change root)

root@archiso ~ # arch-chroot /mnt

This step will give control to the newly installed Linux system, and subsequent operations will be carried out in this system. In addition, if there is a problem with the system in the future, you only need to re-insert the U disk to start, mount the root partition of the system /mnt, and enter this command to enter the system to repair.

After execution, you will find that the terminal becomes like this:

[root@archiso /]#

3.11 Setting the time zone

[root@archiso /]# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@archiso /]# hwclock --systohc

3.12 Follow some prerequisite packages

There is a very powerful package management tool under ArchLinux pacman, the installation command format ispacman -S package_name

[root@archiso /]# pacman -S vim dialog wpa_supplicant ntfs-3g networkmanager

Logically speaking, it's OK to confirm all the way.

3.13 Setting language options

[root@archiso /]# vim /etc/locale.gen

Remove the # in front of the following four languages ​​in the file:

  • en_US.UTF-8 UTF-8
  • zh_CN.UTF-8 UTF-8
  • zh_HK.UTF-8 UTF-8
  • zh_TW.UTF-8 UTF-8

Save and exit, and make it effective:

[root@archiso /]# locale-gen
Generating locales...
  en_US.UTF-8 UTF-8... done
  zh_CN.UTF-8 UTF-8... done
  zh_HK.UTF-8 UTF-8... done
  zh_TW.UTF-8 UTF-8... done

To configure the default language:

[root@archiso /]# vim /etc/locale.conf
1: LANG=en_US.UTF-8

save and exit

3.14 Set the hostname

[root@archiso /]# vim /etc/hostname
1: jasonchan

Enter the host name you want to set in the first line, save and exit. Then edit /etc/hosts:

[root@archiso /]# vim /etc/hosts
127.0.0.1   localhost.localdomain   localhost
::1         localhost.localdomain   localhost
127.0.1.1   jasonchan.localdomain   jasonchan

save and exit

3.15 Set root password

[root@archiso /]# passwd

Just set this by yourself. Note that the # at the beginning of the terminal indicates that the command is executed as root, and the ordinary user identity is $

3.16 Install Intel-ucode (for Intel CPU)

[root@archiso /]# pacman -S intel-ucode

3.17 Install Bootloader (for BIOS boot)

using grub2

  • Install os-prober, which is used with grub to detect existing systems and automatically set boot options

    [root@archiso /]# pacman -S os-prober
  • install grub

    [root@archiso /]# pacman -S grub
  • deploy grub

    Note that the last item is the name of the disk, not the partition name just drawn

    [root@archiso /]# grub-install --target=i386-pc /dev/nvme0n1
    Installing for i386-pc platform.
    Installation finished. No error reported.
  • Generate configuration file

    [root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg
    grub-probe: error: cannot find a GRUB drive for /dev/sda1. Check your device.map.
    Found Windows 10 on /dev/nvme0n1p1

    Reported the above error, it is said that restart and enter this command again, which is true for me, but after restarting, be sure to unplug the U disk, the error reported is /dev/sda1that this partition is on the U disk.

  • Check if the installation is successful

    [root@archiso /]# vim /boot/grub/grub.cfg

    The end of the file can find the partition where win10 is located

    If there are other errors, please refer to here

3.18 Reboot

[root@archiso /]# exit
[root@archiso /]# reboot

3. Configure ArchLinux

1. Necessary configuration

1.1 Connect to the Internet

Note that your current system is not so cheating, you have to manually connect to the Internet every time you turn it on, and even the password has to be re-entered

  • wired

    [root@archiso /]# dhcpcd
  • wireless

    [root@archiso /]# wifi-menu

1.2 Create a swap file

The swap file can temporarily store part of the memory in the swap file when the physical memory is insufficient, preventing the system from completely stopping work due to insufficient memory. In the past, we usually used a single partition as the swap partition, but now it is more recommended to use the swap file, which is more convenient for our management.

[root@archiso /]# fallocate -l 512M /swapfile(分配交换空间)
[root@archiso /]# chmod 600 /swapfile(更改权限)
[root@archiso /]# mkswap /swapfile(设置交换文件)
Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
no label, UUID=...
[root@archiso /]# swapon /swapfile(启用交换文件)
[root@archiso /]# vim /etc/fstab(为交换文件设置入口)

Add a new line at the end/swapfile none swap defaults 0 0

1.3 Create a new user

[root@archiso /]# useradd -m -G wheel jasonchan
  • -m: /homeCreate a folder with the same name as the user name in the directory at the time of creation, which has the following advantages:
    • As long as the home directory remains unchanged, you only need to reinstall the packages after reinstalling the system (they are generally not stored in the home directory), and then all configurations will be read from the home directory.
    • It is possible to change distributions without reconfiguring the environment with the same home directory.
    • After switching users, all settings will be read from the new user's home directory, completely isolating different users' data and software settings.
    • Some well-known configuration files, such as vimthe configuration file ~/.vimrc, can be completely restored as long as you configure it once according to your own usage habits, and Linuxcopy this file to the home directory under another system (such as your server).
  • -G: add the user to a group
  • wheel: group name, why join this group will be explained later
[root@archiso /]# passwd jasonchan

1.4 Install and configure sudo

  • A dress sudo

    [root@archiso /]# pacman -S sudo
  • Placement sudo

    [root@archiso /]# visudo

    sudoA configuration file specially used for editing , which can help to check the format of the file, find # %wheel ALL=(ALL)ALLand remove the # comment, save and exit.

    This step assigns sudopermissions

2. Graphical interface

2.1 Install the graphics card driver

Most computers are Intel's integrated graphics (not integrated graphics, it is recommended to install drivers according to integrated graphics), NVIDIA's independent graphics drivers are not necessary. If the integrated display driver cannot be installed, you can try the independent display

[root@archiso /]# sudo pacman -S xf86-video-intel

2.2 Install Graphics Services

The desktop environment needs the support of graphics services. Here, select open source graphics services xorgand install all its components.

[root@archiso /]# sudo pacman -S xorg

2.3 Install the desktop environment

If you want to choose your own, you can refer to here . This article xfceonly KDE(Plasma)describes and

  1. xfce

    [root@archiso /]# sudo pacman -S xfce4 xfce4-goodies
  2. KDE (Plasma)

    [root@archiso /]# sudo pacman -S plasma kde-applications kde-l10n-zh_cn

You can choose one of the above two, or you can install both, the default is KDE. After the installation, you need to install the desktop manager, which is used here sddm, it can help us log in and select the desktop environment

[root@archiso /]# sudo pacman -S sddm
[root@archiso /]# sudo systemctl enable sddm(开机自动启动)

2.4 Configure the network

It is best to execute it before restarting after installation

The network configuration service we use when there is no graphical interface is that we netctlcan use it after we have a desktop environmentNetworkManager

[root@archiso /]# sudo systemctl disable netctl(禁用 netctl)
[root@archiso /]# sudo systemctl enable NetworkManager(启用 NetworkManager)
[root@archiso /]# sudo pacman -S network-manager-applet

At this point, restart the computer, you can choose the graphical interface and user login

Fourth, the custom installation package

# EVERYTHING

Ref

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324618891&siteId=291194637