VirtualBox Ubuntu Installation Guide: Complete ROS2 Development Environment Setup

Step-by-step guide to installing Ubuntu in VirtualBox for ROS2 robot development on Windows.
This guide walks complete beginners through setting up Ubuntu in VirtualBox on Windows as the foundation for ROS2 robotics development. It covers downloading VirtualBox and the Ubuntu ISO, configuring VM resources (2-core CPU, 2 GB RAM, 15 GB disk), skipping unattended installation, using the xrandr command to fix resolution issues, partitioning the virtual disk, and completing first login — with practical tips to avoid common pitfalls.
Why ROS2 Development Starts with Linux
For beginners looking to enter the world of embodied intelligence and robotics development, ROS2 (Robot Operating System 2) is practically unavoidable — it's the core framework you'll work with. And the best environment to run ROS2 is Linux, particularly the Ubuntu distribution. So before diving into actual robot development, getting comfortable with installing and using a Linux system is a prerequisite you simply can't skip.
For the vast majority of developers on Windows, installing Ubuntu inside a virtual machine is the safest approach — one that won't disrupt your existing system. This guide walks through a complete workflow for installing Ubuntu in VirtualBox, helping beginners build their own Linux development environment step by step.
Preparing VirtualBox and the Ubuntu ISO
The first step is to download and install VirtualBox. It's a free, open-source virtualization tool that lets you run a complete virtual operating system on top of your existing one. Installation is straightforward — just double-click the installer and click "Next" through the prompts. No special configuration required.
Once installed and opened, you'll land on the virtual machine manager interface. You'll also need an ISO file — the Ubuntu installation image. An ISO is essentially a virtual version of a system installation disc; the virtual machine reads it to perform the OS installation. Go ahead and download the appropriate Ubuntu version from the official Ubuntu website beforehand.
Creating a New VM and Configuring Hardware Resources
In the manager interface, click "New," give your virtual machine a name (in this tutorial we use N1), and choose a directory to store it. Make sure you pick a location with plenty of disk space and no important data — you don't want to risk losing anything if something goes wrong.
Next comes the critical resource configuration step.
CPU and Memory Settings
It's recommended to set the processor to 2 cores and memory to 2048 MB (2 GB). If your machine has limited resources, you can drop to 1 core + 1024 MB, though the performance will be noticeably worse. For running a development environment like ROS2, more resources generally means a smoother experience.

Disk Space and Virtual Optical Disc
For disk space, 15 GB is recommended — more than enough for learning purposes. In the virtual optical disc settings, select the ISO image file you prepared earlier. This is the equivalent of "inserting" an installation disc into the virtual machine.
Important: During the setup options, make sure to select Skip Unattended Installation. We want to complete the installation manually so we understand each step of the process, rather than letting the system handle it automatically.
Booting the VM and Entering the Ubuntu Installer
Once configured, double-click the VM icon to start it. This is like inserting the virtual disk you just created and powering it on. The system will load the ISO image and enter the boot screen.
You don't need to do much here — click "OK" on any confirmation prompts, click into the window, select the default first option, and press Enter. The system will start loading, and after a moment you'll reach the graphical installation interface.

In the language selection menu, scroll down to find Chinese (Simplified), then click "Install Ubuntu." For keyboard layout, select "Chinese" and "Hanyu Pinyin."
Fixing the Common Small Resolution Problem
Many beginners run into a frustrating issue during installation: the interface resolution is too small, so buttons like "OK" and "Continue" at the bottom are cut off and can't be clicked. This is caused by the virtual machine's default resolution settings.
Adjusting Resolution with the xrandr Command
The fix is to use a keyboard shortcut to open a terminal and adjust the resolution. First, drag the window by the top bar to reveal the desktop, then press Ctrl + Alt + T to open a terminal window — one of the most commonly used actions in Linux.
In the terminal, type the following command:
xrandr -s 20
The number after -s is the index of the resolution mode. The default value of 22 tends to be too large. Try adjusting it down to 20, 19, 18, and so on — use the up arrow key to recall previous commands and fine-tune until you can see the full bottom buttons. Through testing, a value around 20 tends to be the sweet spot: large enough to keep things readable, small enough that buttons aren't cut off.

Note: Don't set the resolution too small, or the interface elements will be too cramped to click accurately — forcing you to restart and start over, which is a real hassle.
Disk Partitioning and Ubuntu Installation
Once the resolution is adjusted, click "Continue," select "Normal Installation," and keep the remaining options at their defaults.
When the system asks "This computer doesn't appear to have an OS installed. What would you like to do?", select Erase disk and install Ubuntu. Confirm once more that you're selecting the 15 GB virtual space you set up earlier — not any location with important data. A deletion confirmation will appear; click "Continue."

Timezone and User Account Setup
For timezone, either "Beijing" or "Shanghai" works fine — the difference is negligible. Then fill in your user information:
- Computer name / Username: This tutorial uses N1 for easy recall
- Password: A simple
123456is recommended
Why recommend a simple password? Because this is a local virtual machine for learning purposes — it's not a real security-sensitive environment. An overly complex password you might forget will cause serious headaches later when logging in or running commands. Of course, if you ever use this setup in a production or networked environment, use a strong password.
Finishing Installation and Logging In for the First Time
Once all the information is filled in, the system begins installing automatically. When it finishes, you'll be prompted to restart — click "Restart." After some loading time, press Enter to let the system continue booting.
At the login screen, enter the username and password you set (e.g., 123456) to reach the Ubuntu desktop. On first boot, you'll see a few setup prompts (location services, account linking, etc.) — for learning purposes, you can skip all of these and click "Done." Your Ubuntu installation is now complete.
Summary: Key Steps for Setting Up a ROS2 Development Environment
Installing Ubuntu via VirtualBox is the starting point for ROS2 development and your broader Linux learning journey. While the process involves many steps, the core flow can be summarized as:
- Install VirtualBox and prepare the ISO image
- Create a new VM and allocate appropriate CPU, memory, and disk resources
- Complete the installation manually, using the command line to resolve issues like resolution
- Set up easy-to-remember user credentials and complete login
You may not have noticed, but during the installation process we already used a Shell command — xrandr. That's the essence of Linux: the command line is the core tool for interacting with the system. Now that you've got the system installed, the next step is diving deeper into Shell commands and automation scripts, building a solid foundation for real ROS2 robot development.
Related articles

Supply Chain Hardware Implants: The Most Dangerous Security Threat You're Overlooking
A deep dive into supply chain hardware implant attacks: how they work, historical cases, and defense strategies. Learn why hardware backdoors are nearly undetectable and how to build a zero-trust defense.

Fine-Tuning LLMs to Mimic Real Human Chat Styles: A Guide to Building Emotion-Aware Datasets
How to fine-tune an LLM to mimic real human chat styles? This guide covers emotion labeling, context-aware datasets, LoRA fine-tuning, and iterative optimization.

Microsoft's Official Free Roadmap: 6 Stages to Learn Generative AI Systematically
Microsoft's free 6-stage Generative AI learning roadmap covers LLM basics, responsible AI, no-code practice, Azure development, RAG, fine-tuning, and AI-900 certification — ~24 hours total, no paywall.