This page covers two ways to install Ubuntu — VM virtual machine and WSL — just pick one of them.
Method 1: VM Virtual Machine
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.
Open VMware Workstation and click Create a New Virtual Machine on the home screen:

Select Typical and click Next:

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

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!

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

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:

Keep the defaults and click Finish:

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



System configuration inside the VM
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.listComment out the original entries with #:


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 multiversePrefer 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 multiverseOr 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 multiverseRun the command below to apply the new sources:
sudo apt updateUpgrade the installed packages (this takes a while — please be patient):
sudo apt upgradeInstall the common development tools (vim, git, net-tools, ssh, python):
vim: terminal text editorgit: code repository tool for fetching codenet-tools: network tools for checking IP addressesssh: remote connection toolpython3-pip: Python package manager
sudo apt-get install vim git net-tools ssh python2 python3-pipAdd 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 $USERRegister 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 150Ubuntu is now installed and configured. To continue setting up the development environment, see:
Method 2: Install Ubuntu in WSL
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.04The 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:

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 Ubuntu → recovery mode → root, 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

