linux

如何在Linux用VirtualBox

小樊
47
2025-10-20 05:27:09
栏目: 智能运维

Installing VirtualBox on Linux
To use VirtualBox on Linux, you first need to install it. The easiest method is via your system’s package manager (recommended for most users):

For advanced users, you can download the latest version directly from the VirtualBox website. After downloading the .deb (Debian/Ubuntu) or .rpm (Fedora/CentOS) package, install it using sudo dpkg -i virtualbox-*.deb (Debian) or sudo rpm -ivh VirtualBox-*.rpm (Fedora). If dependencies are missing, run sudo apt-get install -f (Debian) or sudo dnf install -y kernel-devel gcc make (Fedora) to resolve them.

Starting VirtualBox
Once installed, you can launch VirtualBox from your application menu (search for “VirtualBox”) or via the terminal with virtualbox. If you encounter permission issues, ensure your user is part of the vboxusers group by running sudo usermod -aG vboxusers $USER and logging out/in.

Creating a Virtual Machine (VM)

  1. Click the “New” button in VirtualBox to start the wizard.
  2. Enter a name for your VM (e.g., “Ubuntu 22.04”) and select the OS type (e.g., “Microsoft Windows” or “Linux”) and version (e.g., “Ubuntu (64-bit)”).
  3. Allocate RAM: Assign 2–4 GB (or more) of RAM, ensuring you leave enough for your host system (e.g., 8 GB total RAM → assign 4 GB to the VM).
  4. Create a virtual hard disk: Choose “Create a virtual hard disk now,” select VDI format (default), and set a dynamic or fixed size (at least 20 GB for Windows, 10 GB for Linux).
  5. Complete the wizard and click “Create” to finalize the VM.

Installing the Guest Operating System

  1. Select your newly created VM and click “Settings.”
  2. Go to the “Storage” tab, click the empty optical drive icon, and add your OS ISO file (e.g., Ubuntu ISO) from your computer.
  3. Start the VM by clicking “Start.” The VM will boot from the ISO, and you can follow the on-screen instructions to install the OS (e.g., select language, partition disk, create a user).
  4. After installation, remove the ISO from the VM’s storage settings (go to “Settings” > “Storage” and eject the ISO) to boot into the installed OS.

Configuring VM Settings
After creating the VM, you can customize its behavior:

Using VirtualBox Features

Troubleshooting Common Issues

0
看了该问题的人还看了