
Ubuntu 和 Arch Linux 双启动不像听起来那么容易,然而,我将使这个过程尽可能地简单明了。首先,我们需要安装 Ubuntu,然后安装 Arch Linux,因为配置 Ubuntu grub 更容易实现 Ubuntu 和 Arch Linux 双启动。
Ubuntu 和 Arch Linux 双启动
你需要准备好以下内容:
1、你需要准备你所选择的 Ubuntu 的特色版本,在这个例子中,我将使用 Ubuntu 17.10 ISO 2、两个优盘 3、Windows 或者 Linux 操作系统的 PC 机 4、Arch Linux ISO 5、基于 Windows 的 Rufus 或是基于 Linux 发行版的 etcher 的两款软件中的一种,要根据自己的系统类型来选择哦。
安装 Ubuntu
首先, 利用 Rufus 为 Ubuntu 和 Arch Linux 创建可启动的闪存驱动器。另外,也可以使用 etcher
创建 Ubuntu 和 Arch Linux 的可启动闪存驱动器。

为 Ubuntu 选择 ISO 映像文件,然后选择闪存驱动器,然后单击 Flash!
创建可引导的闪存驱动器。等到它完成,瞧!你的可启动闪存驱动器已经准备好使用了。

打开你的机器并使用载有 Ubuntu 安装媒体的可启动闪存驱动器进行启动。确保引导到 UEFI 或 BIOS 兼容模式,这取决于您所使用的 PC 的类型。我更喜欢使用 UEFI 来构建新的 PC。

在成功启动后,您将看到如上图显示,要求您尝试 Ubuntu 或安装 Ubuntu,选择安装 Ubuntu。
然后检查安装第三方软件的图形和 WiFi 硬件、MP3 和其他媒体。如果你有一个互联网连接,你可以选择在安装 Ubuntu 的时候下载更新,因为它会节省安装时间,并且确保安装的是最新更新。

然后选择点击“Something else”,这样我们就可以对硬盘进行分区,并预留出 Ubuntu 和 Archlinux 的分区以及它们的交换分区的空间。
创建一个交换分区。最好是内存的一半大小。在我的例子中,我有 1 GB 的内存,因此创建一个 512 MB 的交换空间。

然后创建挂载点为 /
的分区,并且点击“Install Now”按钮。

接下来选择你的位置以选择语言和键盘设置。

当安装完成后点击“Restart Now”重启 PC。

移除安装媒介,按下回车继续。

在确认成功安装后,重新启动并利用 Arch Linux 安装媒介引导。
安装 Arch Linux
在引导到 Arch Linux 安装媒体时,您应该看到如下所示的初始屏幕。选择 “Boot Arch Linux(x86_64)”。注意 Arch Linux 更类似于一种 DIY(自我定制)的操作系统。
选择之后,它将打开一个tty1
终端,您将使用它来安装操作系统。

注意:为了成功安装 Arch Linux,您需要一个互联网连接来下载一些必须的系统安装包。所以我们需要检查一下互联网是否运行正常。输入以下命令到终端以检查网络连接。
ping linuxandubuntu.com -c 4

如果互联网运行正常,你应该得到一个回显,显示发送和接收的数据包的数量。在这种情况下,我们发送了 4 个包,并得到了 4 个反馈,这意味着连接是正常的。
如果想在 Arch Linux 中设置 Wifi,请阅读本文以在 Arch Linux 中配置 Wifi。 接下来,我们需要选择之前在安装 Ubuntu 时预留出的空闲分区。
fdisk -l
上面的命令应该显示可用的磁盘分区在哪里。您应该能看到 Ubuntu 分区以及预留的空闲空间。我们将使用 cfdisk
命令进行分区。
cfdisk

执行命令后将看到分区情况。选择其它已分配分区下面的空闲空间。
您需要选择 “New”,然后输入分区大小。

例如,9.3G – G 表示千兆字节。

如下图所示,选择“primary”进行分区

然后选择写分区条目。

然后选择 “Quit”(退出)选项。
fdisk -l
确认修改。

然后使用磁盘分区命令:
mkfs.ext4 /dev/sda3
确保您选择的分区是我们创建的最后一个分区,这样我们就不会破坏 Ubuntu 分区。
然后使用以下命令安装这个分区:
mount /dev/sda3 /mnt

用下面命令创建“home”目录:
mkdir .mnt/home

用以下命令安装“home”目录到这个分区上:
mount /dev/sda3 /mnt/home

现在使用以下命令安装 Archlinux 的基本系统:
pacstrap /mnt base
请确保网络连接正常。
接下来开始下载和配置安装所用时间取决于你的网速。

这一步骤完成后,将完成 Archlinux 基本安装。
Arch Linux 基础系统安装完成后,使用以下命令创建一个 fstab
文件:
genfstab -U /mnt >> /mnt/etc/fstab

在此之后,您需要验证fstab
文件,使用下面命令:
cat /mnt/etc/fstab

配置 Arch Linux 的基础配置
您将需要在安装时配置以下内容:
- 系统语言和系统语言环境
- 系统时区
- Root 用户密码
- 设置主机名
首先,您需要使用以下命令将root
切换为新安装的基础系统用户:
arch-chroot /mnt
1. 系统语言和系统语言环境
然后必须配置系统语言。必须取消对 en_Utf-8 UTF-8的注释,并加载到文件 /etc/local.gen
中。
键入:
nano /etc/local.gen
然后将 en_UTF-8 UTF-8 取消注释。
键入命令:
locale-gen
生成本地化设置如下:

相应的需要在 locale.conf
文件中配置 LANG 变量。例如:
nano /etc/locale.conf
修改为:
LANG=en_US.UTF-8
配置键盘布局,则在文件 vconsole.conf
中进行更改,如下操作:
nano /etc/vconsole.conf
修改为:
KEYMAP=us-eng
2. 系统时区
配置时区需要利用以下命令实现:
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
要查看可用时区,可以在终端使用以下命令:
注意可选时区在屏幕截图中显示为蓝色:
ls /usr/share/zoneinfo


运行 hwclock
命令来生成 /etc/adjtime
(假设硬件时钟被设置为 UTC):
# hwclock --systohc
3. 配置 root 用户密码
要为 Arch Linux 系统用户 root 设置密码,请使用:
passwd
为 root 用户提供一个新的密码并确认密码使其生效。

4. 配置主机名和网络
需要创建主机名文件:
nano /etc/hostname

将名字更改为您的用户名:

然后向主机添加一个匹配的条目:
nano /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
127.0.1.1 LinuxandUbuntu.localdomain LinuxandUbuntu
您需要使网络保持连接,然后使用:
systemctl enable dhcpd
配置 Grub
然后重启机器,进入 Ubuntu 配置 grub。
你可以键入:
reboot

Arch Linux 仍然没有出现,因此我们需要在 Ubuntu 中使用 update-grub
来安装它。

在Ubuntu中打开终端,输入:
sudo update-grub
这将更新 grub,添加 Arch Linux 记录。
小结
祝贺您成功地将 Ubuntu 和 Arch Linux 设置为双引导。Ubuntu 安装很简单,但是 Arch Linux 安装对新的 Linux 用户来说是一个挑战。我试着让这个教程变得简单。但是如果你对这篇文章有任何疑问,请在评论部分告诉我。还可以与您的朋友分享这篇文章,并帮助他们学习 Linux。
via: http://www.linuxandubuntu.com/home/dual-boot-ubuntu-and-arch-linux
作者:LinuxAndUbuntu 译者:stevenzdg988 校对:wxy
发表回复