[Articles] system Archlinux system installation

This tutorial is a newly installed Linux tutorials, I want to be more detailed look at the B station Home Video Tutorial

ArchLinux installation configuration Manual [System chapter]

This tutorial reference from https://wiki.archlinux.org/index.php/Installation_guide

This tutorial. Writing in 2019.11 9, 2009, please refer to this tutorial based on review time (official website of the installation is not updated, then this tutorial to date)

Mirror update tutorial: 2019.11.01

Author: Huanhao

bilibili: 301 Technology

Reproduced, please indicate the source!

301 Technology

Preparing for Installation

Mirror Download: https://archlinux.org/download/

Linux users have not used, it is recommended to look at Linux

If you are downloading from HTTP Mirror Mirror source, I suggest you check signature: https://wiki.archlinux.org/index.php/GnuPG


Start Live environment

(1) make a boot disk

If you are a Windows user, you can use Rufus to make specific use you can look them Baidu.

If you are a Linux user, you only need to use the dd command, I think you certainly will.

(2) into the Live environment

  • Select the usually press a key intermediary with the Arch installation files on your computer to boot from boot time, usually prompted the splash screen. Different motherboard different keys.

  • When Arch menu appears, select Boot Arch Linux and press Enterinto the installation environment.


Verify that the startup mode (important)

You can list efivars directory to verify that the startup mode:

ls /sys/firmware/efi/efivars

If the directory does not exist, it is possible to BIOS boot or CSM mode, see your motherboard manual.

If the directory exists. The system is activated to UEFI.

Keep in mind that your start-up mode! ! !


Connect Network

Choose one of the connected

  • 1. The cable connector
dhcpcd
  • 2. WiFi connection
wifi-menu
  • 3. ADSL broadband connection
pppoe-setup     #配置
systemctl start adsl    #连接ADSL

Check your network connection

Use the ping check the network connection, if you see is as shown in the way, prove that the network connection is successful

ping www.baidu.com

Ctrl+cYou can end the run command


Update the system time

Use timedatectl ensure that the system time is accurate:

timedatectl set-ntp true

Create partitions

Check the hard disk case

fdisk -l

I can see I have a 30G hard drive size, path /dev/sda, loop0 is a mirror file

Paths are generally hard disk / dev / sda format, if you have other hard drives, more might show a / dev / sdxx, please identify based on its details.

If you have a solid-state hard drive sdamay becomenvme0n1

You can also view the hard drive information lsblk

lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0       7:0    0 476.7M 1 loop /rn/archiso/sfs/airootfs      #iso镜像
sda           8:0    0 465.8G  0 disk   #465.8G的机械硬盘sda 
└─sda1        8:1    0 465.8G  0 part /mnt/home #sda下的第一个分区sda1
sdb           8:16   1  14.6G  0  disk  #16G的启动盘
├─sdb1    8:17    1  588M  0 part  /runarchiso/bootmnt
└─sda2    8:18    1  64M  0  part
nvme0n1     259:0    0 119.2G  0 disk   #119.2G固态硬盘nvme0n1 
├─nvme0n1p1 259:1    0   100G  0 part /mnt  #nme0n1第一个分区nvme0n1p1
└─nvme0n1p2 259:2 0 19.2G   0  part  /mnt/boot/efi  #nme0n1第二个分区nvme0n1p2

Mechanical hard drivesda

SSDnvme0n1


Partitioning scheme

BIOS with MBR
Mount points Partition Partition type The recommended size
/mnt /dev/sda1 Linux remaining space
[SWAP] /dev/sda2 Linux swap More than 512 MiB
UEFI with GPT
Mount points Partition Partition type The recommended size
/mnt/boot /dev/sda1 EFI System Partition 265–512 MiB
/mnt /dev/sda2 Linux x86-64 root (/) remaining space
[SWAP] /dev/sda3 Linux swap More than 512 MiB

Partitioning scheme Interpretation: If you based BIOSmode is activated, you will need to create and mount /bootpartitions.

If you are based UEFImode is activated, then you must create and mount /bootpartitions


Start partition

Until then, I suggest you first look at the following partitions role

/
/home
/boot
swap

Use cfdiskZoning

BIOS选dos,UEFI的选gpt

The following / dev / sdx field represents the path to your hard disk, modify according to their own circumstances

cfdisk /dev/sdx

The following options can be selected by the left and right keys to select Newand Enter

先新建/分区

输入大小然后回车即可创建分区

第一个/dev/sda1就是我们刚刚创建成功的分区

Free space 就是剩余的空间


新建/home分区

需要先把光标移到剩余空间,再新建哦!


新建/boot分区(BIOS启动的不需要)

不需要太大,256M-512M就可以了

注意:/boot分区的建立方式还多一个步骤

选中新建的/boot分区,下面的光标移到Type选项

然后选中EFI System回车即可


新建swap分区

大小一般等于你的运行内存大小

也是和/boot分区差不多,要选择type

选中Linux swap然后回车即可


确认分区

光标移动到write然后回车

输入yes回车确认

选中Quit,回车即可退出cfdisk


查看分区

用lsblk即可,可以看到sda硬盘被分成了4个分区,正是我们刚才分的区

sda1 是我的/分区

sda2 是我的/home分区

sda3 是我的/boot分区

sda4 是我的swap分区

lsblk


格式化分区

当分区建立好了,这些分区都需要使用适当的文件系统进行格式化

注意:请根据自己的分区情况进行对应的格式化,例如我刚刚把sda1作为我的/分区且大小为14G

/

mkfs.ext4 /dev/sda1

/home

mkfs.ext4 /dev/sda2

/boot(BIOS启动的不需要)

mkfs.fat -F32 /dev/sda3

swap

mkswap /dev/sda4
swapon /dev/sda4


挂载分区

/

/分区挂载到/mnt

mount /dev/sda1 /mnt

/home

/mnt下创建/home文件

mkdir /mnt/home

挂载/home分区

mount /dev/sda2 /mnt/home

/boot(BIOS启动的不需要)

/mnt下创建/boot

mkdir /mnt/boot

挂载引导分区

mount /dev/sda3 /mnt/boot


更换镜像源

vim /etc/pacman.d/mirrorlist

按下/键,输入China,进入检索模式,搜到China的字样后回车,蓝色的光标就会出现在China的下面

但是目前显示的这个源我不太想要,按下n键可以跳到下一个China源,正好是我要的清华镜像源

为什么不用科大镜像源?

答:因为不知道是什么原因,每次我安装arch的时候用科大的源会出现连接不到的问题,你也可以找科大的源使用。


然后按下2dd剪切,按下gg回到顶部,按下p粘贴

建议在清华源的下面再加上一条阿里源,以防安装软件的时候出错

Server = http://mirrors.aliyun.com/archlinux/$repo/os/$arch

i进入编辑模式然后输入,按ESC退出编辑模式

按下(也就是Shift + ;),然后输入wq回车,即可保存退出

Snipaste_2019-11-09_18-54-46.png


安装基础软件包

base 软件包并没有包含全部 live 环境中的程序,packages.x86_64 页面包含了它们的差异。需要额外安装:

如果你还想安装其他软件包组比如 base-devel,请将他们的名字添加到 pacstrap 后,并用空格隔开。你也可以在 #Chroot 之后使用 pacman 手动安装软件包或组。

如果你看不懂上面在说什么,那你跟着我运行下面的命令就行了

pacstrap /mnt base linux linux-firmware base-devel vi vim nano dhcpcd

配置系统

Fstab

用以下命令生成 fstab 文件 (用 -U-L 选项设置UUID 或卷标):

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

Change root 到新安装的系统:

arch-chroot /mnt

设置时区

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc

本地化设置

/etc/locale.gen 是一个仅包含注释文档的文本文件。指定您需要的本地化类型,只需移除对应行前面的注释符号()即可,建议选择带 UTF-8 的项:

vim /etc/locale.gen
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8

接着执行 locale-gen 以生成 locale 讯息:

locale-gen

将 LANG=en_US.UTF-8 加入 /etc/locale.conf

vim /etc/locale.conf

设置主机名

xxxxs是你的主机名(自己取个喜欢的名字)

echo "xxxx" >> /etc/hostname

编辑 /etc/hosts文件,添加以下内容(xxxx为你的主机名)

vim /etc/hosts
127.0.0.1    localhost.localdomain    localhost
::1          localhost.localdomain    localhost
127.0.1.1    xxxx.localdomain     xxxx

设置root密码

使用passwd命令为root用户增加密码

passwd 

安装Intel-ucode(非Inter C PU不需要)

pacman -S intel-ucode

如果你的下载出错,可能是网络断开了,那就再连接一次网络即可

安装引导

如果你硬盘上还有别的系统,需要安装 os-prober。如果你的系统在别的硬盘单独引导,则不需要。

pacman -S os-prober

对于 BIOS 系统:

pacman -S grub
grub-install --target=i386-pc /dev/sdX    # sdX 为你的安装硬盘
grub-mkconfig -o /boot/grub/grub.cfg

对于 UEFI 系统:

pacman -S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg


安装网络连接组件

这里我提供两种方案,选一个就行(例如我:无线网络组件)

无线网络组件:

pacman -S iw wpa_supplicant dialog netctl  #无线网络

后面重启系统后可以使用wifi-menu命令连网

有线网络组件: 注意:笔记本用户千万别手欠,觉得自己笔记本也有网线插口就执行以下命令,否则系统安装好,DNS也会无法解析,除非你真的是使用网线方式连的网络

systemctl enable dhcpcd     #进入系统自动连网
systemctl start dhcpcd      #重启后执行此命令启动网络服务

重启

系统到这里就安装完毕了

exit
umount -R /mnt
reboot

恭喜你已经安装完了系统,下一篇是安装桌面的指导

Guess you like

Origin www.cnblogs.com/huanhao/p/archlinuxsystem.html