Tag/tag.png

Style Cleanup Required
This article does not follow the style standards in the Wiki Guide. More info...

Note: You would alternatively first try Synaptic/PackageDownloadScript. For command line use see AptGet/Offline

Compare this to apt-medium.

How to use (Ubuntu's) Synaptic offline (v6.06) - this tutorial also works on other Ubuntu versions, such as 4.10 or 10.04.

As Ubuntu users could have noticed, its distribution comes with a tool named Synaptic, for managing the install process of the .deb files (which i think Synaptic is a mere shell over apt-get), which tool can be used with CDs with .deb files (just like that Ubuntu's install CDs, now named as Alternate), as from the Ubuntu official ftp repositories and mirrors, as well they say Synaptic can work over our own hard disk .deb repositories (i never could get this working successfully)

But, that is it, while the .deb ftp repository installing seems to be like something magic for the people who are online, it can be a true torture for people never got online with Ubuntu (as i'm living in Portugal, the usual internet providers are not that popular on their quality of service, Linux support and fair taxes, which the most obvious choice would be using 56k dial-up connections, which usage with Synaptic or apt-get would be completelly silly - just try to download this way some .deb with tenths or hundreds of megabytes and their respectivelly dependencies and subdependencies...)

The solution i find: since Synaptic (or apt-get) works over a database, which presuposelly would be a simple format (a .txt-like), and if Synaptic recognizes CDs and FTPs somehow in the same way, i assumed all are organized in the same way.

In the Ubuntu's 6.06 Install CD (that alternate .iso available from the Ubuntu webpage) i found the following files at /media/cdrom/:

- dists/dapper/main/binary-i386/Packages.gz - dists/dapper/restricted/binary-i386/Packages.gz

(i'm citing the example of i386 - amd64 or ppc should be similar)

The CD hasn't the folders universe and multiverse, but these normally exist in the ftp repositories

I looked for some mirror, and i found the files (I chosed bz2 for being more compressed, and i think they can be found also uncompressed (filename without suffix), or compressed in .gz format):

(these are from i386 binaries - amd64 and ppc should be somewhere around)

And so, i uncompressed and renamed each file:

  • packages_main.txt
  • packages_universe.txt
  • packages_multiverse.txt
  • packages_restricted.txt

To join these 4 .txt in just one we can use following script: juntar.sh:

cat packages_main.txt > packages_dapper.txt
cat packages_universe.txt >> packages_dapper.txt
cat packages_multiverse.txt >> packages_dapper.txt
cat packages_restricted.txt >> packages_dapper.txt

And in the console, in the directory where is placed this script and the 4 .txt cited above, we enter:

bash ./juntar.sh

And confirm if there is a file named packages_dapper.txt with almost 17mb, since this would be the file must be created

—(Just for curiousity, for who comes from DOS/Windows, the script above is similar to the .bat below (i tried to recode in the way more similar possible for seeing more clearly their differences): juntar.bat:

copy packages_main.txt packages_dapper.txt
copy /b packages_dapper.txt + packages_universe.txt
copy /b packages_dapper.txt + packages_multiverse.txt
copy /b packages_dapper.txt + packages_restricted.txt

(note: I think the .bat above only works on dos/windows - on Linux, the copy command may show something like: 'bash: copy: command not found') (each of the above scripts can be useful for concatenating text files, it's just trying to see how they work) )—the advantage of this .txt sized almost 17mb is, as we do 'search' in the Synaptic and we can access all their database informations, like description and dependencies, we also can do it with a simple .txt editor like Gedit... (and who says Gedit says Notepad (which can crash, due to the size of the file), Editpad, Scite, etc.)

It's also incredible how just the fact of we having some curiousity of get reading this document, we get to know about programs would we very dificulty would know in any other way, at least in a so short time...

Next task: extract just the URLs of each .deb, having all of them in just one txt.

Reading the file packages_dapper.txt or any other, all of the fields of the database of the .deb always has the same estructure:

- Package:
- Priority:
- Section:
- Installed-Size:
- Maintainer:
- Architecture:
- Source:
- Version:
- Depends:
- Filename:
- Size:
- MD5sum:
- Description:
- Bugs:
- Origin:

Well, as i only needed what were in the 'Filename:' lines, i coded the script below:

AptPackageFilenameExtractor.py:

#! /usr/bin/python
# -*- coding: latin-1 -*-
#- usage: 'python AptPackageFilenameExtractor.py package.txt > result.txt'
import os,sys
finp_st=sys.argv[1];finp_fl=open(finp_st,"r")
while True:
text_st=finp_fl.readline()
if len(text_st)==0:break
text_st=text_st.replace("n","")
if text_st[:9]=="Filename:":
print text_st
finp_fl.close()

(the size and simplicity of this script can be encouraging for that they want to learn python! Wink ;-) ) (who will have curiosity or necessity, I have more scripts in http://nitrofurano.linuxkafe.com/python)E in consoles, in the directorio of the folder where I wrote this script, I entered:

python AptPackageFilenameExtractor.py packages_dapper.txt > packages_dapper_urls.txt

And the result (packages_dapper_urls.txt) is about 1.7mb And finally, use replace (ctrl+h) from Gedit to replace ‘Filename: pool/’ to, for example, ‘http://ubuntu.secs.oakland.edu/pool/’ (this last one could be also a mirror from any choice (see at end of this article), since it ends with ‘/pool/’ (in the case of mirrors below, ‘/pool/’ should be added after the url - should be useful looking around with Firefox these directories to understand how they are organized))

For short, the lines like: Filename: pool/main/i/inkscape/inkscape_0.43-4ubuntu3_i386.deb would be like:

Now, we only will need to see which .deb we need, and we do a download list (the greater part of the minimally good download managers allows you to import these .txt as a url list (for w32 there is DownloadAccelerator, FlashGet, etc. - and for Linux i think WebDownloaderForX can work in the same way))

Having this list ready, but if we don't want to search and copy by hand the urls we want (just like when we want to download more than 100 packages, just like usually happen with me), we can use a script to get this exact list automatically.

To extract from this generated list of .deb files just only those ones we want, we create a list like:

list.txt:

libforms1
libkdeedu3
libforms1
libffcall1-dev

It's important verifying each text line only have the exact name of each package, and there is no space character after, or empty lines before, between or after of the ones having these names - anyway the code below is too much simple to avoid these situations...)

And the script below is what will make all the searching process from the list with all of the urls of the repository for the final desired urls list, based on the file list.txt above:

synapticlistextractor.py:
#! /usr/bin/python
# -*- coding: latin-1 -*-
#- Synaptic List Extractor - 0611261234 - Paulo Silva - GPL licence
#- usage: python synapticlistextractor.py list.txt urlswholesynaptic.txt > final.txt
import os,sys
finp1_st=sys.argv[1];finp1_fl=open(finp1_st,"r");finp2_st=sys.argv[2]
while True:
text1_st=finp1_fl.readline()
if len(text1_st)==0:break
text1_st=text1_st.replace("r","")
text1_st=text1_st.replace("n","")
finp2_fl=open(finp2_st,"r")
while True:
text2_st=finp2_fl.readline()
if len(text2_st)==0:break
text1_st=text1_st.replace("r","")
text2_st=text2_st.replace("n","")
if text2_st.find("/"+text1_st+"_")>-1:print text2_st;break
finp2_fl.close()
finp1_fl.close()

So, we will have in a folder the 3 needed files: the script above, the desired list, and the list with all urls of the repository, and we run on the console, in the same folder directory, with:

python synapticlistextractor.py lista.txt urlswholesynaptic.txt > listafinal.txt

And presuposely we will have the files listafinal.txt, somehow similar to that wget list generated by Synaptic.

A good idea as well would be getting aware of some mirrors may not being 100% complete as it seems from the package database file they provide - if it happens, try to get the same file from other mirror addresses

When bringing these .deb back for the Linux, and having these .deb all inside one folder, in the console we access this folder directory, and do:

sudo dpkg -i *.deb

And let it go on…

Also you can use your desktop file manager (i.e. Nautilus) and click in the deb package. The page is going to be automatically installed using Gdebi.

When finishing everything, from Synaptic, i saw some .deb were installed, but other got missing some dependencies (that names in oblique text), and there i writed all these missing back in a .txt, and got searching each one in the file packages_dapper_urls.txt - and with the ready list, one more download of the missing .deb, and so on…

But, of course, we also can download all of the .deb of packages_dapper_urls.txt, but everything together must take some 12gb (hugelly beyond the monthly traffic limit from the portuguese internet providers, for example...) - but the advantage is it practically avoids yout constantly needing to access the ftp repository all the time (except updates, of course…), as well having the possibility of having in your hands 3 ready 4.7gb DVDs to install on any offline computer you may know.

Well, all of this procedure may look like an unsane task, specially in a newbie or average-Joe viewpoint, but overally, this method is anyway lots better than nothing...

Well, the good side is i got more than 2gb of .deb which i'm completelly assured i will not need to download again and again in the eventuality of having to reinstall Ubuntu (situations like hard disk replacement, stability lack, bad configuration i couldn't fix around, disastrous usage when logged in as root or sudo, or any thing else) - this surelly may be useful to lots of people, specially with the true average internet quality we have worldwidelly (specially talking about mostly africa, mid-asia, some arabian countries, latin america, etc.)

Well, what is really missing for this .deb folder is a kind of package file would be easily recognized by Synaptic, and from this folder or alike, we could create our own Synaptic CDs, which would be enough only using Synaptic, and finally stop using 'sudo dpkg -i *.deb' in the console (and if someone knows how can we create a 'packages' file can be recognized by Synaptic, please let us know...'), and so these CDs can be used on as many computers you need or want, working just like a kind of extras CD we can have always with our Ubuntu install CD for any eventuality of ahving to reinstall Ubuntu, or copying these CDs or install them in friend's computers and alike, on install parties, schools, on computers we somewhen will buy after having them installed on the older computer, etc.

I also know that Synaptic (at least that one comes in the Ubuntu 6.06) has Menu->File->GeneratePackageDownloadScript and Menu->File->AddDownloadedPackages, but the problem is the second one only works after we used the first one, not only saying that we have to have in the Synaptic the packages of these mirrors, a thing i have no idea of how can i get it working, and even worse of how can we edit and which file is readed from AddDownloadedPackages (if lucky it may be some xml at somewhere?) - i tried to ask some mails with Synaptic authors, but something says me not that soon this situation can be solved, and my very limited programming knowledge and how Synaptic or apt-get works surelly are very far for what would be useful for helping them...)

See also

Apendices

URIS

Mirrors

About mirrors, in the site packages.ubuntu.com i found these ones (they may change or get offline meanwhile):

South America:

http://ftp.interlegis.gov.br/pub/ubuntu/archive

http://ubuntu.c3sl.ufpr.br

North America:

http://ftp.cs.umn.edu/pub/ubuntu

http://mirror.clarkson.edu/pub/distributions/ubuntu

http://ubuntu.mirrors.tds.net/ubuntu

http://itanix.rutgers.edu/ubuntu

http://www.opensourcemirrors.org/ubuntu

http://ftp.ale.org/pub/mirrors/ubuntu

http://ubuntu.secs.oakland.edu

Asia:

http://archive.ubuntu.org.cn/ubuntu

http://komo.vlsm.org/ubuntu

http://kambing.vlsm.org/ubuntu

http://ubuntu.csie.ntu.edu.tw/ubuntu

http://mirror.isp.net.au/ftp/pub/ubuntu

http://www.planetmirror.com/pub/ubuntu

Europe:

http://archive.ubuntu.com/ubuntu

http://ubuntu.inode.at/ubuntu

http://ubuntu.uni-klu.ac.at/ubuntu

http://gd.tuwien.ac.at/opsys/linux/ubuntu/archive

http://ftp.belnet.be/pub/mirror/ubuntu.com

http://mirror.freax.be/ubuntu/archive.ubuntu.com

http://archive.ubuntu.cz/ubuntu

http://mirrors.dk.telia.net/ubuntu

http://mirrors.dotsrc.org/ubuntu

http://mir1.ovh.net/ubuntu/ubuntu

http://ftp.inf.tu-dresden.de/os/linux/dists/ubuntu

http://www.artfiles.org/ubuntu.com/archive

http://ftp.rz.tu-bs.de/pub/mirror/ubuntu-packages

http://ftp.join.uni-muenster.de/pub/mirrors/ftp.ubuntu.com/ubuntu

http://ftp.kfki.hu/linux/ubuntu

http://ubuntu.odg.cc

http://ftp.esat.net/mirrors/archive.ubuntu.com

http://ftp.heanet.ie/pub/ubuntu

http://na.mirror.garr.it/mirrors/ubuntu-archive

http://ftp.litnet.lt/pub/ubuntu

http://ubuntu.synssans.nl

http://ubuntulinux.mainseek.com/ubuntu

http://ftp.acc.umu.se/mirror/ubuntu

http://mirror.switch.ch/ftp/mirror/ubuntu

http://www.mirrorservice.org/sites/archive.ubuntu.com/ubuntu

Important: This article is about installing the common .deb files, like applications, games, libraries, themes, typefaces, documentation, examples, plugins, etc.

for the .deb which may affect/change the configuration of the operative system (at the point Ubuntu must be reinstalled, like happened with me several times...), like .deb with kernel, xorg, grub/lilo, etc., or those which needs a special configuration, must be obviously have their respectivelly care, like avoiding to do 'sudo dpkg -i *.deb' on a folder where these .deb are also there (like a folder where is all of the 12gb of .deb files from the 6.06 ftp Ubuntu repository, or all 650mb of .deb from a CD or from the alternate install CD, all of the 4.7 or 9.4 from a whole DVD, or all 3gb of the official Ubuntu 6.06 install DVD )

Author: Nitrofurano


adding this information after seeing a question at Ubuntu Full Circle pdf magazine, issue 31, page 26:

what must be done for burning a DVD which is recognizable this way is:

having a folder where all contents of the DVD will be burnt, as root files of it.

inside this folder, we create a 'pool' directory. inside of it we have stored all .deb files we needed there, anyway we want (no matter the folder is it inside or not) - the important is the .deb files are somewhere inside this 'pool' folder

on a terminal at this directory, we do: (assuming apt-ftparchive command is installed)

apt-ftparchive packages pool/ > Packages
apt-ftparchive packages pool/ | gzip > Packages.gz
apt-ftparchive packages pool/ | bzip2 > Packages.bz2

so, after running this, we have at './' :

./pool (folder with .deb files inside)
./Packages
./Packages.gz
./Packages.bz2

it's important all of these 3 files being created completelly, since these files has all database needed from apt-get (and Synaptic as well)

and later, we will need more 3 files:

./.disk/info
./aptoncd.info
./README.diskdefines

i'm not showing what i have inside one of these 3 files - i'll take as example what i have on some old DVDs i have stored:

inside ./.disk/info : (yes it's a file inside a hidden folder)

Hardy extras dvd 3/5 - i386 (2008-04-30 22:08)

inside aptoncd.info :

aocversion: 0.1
distribution: ubuntu
codename: hardy
architecture: i386
date: 2008-04-30 22:08

inside README.diskdefines :

#define DISKNAME  Hardy extras dvd 3/5 - i386 (2008-04-30 22:08)
#define TYPE  binary
#define TYPEbinary  1
#define ARCH  i386
#define ARCHi386  1
#define DISKNUM  1
#define DISKNUM1  1
#define TOTALNUM  1
#define TOTALNUM1  1

as expected, we can see easily what must be edited to fit our needs about the CD or DVD repository identity - good way to check this is compairing some Ubuntu install CDs (also named alternate-CDs ) - check the differences, and be sure about what to edit in these 3 files

and of course, check if all info inside these files are correct, for avoiding some lemon-tasted surprises...

and so, at this point, we may have at './' :

./pool (folder with .deb files inside)
./Packages
./Packages.gz
./Packages.bz2
./.disk/info
./aptoncd.info
./README.diskdefines

and so, now is the time of burning the CD or DVD - if burning the folder content from a tool like Brasero may provide errors, maybe will be needed to make a .iso of this folder content, and latelly burn this .iso file: (assuming mkisofs command is installed)

mkisofs -joliet-long -o /home/guest/Desktop/hardy_dvd3.iso /media/hda1/Ubuntu/Ubuntu804_HardyHeron/dvd3/

after having the CD or DVD burnt, is time to check if it behaves just like an installable one, just like an alternate or extra Ubuntu CD or DVD - and having stuff there like all Ubuntu repositories inside! Smile :)


CategoryNetworking CategoryOffline CategoryPackageManagement

Synaptic/Offline (last edited 2009-12-12 01:03:37 by nitrofurano-3t)