Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I first gonna explain the situation:

I have a Laptop which is connected to a wifi connection, and a Desktop which can not be connected to Internet (the modem is too far from it), and i want to install some software on the last one. (The two PCs are running Ubuntu 12.04, and are connected with an Ethernet cable)

I've already searched for a solution, but all I've found was the use of some softwares that should have been already installed on the "Internet-less PC". ( Keryx, APTonCD ... )

What I want to do is to create a mirror in my laptop which contain the packages i have in this one ( situated in /var/cache/apt/archive ) and i don't want to download all the packages from the official repository, I actually don't need them.

Can someone tell me if it is possible to do that ?

Thanks,

share|improve this question
    
have a look at help.ubuntu.com/community/AptProxy –  Mahesh Jun 22 '12 at 9:44
    
    
"If a package is not in the cache, apt-proxy automatically downloads and caches it." that's a problem for me, so AptProxy is not what i am searching for. I'm gonna take a look to the second link, it looks interesting. –  Sam Jun 22 '12 at 18:02
add comment

1 Answer

up vote 2 down vote accepted

Can someone tell me if it is possible to do that ?

Yes, it is possible, and I have been doing this my entire Ubuntu life. Downloading in one computer and use the packages in another.

AptOnCD can be downloaded in a single package, and installed in the Internetless computer, I assume you can do this. But you don't need any external software. Though I am writing both method, here.

AptOnCD method.

Downloading AptOnCD

  • Download AptOnCd from here.

    Under the section Binary packages, click on the link matching you machine architecture. If you use 32bit Ubuntu, you need i386 package, and if your system is 64bit you can download amd64.

enter image description here

The new link will bring you a page, just click on the package version link.

enter image description here

then click on the download link in the new page.

enter image description here

  • Put the downloaded .deb file in your home directory.

  • Open a terminal, while you are still in home directory, run this command to install the package.
    sudo dpkg -i ./sudo dpkg -i aptoncd_0.1.98+bzr117-1.2_all.deb. (AptOnCD has no other dependency, so it can be installed standalone). Filename may vary depending on your version selection and architecture.

  • After completing installation, Press Super + A to bring the Dash application lens. Type in the field, aptoncd, click on the Icon to start it.

Creating ISO file to use as a repository source.

When you start AptOnCD, the software will run on the default window, which have only two buttons. "Create" and "Restore".
enter image description here

  • Click on the Create Button. It will automatically scan your computers /var/cache/apt/archives folder for all .deb files. When scanning is completed, You will see a window similar to the below image.

enter image description here

  • You can add additional packages in other folder if you have, such like the downloaded aptoncd package. Also individual packages can be selected.

  • After it completed it's process, Click on the "Burn" button, a new window will appear like the below one.

enter image description here

  • In this window, type the name of the iso file, where it should create that iso, and check "Create a metapackage" option it you want to install all the included packages be installed on the internet less system, with installing a single package. Click on the Apply button.

  • After some time, depending on the number of packages, it will ask you whether you want to burn the iso file now. You can burn CD/DVD now, but I'll select no. Check in home folder to see that an iso file is created.

Adding the iso file as a source repository in the target computer.

  • Copy the iso file in the target computer. I assume that, you copy it in your home folder and the name of the iso file is aptoncd.iso.

  • Open a terminal, and type sudo mount ./aptoncd.iso /media/apt to mount the iso in /media/apt directory. If it says, The directory does not exists, simply create one with this command sudo mkdir /media/apt, and then try mount again.

  • After mounting, run this command to add this new cdrom as repository source. sudo apt-cdrom add. If you see a message like Repeat this process for the rest of the CDs in your set. Then the process is successful.

Installing from the new aptoncd repository

  • If you want to install a package, simply mount the iso in /media/apt folder. (see above section).
  • Then open a terminal, and run sudo apt-get install package-name.

local repository method.

There is a lot more easier method than using AptOnCD. Though I have included AptOnCD method as the question talked about that.

Copy all .deb files into the target computer

You need to copy all .deb files you download from /var/cache/apt/archives folder to a suitable folder in your target Internetless computer. I recommend you to copy all the files in a folder named debs which itself resides in a folder named LocalRepo. Meaning, .deb files are in LocalRepo/debs folder. You can put the LocalRepo folder wherever you wish. Let say, for example, I have put it in my home directory i.e. /home/anwar.

So, the folder structure is like below:

-/
 -/home
   -/anwar
    -/LocalRepo
     -/debs

where debs folder contains all the deb files you downloaded.

Generate packages index file

  • Open a terminal and go to the folder just above the Debs folder. In this example, it is /home/anwar/LocalRepo.

  • Run this command: while you are in LocalRepo folder.
    apt-ftparchive packages . > Packages
    It will create a Packages file in the LocalRepo directory.

Add your local repository in the repository source list

  • Open /etc/apt/sources.list file with root privilege
    sudo gedit /etc/apt/sources.list.

  • At the top of sources.list file, put a line like this.

     deb file:/home/anwar/LocalRepo /
    

    replace /home/anwar/LocalRepo with actual directory name where you put the LocalRepo folder.

  • Save the file, and exit gedit.

Update package indexes to be able to install from Local repo

  • Run sudo apt-get update in a terminal, It will create a repository source list about available repositories. So, your newly created Local Repository will be recognized.

Install packages from local repository.

  • Then run sudo apt-get install package-name
    (replacing package-name with actual package) to install your desired repository.

Note: You will always be warned about being your repository is not "Authenticated" one. In this case you can ignore such warning, since you created repository from packages of "Authenticated" sources, meaning Official Ubuntu Package archive.

You can override this warning by putting --allow-unauthenticated switch in the command. such as

 sudo apt-get install --allow-unauthenticated package-name

Creating a trusted repository instead:

If you want to create a trusted local repository, You should read this. It is very simple and very good one about the topic

share|improve this answer
    
Thank you, but the problem with AptOnCD is that every time I want to install a software I should burn a disc. –  Sam Jun 22 '12 at 17:56
    
AptOnCD can be used without burning disc. I think i have cleared that in the answer. And the answer is not completed yet. I am planning to include another very easy method. –  Anwar Shah Jun 23 '12 at 1:59
    
yeah i'm sorry, i hadn't read the whole answer when i commented. Thank you very much ! –  Sam Jun 23 '12 at 7:00
    
By the way,aptoncd does need depends, and all of them aren't installed by default. I have some problem installing it. –  Sam Jun 24 '12 at 13:32
1  
I installed the AptOnCD from the same link, anyway AptOnCD only requires installation on PC with internet, which should not be a problem. And the recommended method is "local repository method". –  Anwar Shah Jun 24 '12 at 13:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.