1. 制作启动盘

  2. 将U盘插入待装主机,设置U盘启动,重启进入系统安装界面

  3. 设置root密码

    root@archiso~ # passwd
  4. 启动允许远程连接

    root@archiso~ # systemctl start sshd
  5. 链接无线网络

    root@archiso~ # wifi-menu
  6. 查看待装主机的IP地址

    root@archiso~ # ip a
  7. 拿出MacBook我们使用远程安装

    macOS:~ hhbsh$ ssh root@192.168.3.8
  8. 更新在线安装源

    在下列文件开头

    root@archiso ~ # vim /etc/pacman.d/mirrorlist

    添加

    Server = http://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
    Server = http://mirrors.zju.edu.cn/archlinux/$repo/os/$arch
  9. 更新

    root@archiso ~ # sudo pacman -Syy
  10. 分区,使用如下命令查看磁盘分区情况

    root@archiso ~ # fdisk -l
  11. 找到待装磁盘符。我这里是 /dev/sda

    Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors
    Disk model: Lenovo SSD SL700
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: 6109DCF3-362D-468B-970C-81967DD0D852
    
    Device        Start       End   Sectors  Size Type
    /dev/sda1      2048      6143      4096    2M BIOS boot
    /dev/sda2      6144    415743    409600  200M Linux filesystem
    /dev/sda3    415744  17192959  16777216    8G Linux filesystem
    /dev/sda4  17192960 250069646 232876687  111G Linux filesystem
  12. 抹除 /dev/sda 磁盘的所有数据

    root@archiso ~ # fdisk /dev/sda
    
    Welcome to fdisk (util-linux 2.33.1).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    
    Command (m for help): p
    Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors
    Disk model: Lenovo SSD SL700
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: 6109DCF3-362D-468B-970C-81967DD0D852
    
    Device        Start       End   Sectors  Size Type
    /dev/sda1      2048      6143      4096    2M BIOS boot
    /dev/sda2      6144    415743    409600  200M Linux filesystem
    /dev/sda3    415744  17192959  16777216    8G Linux filesystem
    /dev/sda4  17192960 250069646 232876687  111G Linux filesystem
    
    Command (m for help): d
    Partition number (1-4, default 4):
    
    Partition 4 has been deleted.
    
    Command (m for help): d
    Partition number (1-3, default 3):
    
    Partition 3 has been deleted.
    
    Command (m for help): d
    Partition number (1,2, default 2):
    
    Partition 2 has been deleted.
    
    Command (m for help): d
    Selected partition 1
    Partition 1 has been deleted.
    
    Command (m for help): d
    No partition is defined yet!
    
    Command (m for help):
    
    Command (m for help): w
    
    The partition table has been altered.
    Calling ioctl() to re-read partition table.
    Syncing disks.
  13. 使用下面命令刷新信息

    root@archiso ~ # partprobe
  14. 重启机器

    root@archiso ~ # reboot

    注:当然还是选择U盘启动。选第一个即可。

  15. 在待安装主机重复 3~6 步骤

  16. 然后我们就到MacBook使用远程安装,执行步骤 7。出现下列问题

    macOS:~ hhbsh$ ssh root@192.168.3.8
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
    Someone could be eavesdropping on you right now (man-in-the-middle attack)!
    It is also possible that a host key has just been changed.
    The fingerprint for the ECDSA key sent by the remote host is
    SHA256:kGzwhZIhRjRwXG7UNenF1zhXruVLaOz6MyGCtnAu5Wg.
    Please contact your system administrator.
    Add correct host key in /Users/hhbsh/.ssh/known_hosts to get rid of this message.
    Offending ECDSA key in /Users/hhbsh/.ssh/known_hosts:8
    ECDSA host key for 192.168.3.8 has changed and you have requested strict checking.
    Host key verification failed.
  17. 原因是我们之前链接的ssh协商的 192.168.3.8 该 IP 地址的主机密钥失效。我们在MacBook的 /Users/hhbsh/.ssh/known_hosts 文件内删除 192.168.3.8 相关信息, :wq 保存退出,重新生成密钥即可。

    macOS:~ hhbsh$ vim /Users/hhbsh/.ssh/known_hosts
    macOS:~ hhbsh$ ssh root@192.168.3.8
    The authenticity of host '192.168.3.8 (192.168.3.8)' can't be established.
    ECDSA key fingerprint is SHA256:IhRjRwXG7fsfgUNenF1zhXruVLaOz6MdfgdfGCtnAu5Wg.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '192.168.3.8' (ECDSA) to the list of known hosts.
    root@192.168.3.8's password:
    Last login: Mon Feb  4 05:08:29 2019
    root@archiso ~ #
  18. 我们再来查看 /dev/sda 分区信息。发现与 11 步的信息完全不同了,我们已经擦除了该磁盘数据。

    root@archiso ~ # fdisk -l
    Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors
    Disk model: Lenovo SSD SL700
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: 6109DCF3-362D-468B-970C-81967DD0D852
  19. 创建分区

    1. 首先我们创建一个 2MB 大小的分区 sda1,留着后边我们设定它的标志为 bios_grub
    2. 再创建一个 200MB 的分区 sda2
    3. 再创建一个 8G 的分区 sda3
    4. 余下的空间创建分区 sda4
    root@archiso ~ # fdisk /dev/sda
    
    Welcome to fdisk (util-linux 2.33.1).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    
    Command (m for help): n
    Partition number (1-128, default 1):
    First sector (34-250069646, default 2048):
    Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-250069646, default 250069646): +2M
    
    Created a new partition 1 of type 'Linux filesystem' and of size 2 MiB.
    
    Command (m for help): n
    Partition number (2-128, default 2):
    First sector (6144-250069646, default 6144):
    Last sector, +/-sectors or +/-size{K,M,G,T,P} (6144-250069646, default 250069646): +200M
    
    Created a new partition 2 of type 'Linux filesystem' and of size 200 MiB.
    Partition #2 contains a ext2 signature.
    
    Do you want to remove the signature? [Y]es/[N]o: y
    
    The signature will be removed by a write command.
    
    Command (m for help): n
    Partition number (3-128, default 3):
    First sector (415744-250069646, default 415744):
    Last sector, +/-sectors or +/-size{K,M,G,T,P} (415744-250069646, default 250069646): +8G
    
    Created a new partition 3 of type 'Linux filesystem' and of size 8 GiB.
    Partition #3 contains a swap signature.
    
    Do you want to remove the signature? [Y]es/[N]o: y
    
    The signature will be removed by a write command.
    
    Command (m for help): n
    Partition number (4-128, default 4):
    First sector (17192960-250069646, default 17192960):
    Last sector, +/-sectors or +/-size{K,M,G,T,P} (17192960-250069646, default 250069646):
    
    Created a new partition 4 of type 'Linux filesystem' and of size 111 GiB.
    Partition #4 contains a ext4 signature.
    
    Do you want to remove the signature? [Y]es/[N]o: y
    
    The signature will be removed by a write command.
    
    Command (m for help):
    
    Command (m for help): w
    
    The partition table has been altered.
    Calling ioctl() to re-read partition table.
    Syncing disks.
  20. 格式化分区

    root@archiso ~ # partprobe /dev/sda
    root@archiso ~ # mkfs.ext4 /dev/sda1
    root@archiso ~ # mkfs.ext2 /dev/sda2
    root@archiso ~ # mkswap /dev/sda3
    root@archiso ~ # mkfs.ext4 /dev/sda4
  21. 挂载文件系统

    分区 挂载点
    sda4 /
    sda2 /boot
    sda3 swap
    root@archiso ~ # mount /dev/sda4 /mnt
    root@archiso ~ # mkdir /mnt/boot
    root@archiso ~ # mount /dev/sda2 /mnt/boot
    root@archiso ~ # swapon /dev/sda3
    root@archiso ~ # swapon -a
    root@archiso ~ # swapon -s
    Filename                Type        Size    Used    Priority
    /dev/sda3                               partition   8388604 0   -2
    root@archiso ~ #
  22. 因为我们在步骤 14 有重启过系统,需要再次执行步骤 8,配置源。

  23. 刷新源

    root@archiso ~ # pacman -Syy
  24. 安装基本的 package

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

    注:此步稍费时,去喝杯咖啡~

  25. chroot 环境下的配置:

    root@archiso ~ # arch-chroot /mnt
    [root@archiso /]# pacman -S vim

    注:安装 vim 编辑器,利于编辑(可选择任意你喜欢的编辑器即可)。

    1. 时区、时间配置

      [root@archiso /]# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
      [root@archiso /]# hwclock --systohc
    2. 主机名配置

      [root@archiso /]# vim /etc/hostname
    3. 本地化设置

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

      把 locale.gen 文件内的

      #en_US.UTF-8 UTF-8
      #zh_CN.UTF-8 UTF-8

      前边的注释符号 # 删除,使该语句生效。

      en_US.UTF-8 UTF-8
      zh_CN.UTF-8 UTF-8
    4. 执行下列语句使步骤 3 生效

      [root@archiso /]# locale-gen
    5. 配置 fstab。执行此步骤需要暂时退出 arch-chroot

      [root@archiso /]# exit
      exit
      arch-chroot /mnt  7.39s user 0.86s system 0% cpu 18:25.04 total
      root@archiso ~ # genfstab -U /mnt > /mnt/etc/fstab
      root@archiso ~ # cat /mnt/etc/fstab
      # /dev/sda4
      UUID=cc6af4fb-f72b-47a2-9a41-6e5253bf0167    /           ext4        rw,relatime 0 1
      
      # /dev/sda2
      UUID=bce9b3fa-b6ad-45ad-918f-5b3a46b3a04d    /boot       ext2        rw,relatime,block_validity,barrier,user_xattr,acl   0 2
      
      # /dev/sda3
      UUID=c9b5a804-988b-4a7c-8519-a1e3fe63554c    none        swap        defaults,pri=-2 0 0
      
      root@archiso ~ #
    6. 配置 grub。需要再次进入 arch-chroot

      root@archiso ~ # arch-chroot /mnt
      [root@archiso /]# pacman -S grub
    7. 网络配置

      我们可以安装 networkmanager 包来管理我们的网络:

      [root@archiso /]# pacman -S networkmanager

      启用 NetworkManager

      [root@archiso /]# sudo systemctl enable NetworkManager
      [root@archiso /]# sudo systemctl start NetworkManager
    8. 安装 openssh 并设置为开机启动

      [root@archiso /]# pacman -S openssh
      [root@archiso /]# sudo systemctl enable sshd
      Created symlink /etc/systemd/system/multi-user.target.wants/sshd.service → /usr/lib/systemd/system/sshd.service.
      [root@archiso /]# sudo systemctl start sshd
      Running in chroot, ignoring request: start
    9. 用户及权限配置

      1. 设置 root 用户密码

        [root@archiso /]# passwd
        New password:
        Retype new password:
        passwd: password updated successfully
      2. 配置 sudoers 文件

        [root@archiso /]# vim /etc/sudoers

        # %wheel ALL=(ALL) NOPASSWD: ALL 语句前边的注释符 # 删掉,:wq! 强制保存退出。

      3. 添加一个与 root 同一个组的用户,并给该用户创建密码

        [root@archiso /]# useradd -m -G wheel eric
        [root@archiso /]# id eric
        uid=1000(eric) gid=1000(eric) groups=1000(eric),998(wheel)
        [root@archiso /]# passwd eric
        New password:
        Retype new password:
        passwd: password updated successfully
        [root@archiso /]#
    10. 再次配置 grub

      [root@archiso /]# grub-install /dev/sda
      Installing for i386-pc platform.
      grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
      grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
      grub-install: error: will not proceed with blocklists.

      发现执行错误。参考此帖,这里也是解释了为什么步骤 19-1 我们要分配 2M 的分区 /dev/sda1

      执行:

      [root@archiso /]# pacman -S parted
      [root@archiso /]# parted /dev/sda set 1 bios_grub on
      Information: You may need to update /etc/fstab.
      
      [root@archiso /]# parted /dev/sda print
      Model: ATA Lenovo SSD SL700 (scsi)
      Disk /dev/sda: 128GB
      Sector size (logical/physical): 512B/512B
      Partition Table: gpt
      Disk Flags:
      
      Number  Start   End     Size    File system     Name  Flags
      1      1049kB  3146kB  2097kB  ext4                  bios_grub
      2      3146kB  213MB   210MB   ext2
      3      213MB   8803MB  8590MB  linux-swap(v1)
      4      8803MB  128GB   119GB   ext4
      
      [root@archiso /]#

      再次执行下列语句

      [root@archiso /]# grub-install /dev/sda
      Installing for i386-pc platform.
      Installation finished. No error reported.
      [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
      done
      [root@archiso /]#

      成功。

    11. 安装 neofetch

      [root@archiso /]# pacman -S neofetch

      通过下边这条命令我们发现 arch Linux 基本已经安装好了:

      [root@archiso /]# neofetch
                         -`                    root@archiso
                        .o+`                   ------------
                       `ooo/                   OS: Arch Linux x86_64
                      `+oooo:                  Host: IdeaPad Y460 Rev 1.0
                     `+oooooo:                 Kernel: 4.20.6-arch1-1-ARCH
                     -+oooooo+:                Uptime: 2 hours, 9 mins
                   `/:-:++oooo+:               Packages: 186 (pacman)
                  `/++++/+++++++:              Shell: bash 5.0.0
                 `/++++++++++++++:             Terminal: /dev/pts/0
                `/+++ooooooooooooo/`           CPU: Intel i3 M 380 (4) @ 2.533GHz
               ./ooosssso++osssssso+`          GPU: Intel Core Processor
              .oossssso-````/ossssss+`         GPU: NVIDIA GeForce GT 425M
             -osssssso.      :ssssssso.        Memory: 247MiB / 3743MiB
            :osssssss/        osssso+++.
           /ossssssss/        +ssssooo/-
         `/ossssso+/:-        -:/+osssso+-
        `+sso+:-`                 `.-/+oso:
       `++:.                           `-/+/
       .`                                 `/
      
      [root@archiso /]#
    12. 退出 arch-chroot 环境。配置 NetworkManageropenssh 开机自启

      [root@archiso /]# exit
      exit
      arch-chroot /mnt  9.40s user 4.36s system 0% cpu 1:02:26.92 total
      root@archiso ~ # sudo systemctl start NetworkManager
      Failed to start NetworkManager.service: Unit NetworkManager.service not found.
      5 root@archiso ~ # sudo systemctl start sshd                                                      :(
      root@archiso ~ #
    13. 关闭 /mnt 下的所有挂载点,重启计算机

      root@archiso ~ # umount -R /mnt
      root@archiso ~ # reboot

      注:reboot 命令执行会关闭待装主机,主机关机时(重启前)拔下 U 盘。如果没来得及拔掉,直接用物理关机键强制关机,拔下 U 盘,然后开机。

  26. 留作扩充

  27. 参考帖子

    Archlinux安装第一部分

    解决Linux安装过程中不能安装Grub的问题

    以官方Wiki的方式安装ArchLinux

    Arch Linux 怎么安装?

arch Linux(一)的更多相关文章

  1. Arch Linux 安装博通 BCM4360 驱动(Arch Linux, Ubuntu, Debian, Fedora...)

    BCM4360 在2010年9月,博通完全开源的硬件驱动[1].该驱动程序 brcm80211已被列入到自2.6.37之后的内核中.随着2.6.39发布,这些驱动程序已被重新命名为 brcmsmac和 ...

  2. Arch Linux中文乱码解决

    Arch Linux中文乱码解决 1.安装中文字体 pacman -S wqy-zenhei ttf-fireflysung (flash乱码)   ---乱码的原因就是缺少中文字体的支持,下载文泉驿 ...

  3. Arch Linux 简易打包指南

    本文时代久远,请参阅更可靠的:Arch User Repository (简体中文) - 分享和维护软件包 这两天给 Kreogist µ 打 Arch Linux 包,照着 wiki 跟着搞,同时在 ...

  4. Arch Linux sudo: PAM authentication error: Module is unknown [Solved!]

    问题描述: 我的 Arch Linux 已经用了快半年多,由于 Arch Linux 的滚挂问题,我从没有直接升级过系统.软件版本以及库自然落后了一些. 就在我准备需要用到 NFS 时,挂载网络文件系 ...

  5. Arch Linux Installation Guide

    Arch Linux Installation Guide   timedatectl set-ntp true   sed -i '/Score/{/China/!{n;s/^/#/}}' /etc ...

  6. Arch Linux 安装、配置、美化和优化

    国庆假期玩了下Arch Linux,发现这货跟Ubuntu之流相差甚远,甚难调教,而且安裝过程全命令行,会有各种问题,各种知识... --- 安装引导器--- -------------------- ...

  7. 如何在 Arch Linux 的终端里设定 WiFi 网络

    如果你使用的是其他 Linux 发行版 而不是 Arch CLI,那么可能会不习惯在终端里设置 WiFi.尽管整个过程有点简单,不过我还是要讲一下.在这篇文章里,我将带领新手们通过一步步的设置向导,把 ...

  8. Arch Linux 安装记录

    Arch Linux 安装记录 基本上参考wiki上的新手指南,使用arch 2014.6.1 iso安装 设置网络 有线网络 Arch Linux 默认开启DHCP. 静态ip 首先关闭DHCP:s ...

  9. Arch linux安装

    安装archlinux可参考: http://blog.sina.com.cn/s/blog_69e5d8400101bqlj.html http://www.cnblogs.com/mad/p/32 ...

  10. Arch Linux 安装过程

    在VM中装了Arch,由于过程较为曲折,现写博客一篇聊以慰藉. 1.新建虚拟机,将下载好的archlinux-2016.03.01-dual.iso挂到虚拟机设置的CD/DVD 2.进入Arch安装界 ...

随机推荐

  1. 程序员调 Bug 的样子,非常真实

    程序员调 Bug 的样子,非常真实

  2. 使用Sublime Text 3进行Node.js开发

    总体思路: 环境: Win7 64bit Sp1 1.官网下载node.js(我的是8.9.4LTS).注意:偶数开头的是稳定版,奇数开头的是测试版.目前我下的版本,已带npm 下载后直接下一步... ...

  3. DELPHI中完成端口(IOCP)的简单分析(4)

    DELPHI中完成端口(IOCP)的简单分析(4)   在我以前写的文章中,一直说的是如何接收数据.但是对于如何发送数据却一点也没有提到.因为从代码量上来说接收的代码要比发送多很多.今天我就来写一下如 ...

  4. vue 中使用 axios 请求接口,请求会发送两次问题

    在开发项目过程中,发现在使用axios调用接口都会有两个请求,第一个请求时,看不到请求参数,也看不到请求的结果:只有第二次请求时才会有相应的请求参数以及请求结果: 那为甚么会有这么一次额外的请求呢,后 ...

  5. IIC - 【转载】对I2C总线的时钟同步和总线仲裁的深入理解

    对I2C总线的时钟同步和总线仲裁的深入理解 每一个IIC总线器件内部的SDA.SCL引脚电路结构都是一样的,引脚的输出驱动与输入缓冲连在一起.其中输出为漏极开路的场效应管.输入缓冲为一只高输入阻抗的同 ...

  6. 【转载】MDK环境下让STM32用上FreeRTOS v8.1.2和FreeRTOS+Trace v2.6.0全过程

    [转载]https://www.amobbs.com/thread-5601460-1-2.html?_dsign=6a59067b   本人选择使用FreeRTOS的最大原因就是想使用FreeRTO ...

  7. 解决Kettle ETL数据乱码

    首先用insert语句插入一条数据试试是否因为MySQL编码不对引起,如果是MySQL原因,修改MySQL编码即可: 如果不是因为MySQL的编码导致问题,那么在Kettle的表输出中,编辑连接-选项 ...

  8. java框架之SpringBoot(16)-分布式及整合Dubbo

    前言 分布式应用 在分布式系统中,国内常用 Zookeeper + Dubbo 组合,而 SpringBoot 推荐使用 Spring 提供的分布式一站式解决方案 Spring + SpringBoo ...

  9. [摘抄] Bezier曲线、B样条和NURBS

    Bezier曲线.B样条和NURBS,NURBS是Non-Uniform Rational B-Splines的缩写,都是根据控制点来生成曲线的,那么他们有什么区别了?简单来说,就是: Bezier曲 ...

  10. java socket编程实例代码

    1.所谓socket通常也称作"套接字",用于描述IP地址和端口,是一个通信链的句柄.应用程序通常通过"套接字"向网络发出请求或者应答网络请求. 两性话题 两性 ...