Skip to content

This page covers two ways to install Ubuntu — VM virtual machine and WSL — just pick one of them.

Method 1: VM Virtual Machine

1
Download the Ubuntu image

Official download for Ubuntu 20.04.6 (recommended, fast): download ubuntu-20.04.6-desktop-amd64.iso.

You can also visit https://cn.ubuntu.com/download to pick another version.

2
Open VMware and create a virtual machine

Open VMware Workstation and click Create a New Virtual Machine on the home screen:

步骤 2 截图
3
Choose the typical configuration

Select Typical and click Next:

步骤 3 截图
4
Select the ISO image

Select Installer disc image file (iso), click Browse to choose the downloaded Ubuntu image, then click Next:

步骤 4 截图
5
Set the user name and password

Give your Linux a nice name, set a user name and password, then click Next:

⚠️ Remember the password you set — you will need it to log in!

步骤 5 截图
6
Choose the install location

Choose where to store the virtual machine (a disk with plenty of free space is recommended) and click Next:

步骤 6 截图
7
Set the disk size

Enter 50G for the disk size (default is 20G; 50G or more is recommended), select Store virtual disk as a single file, and click Next:

步骤 7 截图
8
Finish creating the VM

Keep the defaults and click Finish:

步骤 8 截图
9
Install the system

The VM starts installing Ubuntu; click OK on any prompt that appears, then wait for the installation to finish and boot into the system:

步骤 9 截图 1步骤 9 截图 2步骤 9 截图 3

System configuration inside the VM

1
Edit the software sources

Open a terminal (Ctrl+Alt+T) and run the command below to open the apt sources file:

After copying a command, paste it in the terminal with the middle mouse button.

sudo nano /etc/apt/sources.list
2
Comment out the original content

Comment out the original entries with #:

步骤 2 截图 1步骤 2 截图 2
3
Replace with the Tsinghua mirror (recommended)

Replace all the content with the addresses below, then save with Ctrl+O and exit with Ctrl+X:

# Default commented out source mirrors to speed up apt update; uncomment if needed

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse

# The security update sources below include official and mirror config; edit comments as needed

deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
4
Replace with the Aliyun mirror (alternative)

Prefer not to use Tsinghua? Replace everything with the Aliyun mirror instead:

deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
5
Replace with the USTC mirror (alternative)

Or replace everything with the USTC mirror:

# Default commented out source repositories; uncomment if needed

deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
6
Update the software sources

Run the command below to apply the new sources:

sudo apt update
7
Upgrade the software

Upgrade the installed packages (this takes a while — please be patient):

sudo apt upgrade
8
Install essential tools

Install the common development tools (vim, git, net-tools, ssh, python):

  • vim: terminal text editor
  • git: code repository tool for fetching code
  • net-tools: network tools for checking IP addresses
  • ssh: remote connection tool
  • python3-pip: Python package manager
sudo apt-get install vim git net-tools ssh python2 python3-pip
9
Add serial port permission

Add the current user to the dialout group, otherwise accessing the serial port (/dev/ttyUSB0) later will fail with a permission error:

sudo usermod -a -G dialout $USER
10
Set up the python version

Register python2 and python3 for version switching (run both commands). Later, use sudo update-alternatives --config python and type a number to switch:

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
11
Ubuntu is ready

Ubuntu is now installed and configured. To continue setting up the development environment, see:

Method 2: Install Ubuntu in WSL

1
Open PowerShell

Hold shift + right-click and choose Open PowerShell window here (or search for PowerShell in the Start menu), then run the command below to install Ubuntu 20.04:

wsl --install -d Ubuntu-20.04
2
Wait for the installation to finish

The installation downloads from the internet — please be patient. The screen below means it succeeded; the first launch of Ubuntu asks you to set a user name and password:

alt text

FAQ

The Ubuntu image download is too slow

The official link releases.ubuntu.com is usually the fastest; you can also visit https://cn.ubuntu.com/download for a China mirror entry.

Forgot the login password

Restart Ubuntu in the VM; on the GRUB screen choose Advanced options for Ubunturecovery moderoot, then run passwd username in the shell to reset the password.

The VM says “Intel VT-x is disabled”

Enable virtualization (Intel VT-x / AMD-V) in the computer BIOS, save and reboot, then start the VM again.

Have questions?

For any other questions, visit the unified Q&A and discussion board: Ai-Thinker Discussions

Released under the MIT License. Build Time 2026-09-11 14:52:23