特殊:Badtitle/NS100:SynapticOffline

来自Ubuntu中文
Oneleaf留言 | 贡献2007年5月24日 (四) 14:45的版本 (新页面: {{From|https://help.ubuntu.com/community/SynapticOffline}} {{Languages|UbuntuHelp:SynapticOffline}} How to use (Ubuntu's) Synaptic offline (v6.06) As Ubuntu users could have noticed, it...)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳到导航跳到搜索
可打印版本不再受到支持且可能有渲染错误。请更新您的浏览器书签并改用浏览器默认打印功能。

{{#ifexist: :SynapticOffline/zh | | {{#ifexist: SynapticOffline/zh | | {{#ifeq: {{#titleparts:SynapticOffline|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:SynapticOffline|1|-1|}} | zh | | }}


How to use (Ubuntu's) Synaptic offline (v6.06)

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...)

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):

- http://ubuntu.secs.oakland.edu/dists/dapper/main/binary-i386/Packages.bz2 (605kb) - http://ubuntu.secs.oakland.edu/dists/dapper/universe/binary-i386/Packages.bz2 (2.3mb) - http://ubuntu.secs.oakland.edu/dists/dapper/multiverse/binary-i386/Packages.bz2 (93kb) - http://ubuntu.secs.oakland.edu/dists/dapper/restricted/binary-i386/Packages.bz2 (4.5kb)

(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:

  1. !/bin/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:

  1. ! /usr/bin/python
  2. -*- coding: latin-1 -*-
  3. - 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_stUbuntuHelp: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!  ;-) ) (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: http://ubuntu.secs.oakland.edu/pool/main/i/inkscape/inkscape_0.43-4ubuntu3_i386.deb

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:

  1. ! /usr/bin/python
  2. -*- coding: latin-1 -*-
  3. - Synaptic List Extractor - 0611261234 - Paulo Silva - GPL licence
  4. - 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…

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...)

---

apendice: 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


[home][list][edit][admin][diff][changes][SynapticOffline] :: last change: 12 April 2007 12:59 pm :: vwiki was powered by htmlarea