How to use a .iso image as a CD-ROM Repository?

161,569

Solution 1

This question has already been answered as part of an answer to a different question: How to make USB drive as local repository

The easiest way to add the image as a software source is to burn it to a CD/DVD. You then need to go to System -> Administration -> Software Sources, click 'Other Software' and click 'Add CD-ROM...'.

If you want to use the ISO image as a software source without burning it, the process will be a bit more complicated. You will need to open a terminal Applications -> Accessories -> Terminal and run these commands:

sudo mkdir /aptoncd-mountpoint

sudo mount /media/USB/aptoncd.iso ~/aptoncd-mountpoint -oloop

sudo apt-cdrom -d=/aptoncd-mountpoint add

(source: http://www.debianhelp.org/node/10486)

Solution 2

Try this

mkdir /media/mountpoint  
mount -t iso9660 -o loop /pathtoiso.iso /media/mountpoint  

then add deb file:///media/mountpoint distro main contrib to /etc/sources.list with text editor and not with some GUI tool, then update from package manager.

Solution 3

The above steps didn't worked for me. Anyways I happened to work it out with the help of debian user list and it worked.

Here are the steps.

  1. Assume you have the iso file in /home/iso-files/ folder. I had the debian-7.1.0-amd64-DVD-1.iso in /home/iso-files folder

  2. Make a new folder in /media

    mkdir /media/dvd1-mountpoint
    

    you will have to run the above command as root

  3. Run the following command as root

    mount ~/iso-files/debian-7.1.0-amd64-DVD-1.iso /media/dvd1-mountpoint -o loop 
    
  4. Add an entry to /etc/fstab as follows

    ~/iso-files/debian-7.1.0-amd64-DVD-1.iso /media/dvd1-mountpoint iso9660 loop,ro,user,noauto 0       0
    
  5. Make an entry in your /etc/apt/sources.list as follows

    deb file:/media/dvd1-mountpoint/ wheezy main contrib
    
  6. Comment out everything else in /etc/apt/sources.list by adding a # at the start of every entry. only the above line should be uncommented.

  7. Run the following command as root

    apt-get update
    
  8. Install any package name and now it should work.

    apt-get install somePackage
    
  9. You can check if your entry in fstab is correct or not by unmounting the dvd and then directly mounting the mountpoint

    umount /media/dvd1-mountpoint
    mount /meida/dvd1-mountpoint
    
  10. If you plan to automount the dvd at start up you should remove user,noauto from entry in /etc/fstab

The above steps are working just perfectly for me. It should work for you also! I know I am pretty late to answer you, but anyways!

Solution 4

sudo mount  ~/Desktop/ubuntu-12.04.3-desktop-i386.iso /media/apt
sudo apt-cdrom --no-mount -d=/media/apt add

This works.

Solution 5

I found the answer here: http://ubuntuguide.net/4-ways-to-upgrade-to-ubuntu-11-04-natty-narwhalonlineoffline (number 4).

Essentially, what it suggests is mounting the ISO as a CDROM. This probably fools the system into believing the ISO image is a real CD.

sudo mount -t iso9660 -o loop PATH/TO/ISO /cdrom

(I'm using this method to upgrade from 11.10 to 12.04 Alpha2, because it won't fit on a CD and for some reason my system isn't happy with USB drives.)

Share:
161,569

Related videos on Youtube

Alexar
Author by

Alexar

merge keep

Updated on September 17, 2022

Comments

  • Alexar
    Alexar over 1 year

    I have all images of Debian, Ubuntu and Ubuntustudio as .iso. How can I use them as repository to install my desired packages with sudo apt-get install package-name?

    I easily mount the .iso file with Archive Mounter, but when adding CD-ROM in Software Sources it says Please Insert CD-ROM.

    How should I do this without burning them to disk?

  • Anwar
    Anwar about 12 years
    But this method is not working anymore. I tried this with xubuntu-11.10-alternate-iso, and it says Failed to mount '/dev/sr0' to '/media/apt/' and Unable to locate any package files, perhaps this is not a Debian Disc or the wrong architecture? .
  • Anwar
    Anwar about 12 years
    I think the second command is sudo mount /media/USB/aptoncd.iso /aptoncd-mountpoint -oloop without ~ before /aptoncd-mountpoint
  • BigSack
    BigSack almost 12 years
    Still not working!
  • web.learner
    web.learner over 9 years
    That wiki page doesn't exist. Can you explain your commands a little better? Thanks!
  • 3pic
    3pic almost 9 years
    -o loop not -oloop
  • WesternGun
    WesternGun over 7 years
    This is not working unless we add -m option to apt-cdrom to prevent auto unmounting. If not, the virtual "cd-rom" will be unmounted even if it's mounted beforehand. So the complete syntax is: sudo mount /iso/path /mount/point. And then, sudo apt-cdrom -d=/mount/point add -m
  • Sarit
    Sarit over 6 years
    This is an accepted answer
  • tardis
    tardis over 4 years
    At least for buster you get an error that is is not save. You have to add the following option: deb [trusted=yes] file:///path/to/mounted/file. I update the answer.
  • Adam Prall
    Adam Prall about 4 years
    I used this answer but with sudo for the mount commands, then temporarily added that to my ~/.bashrc while I set up this system.