When you install Ubuntu Server, the installer usually picks the mirror closest to the machine. For a server in Vietnam that means vn.archive.ubuntu.com. In theory a nearby mirror is faster, but in practice that is not always true: regional mirrors get overloaded, sync slowly, or occasionally break in a way that leaves apt update hanging for a long time before it times out.
When that happens, switching to the main mirror is the fastest fix.
With the traditional sources.list format
This applies to Ubuntu 22.04 and earlier. Open the config file:
sudo nano /etc/apt/sources.list
Back it up before you edit anything:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
Find http://vn.archive.ubuntu.com/ubuntu and replace it with http://archive.ubuntu.com/ubuntu.
If you would rather not edit line by line, use sed to replace all of them at once:
sudo sed -i 's|vn.archive.ubuntu.com|archive.ubuntu.com|g' /etc/apt/sources.list
Then refresh the package list:
sudo apt update
On Ubuntu 24.04 and later
From 24.04 onwards Ubuntu moved to the deb822 format and the config file lives somewhere else:
sudo nano /etc/apt/sources.list.d/ubuntu.sources
The content looks like this:
Types: deb
URIs: http://vn.archive.ubuntu.com/ubuntu/
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
You only need to change the URIs line. Or use sed the same way:
sudo sed -i 's|vn.archive.ubuntu.com|archive.ubuntu.com|g' /etc/apt/sources.list.d/ubuntu.sources
sudo apt update
If you are not sure which format your system uses, check with:
ls /etc/apt/sources.list.d/
cat /etc/apt/sources.list
If sources.list only contains a few comment lines, the real config has moved to sources.list.d/ubuntu.sources.
Automatic mirror selection
Ubuntu has an option that picks the fastest mirror at run time:
URIs: mirror+file:/etc/apt/apt-mirrors.txt
Or with the old format:
deb mirror://mirrors.ubuntu.com/mirrors.txt noble main restricted universe multiverse
This is convenient but it has a downside: you do not control which mirror is in use, so when something goes wrong it is harder to diagnose.
A note on security
If you use a third party mirror rather than an official Ubuntu one, pick a reputable source. Packages are signed so apt refuses anything that has been tampered with, but a malicious mirror can still hold you on an older vulnerable version simply by not syncing new patches.
Prefer https over http where the mirror supports it, so nobody on the path can watch which packages you install.