China Region Quick Setup
This article is aimed at users in mainland China, consolidating all the localization configurations needed after installing Ubuntu 26.04. Follow these steps to quickly adjust your system for optimal use in China.
Switch to Chinese Mirror Sources
Ubuntu’s default software source servers are located overseas, resulting in slow access speeds from China. Switching to a domestic mirror can dramatically improve software installation and update speeds.
Recommended Mirror Sources
| Mirror Site | Address | Notes |
|---|---|---|
| Alibaba Cloud | mirrors.aliyun.com | Stable and fast; recommended for most users |
| Tsinghua University | mirrors.tuna.tsinghua.edu.cn | Top choice for education network users |
| USTC | mirrors.ustc.edu.cn | Recommended for education network users |
How to Change
Ubuntu 26.04 uses the DEB822 format for source configuration files:
# Back up the original source configuration
sudo cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.bak
# Replace with Alibaba Cloud mirror using sed
# (cn\.)? matches both cn.archive.ubuntu.com and archive.ubuntu.com, avoiding invalid domains
# Only the hostname is replaced; the http/https protocol is left unchanged
sudo sed -i -E 's|(cn\.)?archive.ubuntu.com|mirrors.aliyun.com|g' /etc/apt/sources.list.d/ubuntu.sources
sudo sed -i -E 's|security.ubuntu.com|mirrors.aliyun.com|g' /etc/apt/sources.list.d/ubuntu.sources
# To use the Tsinghua mirror instead:
# sudo sed -i -E 's|(cn\.)?archive.ubuntu.com|mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
# sudo sed -i -E 's|security.ubuntu.com|mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
# To use the USTC mirror:
# sudo sed -i -E 's|(cn\.)?archive.ubuntu.com|mirrors.ustc.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
# sudo sed -i -E 's|security.ubuntu.com|mirrors.ustc.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
# Update the package index
sudo apt updateIf you selected a China timezone during Ubuntu installation, the installer may have automatically configured cn.archive.ubuntu.com, but that address may not offer the best speed. It’s recommended to manually switch to one of the mirror sites listed above.
Install Chinese Language Packs
Install complete Chinese language support to ensure the system interface, date formats, sorting rules, and more are fully localized.
# Install Chinese language packs
sudo apt install language-pack-zh-hans language-pack-gnome-zh-hans -y
# Generate the Chinese locale
sudo locale-gen zh_CN.UTF-8
# Set the system default language to Chinese
sudo update-locale LANG=zh_CN.UTF-8 LANGUAGE=zh_CN:zh
# Log out and log back in for the settings to take effectIf you prefer to keep the English interface but use a Chinese input method, you can skip the update-locale step and just install the language packs.
Configure Chinese Input Method
Ubuntu 26.04 recommends the Fcitx5 input method framework paired with a Chinese input engine.
Install Fcitx5
# Install Fcitx5 core and Chinese input engine
sudo apt install fcitx5 fcitx5-chinese-addons fcitx5-frontend-gtk3 fcitx5-frontend-gtk4 fcitx5-frontend-qt5 -y
# Install the configuration tool
sudo apt install fcitx5-config-qt -ySet as Default Input Method
# Set Fcitx5 as the default input method framework
im-config -n fcitx5Configure Environment Variables
On the Wayland graphical session in 26.04, im-config -n fcitx5 is usually enough — the input method environment variables are handled automatically by im-config, so manual setup is normally unnecessary. Writing the variables to ~/.bashrc also has no effect on the GNOME graphical session (graphical sessions do not read ~/.bashrc). Only set them manually if a specific application cannot type Chinese.
If you do need to set them manually, write them to /etc/environment, which applies to the system graphical session:
# Write the input method environment variables to /etc/environment (applies to the graphical session)
sudo tee -a /etc/environment << 'EOF'
# Fcitx5 input method environment variables
XMODIFIERS=@im=fcitx
QT_IM_MODULE=fcitx
# Under Wayland, GTK apps usually don't need GTK_IM_MODULE;
# uncomment the next line only if some GTK app can't accept input
# GTK_IM_MODULE=fcitx
EOFAfter logging out and back in, find the Fcitx5 icon in the system tray, right-click and select “Configure,” then add the “Pinyin” input method. The default shortcut for switching between Chinese and English is Ctrl+Space.
If you prefer Sogou Input Method or another third-party input method, you can download the Linux .deb package from their official website. However, Fcitx5’s built-in Pinyin input method is already excellent, supporting cloud Pinyin, dictionary import, and more. It’s worth trying first.
Install Chinese Fonts
Ubuntu’s default Chinese font coverage is not comprehensive. It’s recommended to install the following font packages:
# Install Noto CJK fonts (by Google, covering all CJK characters)
sudo apt install fonts-noto-cjk fonts-noto-cjk-extra -y
# Install WenQuanYi fonts
sudo apt install fonts-wqy-microhei fonts-wqy-zenhei -y
# Refresh the font cache
fc-cache -fvAfter installation, you can choose your preferred Chinese font in “Settings - Appearance.”
Set the Timezone
If the timezone wasn’t set correctly during installation, you can set it manually:
# Check the current timezone
timedatectl
# Set to the Shanghai timezone (China Standard Time)
sudo timedatectl set-timezone Asia/Shanghai
# Confirm the timezone has been changed
dateIf you’re dual-booting Windows and Ubuntu, you may encounter a time desync issue. The fix:
# Make Ubuntu treat the hardware clock as local time (consistent with Windows)
sudo timedatectl set-local-rtc 1Install Common Software
Browser
# Firefox is pre-installed (Snap version)
# Install Google Chrome
wget -q -O /tmp/chrome.deb "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
sudo apt install /tmp/chrome.deb -yOffice Suite
# LibreOffice is pre-installed; install the Chinese language pack
sudo apt install libreoffice-l10n-zh-cn -y
# Install WPS Office (download the .deb package from the official website)
# Visit https://linux.wps.cn/ to download, then install
# sudo apt install ./wps-office_*.deb -yChat Applications
# Install WeChat (Snap version)
sudo snap install wechat-universal
# Install QQ (download from the official website)
# Visit https://im.qq.com/linuxqq/ to download the .deb package
# sudo apt install ./linuxqq_*.deb -yAudio & Video
# Install VLC media player
sudo apt install vlc -y
# Install multimedia codecs
sudo apt install ubuntu-restricted-extras -yWhen installing ubuntu-restricted-extras, a EULA agreement confirmation screen will appear. Use the Tab key to select “OK” and press Enter to confirm.
Network Environment Configuration
Git Acceleration for China
# Use a GitHub mirror (if direct GitHub access is slow)
git config --global url."https://ghfast.com/https://github.com/".insteadOf "https://github.com/"npm Mirror
# Set npm to use the Taobao mirror
npm config set registry https://registry.npmmirror.compip Mirror
# Set pip to use the Tsinghua mirror
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip config set global.trusted-host pypi.tuna.tsinghua.edu.cnSystem Proxy Settings
If you need to configure an HTTP proxy:
# Temporary setting (valid for current terminal only)
export http_proxy="http://127.0.0.1:7890"
export https_proxy="http://127.0.0.1:7890"
# Permanent setting (written to ~/.bashrc)
cat >> ~/.bashrc << 'EOF'
export http_proxy="http://127.0.0.1:7890"
export https_proxy="http://127.0.0.1:7890"
export no_proxy="localhost,127.0.0.1,192.168.0.0/16"
EOFYou can also configure the proxy through the GUI in “Settings - Network - Network Proxy.”
All-in-One Command Summary
The following commands summarize all the key operations from this article. You can copy and execute them as needed. It’s recommended to run them step by step rather than pasting everything at once, so you can observe the output of each step.
# 1. Switch mirror sources (using Alibaba Cloud as an example; (cn\.)? also matches cn.archive.ubuntu.com)
sudo sed -i -E 's|(cn\.)?archive.ubuntu.com|mirrors.aliyun.com|g' /etc/apt/sources.list.d/ubuntu.sources
sudo sed -i -E 's|security.ubuntu.com|mirrors.aliyun.com|g' /etc/apt/sources.list.d/ubuntu.sources
sudo apt update
# 2. Install Chinese language packs
sudo apt install language-pack-zh-hans language-pack-gnome-zh-hans -y
sudo locale-gen zh_CN.UTF-8
sudo update-locale LANG=zh_CN.UTF-8 LANGUAGE=zh_CN:zh
# 3. Install Chinese input method
sudo apt install fcitx5 fcitx5-chinese-addons fcitx5-frontend-gtk3 fcitx5-frontend-gtk4 fcitx5-frontend-qt5 fcitx5-config-qt -y
im-config -n fcitx5
# 4. Install Chinese fonts
sudo apt install fonts-noto-cjk fonts-noto-cjk-extra fonts-wqy-microhei fonts-wqy-zenhei -y
fc-cache -fv
# 5. Set timezone
sudo timedatectl set-timezone Asia/Shanghai
# 6. Install common software
sudo apt install vlc ubuntu-restricted-extras libreoffice-l10n-zh-cn -y
wget -q -O /tmp/chrome.deb "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
sudo apt install /tmp/chrome.deb -y
# 7. Configure development tool mirrors (as needed)
# npm config set registry https://registry.npmmirror.com
# pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simpleAfter completing the above configuration, log out and log back in to enjoy the full Chinese Ubuntu experience.
Related Articles
- Post-Installation Setup — General post-installation configuration guide
- Software Installation — Detailed guide to apt, Snap, Flatpak, and other software installation methods
- Input Method Configuration — Detailed input method framework configuration and troubleshooting