Environment: Ubuntu 10.04.3 LTS (Lucid Lynx)
Apt-cdrom is not easy to use in VirtualBox and cannot be attached to the optical drive. It may be a problem with virtual machines. Physical machines can.
Change the path to the local directory of the DVD and mount the iso file directly:
1. Put the ubuntu dvd into a virtual machine or use the data space provided by VirtualBox. For detailed configuration methods, see VirtualBox data space configuration under Linux. here I have mounted the iso file to ubuntu. The path is/media/vdisk, which is not the focus.
2. Mount the ubuntu dvd iso file to/media/dvd and use the-o loop parameter.
Sudo mount-o loop/media/vdisk/ubuntu-10.04.3-dvd-i386.iso/media/dvd
3. Modify/etc/apt/sources. list
Sudo vim/etc/apt/sources. list
Change the path and version Code in the following content (lucid is the code 10.04) to your own and add it to the update source file.
Deb file: // media/dvd lucid main restricted
As for whether you want to put the DVD source at the head or tail, or even keep the update source of the dvd as needed.
4. Update the source list
Sudo apt-get update