Operations 6 min read

Fix Ubuntu apt‑get Update Errors: Configure Local Repositories & Install Packages

After installing Ubuntu 20.10 in a VM, the author encountered missing command errors and apt‑get update failures, then documents step‑by‑step troubleshooting: checking the OS version, adjusting sources.list via USTC mirrors, backing up and editing the file, installing essential packages, and handling offline installations.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Fix Ubuntu apt‑get Update Errors: Configure Local Repositories & Install Packages

Background: The author installed Ubuntu 20.10 in a virtual machine to test PCAP packets. After installation, many commands were unavailable because openssh-server was not installed, and running sudo apt-get update produced errors.

Step 1 – Verify Ubuntu Version

lsb_release -a

The command confirms the exact Ubuntu release being used.

Step 2 – Configure Software Sources

Using the USTC mirror, the author downloaded a sources.list file for the groovy (20.10) release. The original file is backed up before replacement:

cp /etc/apt/sources.list /etc/apt/sources.list.bak

If vim is installed, edit the file directly; otherwise use gedit:

vim /etc/apt/sources.list
sudo gedit /etc/apt/sources.list

Insert the appropriate deb lines, for example:

deb http://mirrors.ustc.edu.cn/ubuntu/ groovy main restricted

Step 3 – Update and Install Packages

After saving the new source list, run: sudo apt-get update When the update succeeds, install required tools, e.g.:

sudo apt install tree

Additional – VMware Tools for Bridged Networking

If the VM is not in bridged mode, install VMware Tools to enable drag‑and‑drop and proper network access:

cd /home/jacktian/桌面/123/VMwareTools-10.3.22-15902021/vmware-tools-distrib
./vmware-install.pl

Accept the defaults (answer "yes") until installation completes.

Offline Repository via ISO

When the host has no internet access, mount the Ubuntu ISO and create a local repository:

mkdir /mnt/cdrom
umount /dev/sr0
mount -t iso9660 /dev/sr0 /cdrom
# or using a loop device
sudo mount -t iso9660 -o loop /home/jacktian/桌面/123/ubuntu-20.10-desktop-amd64.iso /mnt/cdrom

Backup the current sources.list, then add the CDROM entry:

cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo apt-cdrom add

Verify the file with cat /etc/apt/sources.list, clean the cache, and update:

sudo apt clean all
sudo apt update

Offline Installation of Required Packages

If the repository is still unreachable, download the .deb packages manually. Example for net-tools and openssh-server:

sudo dpkg -i net-tools_1.60+git20180626.aebd88e-1ubuntu1_amd64.deb

The openssh-server installer is provided as a zip containing all dependency debs:

unzip openssh-server-installer.zip
sudo dpkg -i *.deb

After completing these steps, the Ubuntu VM can be accessed via terminal tools even without external network connectivity.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Ubuntuoffline installationapt-getsources.list
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.