zshroot@archiso ~ # ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host noprefixroute valid_lft forever preferred_lft forever 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 00:0c:29:13:7d:5a brd ff:ff:ff:ff:ff:ff altname enp2s1 inet 192.168.12.135/24 metric 100 brd 192.168.12.255 scope global dynamic ens33 valid_lft 1523sec preferred_lft 1523sec inet6 fe80::20c:29ff:fe13:7d5a/64 scope link proto kernel_ll valid_lft forever preferred_lft forever root@archiso ~ # ping www.baidu.com PING www.baidu.com (198.18.0.124) 56(84) bytes of data. 64 bytes from 198.18.0.124: icmp_seq=1 ttl=128 time=0.778 ms 64 bytes from 198.18.0.124: icmp_seq=2 ttl=128 time=1.10 ms 64 bytes from 198.18.0.124: icmp_seq=3 ttl=128 time=1.30 ms 64 bytes from 198.18.0.124: icmp_seq=4 ttl=128 time=1.04 ms ^C --- www.baidu.com ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3008ms rtt min/avg/max/mdev = 0.778/1.055/1.304/0.187 ms
zshroot@archiso ~ # pacman -Sy net-tools
zshroot@archiso ~ # timedatectl set-ntp true root@archiso ~ # timedatectl status Local time: Thu 2024-05-30 04:20:26 UTC Universal time: Thu 2024-05-30 04:20:26 UTC RTC time: Thu 2024-05-30 04:20:26 Time zone: UTC (UTC, +0000) System clock synchronized: yes NTP service: active RTC in local TZ: no
ls /sys/firmware/efi/efivars
zshroot@archiso ~ # ls /sys/firmware/efi/efivars ls: cannot access '/sys/firmware/efi/efivars': No such file or directory
zshroot@archiso ~ # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 788.9M 1 loop /run/archiso/airootfs sda 8:0 0 40G 0 disk sr0 11:0 1 1.1G 0 rom /run/archiso/bootmnt
提示
如果是UEFI启动请选择gpt,如果是BIOS启动请选择dos
zshroot@archiso ~ # parted /dev/sda GNU Parted 3.6 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) help align-check TYPE N check partition N for TYPE(min|opt) alignment help [COMMAND] print general help, or help on COMMAND mklabel,mktable LABEL-TYPE create a new disklabel (partition table) mkpart PART-TYPE [FS-TYPE] START END make a partition name NUMBER NAME name partition NUMBER as NAME print [devices|free|list,all] display the partition table, or available devices, or free space, or all found partitions quit exit program rescue START END rescue a lost partition near START and END resizepart NUMBER END resize partition NUMBER rm NUMBER delete partition NUMBER select DEVICE choose the device to edit disk_set FLAG STATE change the FLAG on selected device disk_toggle [FLAG] toggle the state of FLAG on selected device set NUMBER FLAG STATE change the FLAG on partition NUMBER toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER type NUMBER TYPE-ID or TYPE-UUID type set TYPE-ID or TYPE-UUID of partition NUMBER unit UNIT set the default unit to UNIT version display the version number and copyright information of GNU Parted (parted) mklabel msdos
root@archiso ~ # cfdisk
zshroot@archiso ~ # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 788.9M 1 loop /run/archiso/airootfs sda 8:0 0 40G 0 disk ├─sda1 8:1 0 8G 0 part └─sda2 8:2 0 32G 0 part sr0 11:0 1 1.1G 0 rom /run/archiso/bootmnt
zshroot@archiso ~ # mkswap /dev/sda1 Setting up swapspace version 1, size = 8 GiB (8589930496 bytes) no label, UUID=403dec77-10b0-4549-a258-29e57803cd32
zshroot@archiso ~ # mkfs.ext4 /dev/sda2 mke2fs 1.47.0 (5-Feb-2023) Creating filesystem with 8388352 4k blocks and 2097152 inodes Filesystem UUID: 3368f08d-2ca8-47c1-823d-8ce569c4f6ed Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
zshroot@archiso ~ # swapon /dev/sda1
zsh32 root@archiso ~ # mount /dev/sda2 /mnt root@archiso ~ # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 788.9M 1 loop /run/archiso/airootfs sda 8:0 0 40G 0 disk ├─sda1 8:1 0 8G 0 part [SWAP] └─sda2 8:2 0 32G 0 part /mnt sr0 11:0 1 1.1G 0 rom /run/archiso/bootmnt root@archiso ~ # df -h Filesystem Size Used Avail Use% Mounted on dev 1.9G 0 1.9G 0% /dev run 1.9G 11M 1.9G 1% /run /dev/sr0 1.1G 1.1G 0 100% /run/archiso/bootmnt cowspace 256M 9.8M 247M 4% /run/archiso/cowspace /dev/loop0 789M 789M 0 100% /run/archiso/airootfs airootfs 256M 9.8M 247M 4% / tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 1.9G 0 1.9G 0% /tmp tmpfs 1.9G 2.6M 1.9G 1% /etc/pacman.d/gnupg tmpfs 389M 8.0K 389M 1% /run/user/0 /dev/sda2 32G 2.1M 30G 1% /mnt
zshroot@archiso ~ # pacstrap /mnt base base-devel linux linux-headers linux-firmware
zshroot@archiso ~ # pacstrap /mnt dhcpcd iwd vim bash-completion
zshroot@archiso ~ # genfstab -U /mnt >> /mnt/etc/fstab root@archiso ~ # cat /mnt/etc/fstab # Static information about the filesystems. # See fstab(5) for details. # <file system> <dir> <type> <options> <dump> <pass> # /dev/sda2 UUID=3368f08d-2ca8-47c1-823d-8ce569c4f6ed / ext4 rw,relatime 0 1 # /dev/sda1 UUID=403dec77-10b0-4549-a258-29e57803cd32 none swap defaults 0 0
zshroot@archiso ~ # arch-chroot /mnt [root@archiso /]#
bash[root@archiso /]# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
bash[root@archiso /]# hwclock --systohc
bash[root@archiso /]# vim /etc/locale.gen
#en_SG.UTF-8 UTF-8
#en_SG ISO-8859-1
en_US.UTF-8 UTF-8
#en_US ISO-8859-1
#en_ZA.UTF-8 UTF-8
#en_ZA ISO-8859-1
#en_ZM UTF-8
bash[root@archiso /]# locale-gen
Generating locales...
en_US.UTF-8... done
Generation complete.
bash[root@archiso /]# locale -a
C
C.utf8
POSIX
en_US.utf8
bash[root@archiso /]# echo LANG=en_US.UTF-8 > /etc/locale.conf
[root@archiso /]# local
bash: local: can only be used in a function
[root@archiso /]# local
local locale locale-gen localectl localedef
[root@archiso /]# locale
LANG=C.UTF-8
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES=
LC_PAPER="C.UTF-8"
LC_NAME="C.UTF-8"
LC_ADDRESS="C.UTF-8"
LC_TELEPHONE="C.UTF-8"
LC_MEASUREMENT="C.UTF-8"
LC_IDENTIFICATION="C.UTF-8"
LC_ALL=
[root@archiso /]# vim /etc/hostname arch01 [root@archiso /]# vim /etc/hosts # Static table lookup for hostnames. # See hosts(5) for details. 127.0.0.1 localhost ::1 localhost 127.0.1.1 arch01
bash# grub是启动引导器,efibootmgr被 grub 脚本用来将启动项写入 NVRAM。
[root@archiso /]# pacman -S grub efibootmgr
[root@archiso /]# grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
,生成grub的配置文件bash[root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
这里出现了警告,按照提示处理一下在grub文件中取消GRUB_DISABLE_OS_PROBER=false注释
bash[root@archiso /]# vim /etc/default/grub
GRUB_DISABLE_OS_PROBER=false
bash[root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
Adding boot menu entry for UEFI Firmware Settings ...
done
zsh[root@archiso /]# exit # 退回安装环境# exit root@archiso ~ # umount -R /mnt # 卸载新分区 root@archiso ~ # reboot # 重启
本文作者:GYC
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!