Install a Mirror without downloading all packages from official repository
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.
The new link will bring you a page, just click on the package version link.
then click on the download link in the new page.
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".
- 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.
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.
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 commandsudo 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 likeRepeat 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 aPackages
file in the LocalRepo directory.
Add your local repository in the repository source list
Open
/etc/apt/sources.list
file with root privilegesudo 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 theLocalRepo
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
(replacingpackage-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