在 VirtualBox 安装 Arch Linux 的新手操作指南
Arch Linux VirtualBox
![](/data/attachment/album/202207/16/100738bceesesazv6rsxl4.jpg)


[Arch Linux 在桌面 Linux 世界中非常流行](https://itsfoss.com/why-arch-linux/)。受欢迎的原因之一是 [安装 Arch Linux](https://itsfoss.com/install-arch-linux/) 本身就是一项复杂的任务。


我没有夸大其词。安装 [Ubuntu 或 Debian](https://itsfoss.com/debian-vs-ubuntu/) 比 Arch Linux 容易得多，因为官方没给后者提供图形界面的安装程序。


这时虚拟机就派上用场了。


你可以先在 VirtualBox 中尝试安装 Arch Linux，看看它是否是你想在实际硬件上运行的系统。通过这种方式，你可以在不弄乱当前操作系统的情况下体验 Arch Linux。


在本文，我将一步一步指导你完成一个实用的 Arch Linux 虚拟机的安装过程。


### 在 VirtualBox 上安装 Arch Linux


毫无疑问，你需要先 [在 Linux 上安装 VirtualBox](https://itsfoss.com/install-virtualbox-ubuntu/)（或在 Windows 上）。在 Windows 上，只需访问 Oracle 的网站并下载 VirtualBox。



> 
> **[下载 VirtualBox](https://www.virtualbox.org/wiki/Downloads)**
> 
> 
> 


如果你使用的是 Windows 10 或更高版本，请确保你的系统已启用虚拟化。


完成后，你需要到 [Arch Linux 官方网站](https://archlinux.org/download/) 下载 ISO 文件。你应该找到 [使用 torrent 下载](https://itsfoss.com/best-torrent-ubuntu/) 或直接下载文件的选项。


![](/data/attachment/album/202207/16/100749grt4q6d6gqovwee6.png)


你可以保留 ISO 文件以备不时之需，安装成功后也可以将其删除以 [释放系统上的空间](https://itsfoss.com/free-up-space-ubuntu-linux/)。


现在，让我们开始在 VirtualBox 上安装 Arch Linux 吧。


#### 第一部分 创建虚拟机


**第一步**：首先，你需要在 VirtualBox 中设置一下。启动 VirtualBox 并单击 “<ruby> 新建 <rt>  New </rt></ruby>” 来创建一个虚拟机。


![](/data/attachment/album/202207/16/100750gattbpgtbzaym9f2.png)


注意，你可以使用 “<ruby> 向导模式 <rt>  guided mode </rt></ruby>” 继续创建虚拟机，但使用 “<ruby> 专家模式 <rt>  expert mode </rt></ruby>” 可以一目了然地获得更多选项。


![](/data/attachment/album/202207/16/100751vl9xbxmba1befxg6.png)


因此，我推荐使用专家模式来创建虚拟机。


不用担心，专家模式同样简单，只是多了一些额外的可选项，无需担心其他任何事情。


**第二步**：输入你的虚拟机名称。当你在 “<ruby> 名称 <rt>  Name </rt></ruby>” 字段中输入 “Arch Linux” 时，它会分别自动检测 “<ruby> 类型 <rt>  Type </rt></ruby>” 和 “<ruby> 版本 <rt>  Version </rt></ruby>”。


![](/data/attachment/album/202207/16/100752rjsuhjhjz7ms1cjz.png)


你应该增加内存大小以舒适地使用虚拟机。如果只是用于小型测试，你可以继续使用默认设置。


我在这个例子中分配了 **4 GB 左右的内存**。


另外，请确保在 “<ruby> 硬盘 <rt>  Hard disk </rt></ruby>”选项下选择 “<ruby> 现在创建虚拟硬盘 <rt>  create a virtual hard disk </rt></ruby>”。它应该是默认选项。


现在，继续设置虚拟硬盘大小。


**第三步**：你可以选择虚拟硬盘的存放位置，并根据你的需求调整大小。最小分配大小（8 GB）对于安装系统应该不是问题，但安全起见，你可能得分配至少 10 到 15 GB。


![](/data/attachment/album/202207/16/100753z6hi2hvb21rr31fh.png)


接下来，你需要将硬盘硬盘文件类型选择为 “VDI（VirtualBox Disk Image）” ，将存储选择为 “<ruby> 动态分配 <rt>  Dynamically assigned </rt></ruby>”，如上图所示。


VDI 是虚拟硬盘最常见的硬盘类型。


当你为硬盘存储选择 “<ruby> 动态分配 <rt>  Dynamically allocated </rt></ruby>” 选项时，这意味着存储空间将根据使用情况进行使用。换言之，当创建虚拟机后，并不会立即将这 15 GB 的空间从你的磁盘中锁定。


现在，你所要做的就是点击 “<ruby> 创建 <rt>  Create </rt></ruby>” 来添加虚拟机。


#### 第二部分 添加 ISO 文件以开始安装 Arch Linux


![](/data/attachment/album/202207/16/100754g04747glz86i700c.png)


当虚拟机在左侧列表中出现后，你可以查看其配置并在 “<ruby> 存储 <rt>  Storage </rt></ruby>” 选项下选择 ISO 文件作为磁盘驱动。


你也可以单独前往虚拟机设置以探索更多内容并选择 ISO 文件。


![](/data/attachment/album/202207/16/100755jc6pq9fxpp9ko9q9.png)


为此，你需要导航至虚拟机设置的 “<ruby> 存储 <rt>  Storage </rt></ruby>” 标签页。


![](/data/attachment/album/202207/16/100756o1exfl18er10le0a.png)


在这里，你必须单击 “<ruby> 控制器 <rt>  Controller </rt></ruby>” 下的 “<ruby> 没有盘片 <rt>  Empty </rt></ruby>”，然后继续选择 Arch Linux ISO 文件作为磁盘文件（如上图所示）。


![](/data/attachment/album/202207/16/100757ncytx7xynxqnlxxn.png)


完成选择后，点击 “OK” 以保存设置的变更。


将 ISO 设置为要引导的磁盘时，虚拟机设置应如下所示：


![](/data/attachment/album/202207/16/100758wd111153mih3he36.png)


现在，点击 “<ruby> 启动 <rt>  Start </rt></ruby>” 启动虚拟机并开始安装。


#### 第三部分 使用引导式安装程序安装 Arch Linux


使用 [介绍一个引导式安装程序](https://news.itsfoss.com/arch-linux-easy-install/) 的方法使安装 Arch Linux 变得更容易，也就是说，它为你提供了设置成熟的 Arch Linux 系统所需的所有选项。


因此，在引导式安装程序的帮助下，你不必单独安装桌面环境和其他基本软件包。你所要做的就是按照屏幕上的说明选择适合你的选项。


在本文中，我们将重点介绍引导式安装程序。如果你想自己做，你应该遵循我们的 [Arch 安装指南](https://itsfoss.com/install-arch-linux/)。


继续安装流程，当你启动虚拟机时，将看到以下屏幕：


![](/data/attachment/album/202207/16/100800gow5al3aozlvkiii.png)


第一个选项是理想的处理方式。如果你有特定的要求，可以选择其他选项来启动 Arch Linux。


现在，你应该正在查看一个终端窗口。以下是如何开始：


**第一步**：输入 `archinstall` 以使用引导式安装程序启动安装。


![](/data/attachment/album/202207/16/100801ahk7c7cglk6r6kkg.png)


**第二步**：根据你的要求选择键盘布局，美式布局应该是最常见的选择。简单地输入一个数字即可进行选择，如下图所示（例如，26）：


![](/data/attachment/album/202207/16/100802zuzao2k2o52kddnc.png)


**第三步**：接下来，你需要选择一个区域来下载包。


![](/data/attachment/album/202207/16/100803rhwwie7uxa6vvavi.png)


选择首选地区而不是 “<ruby> 全球 <rt>  Worldwide </rt></ruby>”。这至关重要，因为如果你选择 **全球** 作为你的地区，它会下载许多不必要的包。


**第四步**：选择区域后，它会要求你选择驱动器进行安装。在这个例子中，我们已经创建了一个大约 15 GB 的虚拟驱动器，显示为 `/dev/sda`。


类似的，根据大小检查你创建的驱动器，然后选择该磁盘继续。在这里，我输入 `1` 作为输入；你的可能会有所不同。


![](/data/attachment/album/202207/16/100803p3o7iro04p5dzryk.png)


**第五步**：接下来，你将被询问以下内容：


* 选择文件系统类型
* 加密密码（可选的）
* 主机名
* 创建 root 密码（可选的）
* 创建超级用户
* 选择一个预编程的配置文件


![](/data/attachment/album/202207/16/100804zn7ortbrnlrrntbi.png)


在我的测试中，我选择了 btrfs 作为文件系统，没有设置任何磁盘加密密码。


主机名可随心所欲的设置，但我建议保持简短。


你可以选择创建一个 root 密码，即使不这么做也应该没什么问题。不过，你需要创建一个具有 sudo 权限的超级用户。


我使用 `admin`/`pass` 作为用户名和密码。不过，如果你不想让其他人访问你计算机上的虚拟机，则不应使用易于猜测的密码。


然后，你将看到一个选择配置文件的选项。在这种情况下，我们需要一个成熟的 Arch Linux 桌面。因此，我们通过输入 `0` 来选择 “<ruby> 桌面 <rt>  desktop </rt></ruby>”。


**第六步**：接下来，你将被要求选择桌面环境。我决定使用 KDE。你可以选择任何你喜欢的。


![](/data/attachment/album/202207/16/100805iff9rujg1ffb7jdc.png)


**第七步**：最后，你将被要求选择显卡驱动程序。由于我们是在 VirtualBox 上安装的 Arch Linux，你可以选择选项 4：VMware/VirtualBox，如下图所示：


![](/data/attachment/album/202207/16/100806ff019r8r08rc80rm.png)


你可能还会被要求输入“是（`y`）或否（`n`）”选择 pipewire 而不是 PulseAudio 作为音频服务。选任何一个都应该都可以。


**第八步**：接下来是重要的一步。在这里，如果你需要内核的 LTS 版本，你可以选择使用 “linux-lts”，或者继续使用默认值。


![](/data/attachment/album/202207/16/100807mvuyneyfegnj3g1c.png)


安装程序会提示你输入想安装的软件包。在这里，我们没有任何特殊要求，因此我们将其留空并按回车键跳过。


**第九步**：你将被要求选择所需的网络适配器以启用互联网访问。你必须选择以下选项：


“<ruby> 使用网络管理器来控制和管理你的互联网连接 <rt>  Use network manager to control and manage your internet connection </rt></ruby>”


![](/data/attachment/album/202207/16/100808n7wk55rnnkanryg7.png)


**第十步**：下一步需要定义时区。选择适用于你的时区，或继续使用默认选项。


**第十一步**：完成后，它将显示你选择的大部分选项以供确认。按回车键继续。


![](/data/attachment/album/202207/16/100809r83e06suu82u8932.png)


**第十二步**：安装完成需要花费几分钟时间，这取决于你的互联网连接速度。


安装完成后，它会要求你 “chroot 进入新创建的安装以进行安装后配置”，但我们不需要。因此输入 `N` 以完成安装。


**第十三步**：最后，你应该会再次看到终端窗口。输入：



```
shutdown now

```

这将安全地退出安装并关闭虚拟机。


一切就绪！在启动安装了 Arch 的虚拟机之前，你还需要做一件事 —— **移除选择作为光驱的 ISO 磁盘**。与添加启动 ISO 的方式类似，你可以前往虚拟机设置并将其删除，如下所示：


![](/data/attachment/album/202207/16/100810akfxouulflklfnnk.png)


到此为止你已在 VirtualBox 上安装了 Arch Linux。


你所要做的就是启动虚拟机，在我的例子中它是这样的：


![virtualbox arch](/data/attachment/album/202207/16/100811nywsbddvkckcv0zc.png)


尽管浏览这些选项需要一些时间，但 Arch Linux 上新的引导式安装程序可以节省大量时间使必填项配置正确。


![](/data/attachment/album/202207/16/100812z9pvq5p5pp9pnbha.png)


同样的步骤也适用于在你的计算机上安装 Arch Linux。你需要用 Arch Linux ISO 文件 [使用 Etcher 制作单独的可启动 USB 盘](https://itsfoss.com/install-etcher-linux/)。


### 总结


[Arch Linux 成为一种流行的选择](https://itsfoss.com/why-arch-linux/) 有多种原因。但是，如果这是你第一次安装，或者你想对其进行测试，那么虚拟机是在不打乱主机的情况下体验它的最佳方式。


我希望这可以帮助你在 VirtualBox 上安装 Arch Linux。在下面的评论中让我知道你的想法。




---


via: <https://itsfoss.com/install-arch-linux-virtualbox/>


作者：[Ankush Das](https://itsfoss.com/author/ankush/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[hanszhao80](https://github.com/hanszhao80) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
![Warp Terminal](/assets/images/warp-terminal.webp)


![Warp Terminal](/assets/images/warp-terminal.webp)

[Arch Linux is hugely popular](https://itsfoss.com/why-arch-linux/) in the desktop Linux world. One of the reasons for its popularity is that [installing Arch Linux](https://itsfoss.com/install-arch-linux/) itself is a complicated task.

I am not exaggerating. Installing [Ubuntu or Debian](https://itsfoss.com/debian-vs-ubuntu/) is a lot easier task than Arch Linux because they have GUI based installers.

Arch doesn’t have that. Only lately, it introduced an official installer script. There is still no official GUI installer.

This is why installing Arch becomes a challenge; this is where virtual machines come in.

You can try installing Arch Linux in VirtualBox first and see if it’s something you would like to run on actual hardware. This way, you can experience Arch Linux without disturbing your current operating system.

In this article, I will guide you through installing a functional Arch Linux system in a virtual machine.

## Installing Arch Linux on VirtualBox

Clearly, you need to first [install VirtualBox on Linux](https://itsfoss.com/install-virtualbox-ubuntu/) or Windows. On Windows, simply go to Oracle’s website and download VirtualBox.

**If you are using Windows 10 or a newer version, please ensure that virtualization is enabled on your system.**

Once done, you need to head to [Arch Linux’s official website](https://archlinux.org/download/) to download the ISO file. You should find options to [download using torrent](https://itsfoss.com/best-torrent-ubuntu/) or download the file directly.

![arch linux official download page](https://itsfoss.com/content/images/wordpress/2022/11/arch-linux-official-download-page.png)

Hold on to the ISO file when needed; you can delete it to [free space on your system](https://itsfoss.com/free-up-space-ubuntu-linux/) after successful installation.

Now, let us begin installing Arch Linux on VirtualBox.

## Part 1. Creating the Virtual Machine

**Step 1:** First, you need to set up a few things in VirtualBox. Launch VirtualBox and click on “**New**” to create a virtual machine.

![select new button to create a new virtual machine](https://itsfoss.com/content/images/wordpress/2022/11/select-new-button-to-create-a-new-virtual-machine.png)

Note that you can continue creating the virtual machine using the **guided mode**, but you get more options at a single glance with the **expert mode**.

![select expert mode in virtualbox](https://itsfoss.com/content/images/wordpress/2022/11/select-expert-mode-in-virtualbox.png)

Hence, I recommend using the expert mode to create the virtual machine.

Fret not, the expert mode is as easy, with just a bit of extra available options and nothing else to worry about.

**Step 2**: Enter the name of your virtual machine, it should auto-detect the “Type” and “Version” respectively when you type in “**Arch Linux**” in the name field. On newer VirtualBox versions, you can select the ISO file from here itself.

![provide name and iso file of arch linux](https://itsfoss.com/content/images/wordpress/2022/11/provide-name-and-iso-file-of-arch-linux-.png)

You should increase the memory size to use the virtual machine comfortably. If it is just for minor testing, you can go ahead with the default setting.

In my case, I allocate ~**3 GB of RAM** and 2 processor cores.

Also, make sure to **create a virtual hard disk** under the “Hard disk” option. It should be the selected option by default. (On the newer versions of VirtualBox, this option comes under the next step).

![provide ram and cpu cores for the virtual machine](https://itsfoss.com/content/images/wordpress/2022/11/provide-ram-and-cpu-cores-for-the-virtual-machine.png)

Now, proceed to set the virtual hard disk size.

**Step 3:** You can choose a preferred location path for the virtual hard disk and tweak the size as per your requirements. In order to set the hardware parameters, you need to check the **create a virtual hard disk now** box.

The installation should not be a problem with the minimum allocated size (8 GB), but to be on the safe side, you may want to allocate at least 10-15 GB.

![allocate hard disk space to virtual machine](https://itsfoss.com/content/images/wordpress/2022/11/allocate-hard-disk-space-to-virtual-machine.png)

Hard disk file type will be **VDI (VirtualBox Disk Image)** by default. Also, memory allocation is set to **dynamic** by default. If you want to allocate the whole size at the beginning itself, you can check the **Pre-allocate Full Size **check box.

Next, you need to select the hard disk file type as “**VDI (VirtualBox Disk Image)**” and the storage as “**Dynamically allocated**,” as shown in the image above.

VDI is the most common hard disk type for the virtual hard disk.

And, when you select the “**Dynamically allocated**” option for the hard disk storage, it means that the storage space will be utilized as per usage. In other words, 10 GB of space won’t be locked from your disk as soon as the virtual machine is created.

Now, all you have to do is hit “**Finish**” to add the virtual machine.

![arch linux virtual machine setup](https://itsfoss.com/content/images/wordpress/2022/11/arch-linux_virtual-machine-setup.png)

You can start the virtual machine, either by pressing the **Start **button, or double clicking the VM.

## Part 2: Installing Arch Linux using the Guided Installer

Arch Linux has made the installation easier by [introducing a guided installer](https://news.itsfoss.com/arch-linux-easy-install/), i.e., it gives you all the options you need to set up a full-fledged Arch Linux system.

So, with the help of a guided installer, you do not have to install a desktop environment and other essential packages yourself separately. All you have to do is follow the onscreen instructions and choose the options suitable for your installation.

In this article, we focus on the guided installer. If you want to do things yourself, you should follow our [Arch installation guide](https://itsfoss.com/install-arch-linux/).

Moving on to the installation, when you start the VM, you will be looking at this screen:

![virtualbox booting arch linux](https://itsfoss.com/content/images/wordpress/2022/11/virtualbox-booting-arch-linux.png)

The first option is the ideal way of proceeding. If you have a specific requirement, you can choose other options to boot up Arch Linux.

Now, you should be looking at a terminal window. Here’s how to get started:

**Step 1**: Type in “**archinstall**” to initiate installation using the guided installer.

![type archinstall in arch linux install terminal](https://itsfoss.com/content/images/wordpress/2022/11/type-archinstall-in-arch-linux-install-terminal.png)

This will bring us to the new menu-based installer.

![the new menu based arch linux installation](https://itsfoss.com/content/images/wordpress/2022/11/the-new-menu-based-arch-linux-installation.png)

There are options available to tweak many things. Here, default values for many of the settings, like language, keyboard layout etc. are fine. So, only describe the other relevant menu to complete the install.

**Step 2: **Select the **Mirror Region** option and press enter. Here, you need to select the fastest mirror region for your location.

![select the fastest mirror region](https://itsfoss.com/content/images/wordpress/2022/11/select-the-fastest-mirror-region.png)

If you have multiple entries, you can select each by pressing **TAB **key. Once selected all mirrors, press **Enter**.

**Step 3: **Select the **Drive** option from the main menu to set the hard drive in which you are going to install Arch Linux. Inside this menu, in case you find a list of drives, select the disk with the highest size (which will be our hard disk).

![select the drive to install arch linux](https://itsfoss.com/content/images/wordpress/2022/11/select-the-drive-to-install-arch-linux.png)

**Step 4: **Format the drive and set the filesystem.

You need to select the **Disk Layout** option from the main menu and select the option as shown in the screenshot below:

![wipe all selected drives and use default partition layout](https://itsfoss.com/content/images/wordpress/2022/11/wipe-all-selected-drives-and-use-default-partition-layout.png)

This will ask us to select a file system. In this case, I used [BTRFS filesystem](https://itsfoss.com/btrfs/). So select your file system preference and press enter.

![select file system for the new arch linux system](https://itsfoss.com/content/images/wordpress/2022/11/select-file-system-for-the-new-arch-linux-system.png)

This will ask for several yes/no questions about using **BTRFS subvolumes with a default structure** and** BTRFS compression**. Agree on the default and press enter.

**Step 5: **You can skip creating a root password (This will disable the root, which is not an issue). But you must create a new user and give him sudo privileges. Go to the **User Accounts** option and select **Add a new user**:

![add a new user and give him sudo privileges](https://itsfoss.com/content/images/wordpress/2022/11/add-a-new-user-and-give-him-sudo-privileges.png)

You can select **confirm and exit** option (if not seen, scroll down using down arrow).

**Step 6:** In this step, you need to select the desktop environment. First select **Profile** option. In here, select the **desktop** option as shown below:

![select desktop option to install a graphical desktop environment](https://itsfoss.com/content/images/wordpress/2022/11/select-desktop-option-to-install-a-graphical-desktop-environment.png)

This will list the available desktop environments. Choose your favourite desktop from the list. I used GNOME here.

![select the desktop environment of your choice](https://itsfoss.com/content/images/wordpress/2022/11/select-the-desktop-environment-of-your-choice.png)

On the next screen, you need to select the graphics driver. For VirtualBox, select the **VMware/VirtualBox** driver.

![select the graphics driver](https://itsfoss.com/content/images/wordpress/2022/11/select-the-graphics-driver.png)

**Step 7: **Now, you need to select the following options from the subsequent options:

**Audio**: Default is Pipewire**Kernel**: Either use default Linux kernel or you have other options like LTS, Hardened, Zen etc.**Additional Packages**: Specify additional packages that you need, by name (like firefox).**Network Configuration**: Use Network Manager**Time Zone**: Your Location Time**Optional Repositories**: Testing/Multilib

Once done, this will somewhat be your setup:

![final arch linux install setup](https://itsfoss.com/content/images/wordpress/2022/11/final-arch-linux-install-setup.png)

![snapshot of the configuration before installation](https://itsfoss.com/content/images/wordpress/2022/11/snapshot-of-the-configuration-before-installation.png)

**Step 8**: Press the install button on the bottom. This will start the installation process. If you have a fast internet connection/system, the download and install process takes some 5 to 10 minutes.

![downloading and installing packages](https://itsfoss.com/content/images/wordpress/2022/11/downloading-and-installing-packages.png)

After the installation is complete, it will ask you to **chroot into a newly created installation for post-installation configuration**, but we don’t need that. So, select **No** to complete the installation.

![asking you for post install tweaks by entering chroot](https://itsfoss.com/content/images/wordpress/2022/11/asking-you-for-post-install-tweaks-by-entering-chroot.png)

![shutdown when installation successful message is displayed](https://itsfoss.com/content/images/wordpress/2022/11/shutdown-when-installation-successful-message-is-displayed.png)

**Step 13:** Finally, you should see the terminal window again. Type in:

`shutdown now`


This will safely exit the installation and close the virtual machine.

It’s all set! Before starting the virtual machine with Arch installed, you need to do one more thing – **remove the ISO disk selected as the optical drive**. Similar to how you added the ISO to boot from, you can head to the virtual machine settings and remove it as shown below:

![select settings for the virtual machine](https://itsfoss.com/content/images/wordpress/2022/11/select-settings-for-the-virtual-machine.png)

![remove the iso file from the virtual machine](https://itsfoss.com/content/images/wordpress/2022/11/remove-the-iso-file-from-the-virtual-machine.png)

That’s it! You are done installing Arch Linux on VirtualBox.

All you have to do is start the virtual machine, and here’s how it looks in my case:

![booting arch linux with kde plasma desktop](https://itsfoss.com/content/images/wordpress/2022/11/booting-arch-linux-with-kde-plasma-desktop.png)

Even though it takes a bit of time to go through the options, the new guided installer on Arch Linux saves a lot of time to get the essentials right.

![arch linux with kde plasma desktop environment](https://itsfoss.com/content/images/wordpress/2022/11/arch-linux-with-kde-plasma-desktop-environment.webp)

The same set of steps applies to installing Arch Linux on your computer. You must [make a separate bootable USB drive using Etcher](https://itsfoss.com/install-etcher-linux/) with the Arch Linux ISO file.

## Wrapping Up

[Arch Linux is a popular choice ](https://itsfoss.com/why-arch-linux/)for a variety of reasons. However, if it is your first time installing or if you want to test it out, a virtual machine is the best way to experience it without disrupting your host computer.

I hope this helps you install Arch Linux on VirtualBox. Let me know your thoughts in the comments down below.