Ubuntu Forums Archive Viewer

HOWTO: Download package dependencies for offline installation

Archived thread 1100816 from Outdated Tutorials & Tips. Markdown source: Outdated_Tutorials_&_Tips/thread_1100816_HOWTO_Download_package_dependencies_for_offline_in.md

Original URL About this archive
#1

Have you ever been into trying to install a package in a computer that is not connected to the network? Keep reading to find solutions to this problem.

[SIZE="4"]_Follow these Steps:_[/SIZE]

  • Find out what packages have to be downloaded

Case 1: You have a recent synaptic version.

The first step would be to open Synaptic and select the package(s) you want to install. Then go to *File -> Generate package download script* and save it naming it as you want (herein referred as *download_script_file*).

Case 2: You don't have a recent synaptic version or you are not using any window manager.

Use [ATTACH]106990[/ATTACH] (attached). Type *python grabpackages.py -h* to see the help. This is the command you would use to download Inkscape and its dependencies:

python grabpackages.py -o download_script_file inkscape

Now take *download_script_file* to the computer with internet access.

  • Download the packages

Case 1: The computer with internet access has a linux OS with wget installed.

Open a terminal and *cd* to a suitable directory (e.g. *cd /tmp*).

Create a directory to download the packages and *cd* into it:

mkdir packages_dir
cd packages_dir

Copy *download_script_file* into this directory and execute it:

sh download_script_file

The script begins to download the files using wget.

Case 2: You have a Windows/Linux box but wget is not installed.

You could try one of these:

In Debian/Ubuntu:

sudo apt-get install wget

In Redhat/Fedora:

yum install wget

In Windows: see here.

  • Generate an html page and download the packages from your browser

If you already have the download script file generated by synaptic, the easiest way is to use [ATTACH]106997[/ATTACH] (attached):

python downloadscript2html.py download_script_file download_page.html

If not, [ATTACH]106990[/ATTACH] (attached) will work too (using the *--html* option). Revisiting the Inkscape example:

python grabpackages.py --html -o download_page.html inkscape

Now open *download_page.html* in your browser and download the linked files in your download directory (here a download accelerator like DownThemAll is very useful, specially with large files).

  • Copy the packages to your PC

Copy the .deb files you downloaded to */var/cache/apt/archives*:

From the directory where the .deb files are stored type:

sudo cp *.deb /var/cache/apt/archives

or start Nautilus as root and copy the files in the usual way.

  • Install the packages

Just open a terminal and type

sudo apt-get install <package_name(s)>

replacing *<package_name(s)>* with the name(s) of the program(s) you wanted to install (E.g. *inkscape*).

This should be pretty much everything.

[SIZE="4"]_Note:_[/SIZE]

The attached scripts are written in Python. In some systems Python is not installed by default. See http://www.python.org/download/ to solve this.

[SIZE="4"]_Additional references:_[/SIZE]

#2

Hi. Thanks for this good and usefull post, I am working in an offline PC and trying to learn Linux right now.

My problem is, the links from the generated html file is broken (please see attached zipped html file). I hope to install xchm on my Ubuntu 7.04 btw. Can you help me solve my problem?

I used this command to generate the html file:


python grabpackages.py --html -o download_page.html xchm
 [http://archive.ubuntu.com/ubuntu/pool/main/i/imagemagick/libmagick9_6.2.4.5.dfsg1-0.14ubuntu0.1_i386.deb](http://archive.ubuntu.com/ubuntu/pool/main/i/imagemagick/libmagick9_6.2.4.5.dfsg1-0.14ubuntu0.1_i386.deb)
#3

potwak said: I hope to install xchm on my Ubuntu 7.04 btw. Can you help me solve my problem?

The problem is going to be that your version of Ubuntu has reached its End Of Life. The links to packages created from the HOWTO are broken because those versions have been removed from Ubuntu's active repositories.

However, they do keep an archive of older packages at a different location. If you change the address in the link from archive.ubuntu.com to old-releases.ubuntu.com you may be able to at least get most of the packages you need.

#4

sergiodlc said: Have you ever been into trying to install a package in a computer that is not connected to the network? Keep reading to find solutions to this problem.

[SIZE="4"]_Follow these Steps:_[/SIZE]

  • Find out what packages have to be downloaded

Case 1: You have a recent synaptic version.

The first step would be to open Synaptic and select the package(s) you want to install. Then go to *File -> Generate package download script* and save it naming it as you want (herein referred as *download_script_file*).

does this only work if you don't have the package and all its dependencies already installed?

i already have a package and it's dependencies installed, and i want to install the same package+dependencies on another computer that isn't connected to the network.

when i select the "Generate package download script" option i get a file with just "#!/bin/sh" at the top.

i guess we are supposed to do this part on the computer that is not connected to the internet and doesn't have the package installed?

anyway, the python script has worked fine for me. thanks!

#5

Guys... this does not under Windows :( (Python 2.6.3 installed)

D:\>python grabpackages.py --html -o download_page.html inkscape Traceback (most recent call last): File "grabpackages.py", line 86, in <module> packages = get_debs(args, options.repo, options.archivecheck) File "grabpackages.py", line 50, in get_debs archive = set(os.listdir('/var/cache/apt/archives')) WindowsError: [Error 3] The system cannot find the path specified: '/var/cache/apt/archives/*.*'

D:\>python grabpackages.py -o download_script_file inkscape Traceback (most recent call last): File "grabpackages.py", line 86, in <module> packages = get_debs(args, options.repo, options.archivecheck) File "grabpackages.py", line 50, in get_debs archive = set(os.listdir('/var/cache/apt/archives')) WindowsError: [Error 3] The system cannot find the path specified: '/var/cache/apt/archives/*.*'

#6

Yes, because Windows doens't have /var/cache/apt/archives and very similar directories or filesystems... As I see, this script is intended to work on Linux systems.

#7

Hi everyone...

Sorry to wake up a dead post like this, the thing is I plan on installing 9.04 server edition on my home PC and obviously run Vmware on it and manage my virtual machines via my desktop edition running on my lappy. Now the problem with this is that my home machine doesn't have internet access, I can only access the net only at work, now looking at this command ``` python grabpackages.py -o download_script_file inkscape


Please dont kill me as I havn't tried it yet, but I was hoping to use this method to download the headers needed for Vmware, will it work or am I going nuts?

Thanks in advance
#8

Is it possible to use this script to download the packages for the 64-bit system? My system with an Internet connection uses packages for i386. It seems that I need to specify an alternate repository to download 64-bit packages, but I could not find the URL 64-bit Ubuntu repository... :(

Thanks

#9

kirzhanov said: Is it possible to use this script to download the packages for the 64-bit system? My system with an Internet connection uses packages for i386. It seems that I need to specify an alternate repository to download 64-bit packages, but I could not find the URL 64-bit Ubuntu repository... :(

Thanks

The script admits the -r option to change the repository.

#10

tsh3po said: Hi everyone...

Sorry to wake up a dead post like this, the thing is I plan on installing 9.04 server edition on my home PC and obviously run Vmware on it and manage my virtual machines via my desktop edition running on my lappy. Now the problem with this is that my home machine doesn't have internet access, I can only access the net only at work, now looking at this command ``` python grabpackages.py -o download_script_file inkscape


Please dont kill me as I havn't tried it yet, but I was hoping to use this method to download the headers needed for Vmware, will it work or am I going nuts?

Thanks in advance

"inkscape" is just an example package. Instead you should write the package names (separated by spaces) of the packages you intend to install.

If you have ~30 GB of spare hard disk space in your laptop a much better solution would be to download the complete repository using apt-mirror, [as explained here]("http://ubuntuforums.org/showthread.php?t=599479"). Then you can access the local repository in your laptop from your home PC (provided that they can be connected ;)).

Instead of VMWare I would suggest Virtualbox, an open source virtualization solution that works just fine.

Sergio
#11

I've been using offline method for everything that is installed on my machine since 8.04.

The download script that synaptic generates is actually a bash script with wget commands. In other words, it is simply a text file containing the links, in my pc it is something like: #!/bin/sh wget -c <web address to that file>

So if you don't have wget installed, there isn't any need. Just open the file using a text editor and download all those files to a folder using any standard browser.

#12

Apt-get command doesn't generate download script?? Come on! Why not? Thanks for the grabpackages.py!

Apt-get command doesn't generate download script?? Come on! Why not? Thanks for the grabpackages.py!

Compare with another mothod http://www.tuxradar.com/answers/517

The list generated by grabpackages.py is very long, while the list generated by apt-get+grep+cut is short[as needed by apt-get] and easier with fewer steps =)

#13

meka4996 said: Apt-get command doesn't generate download script?? Come on! Why not?

Thanks for the grabpackages.py!

Apt-get command doesn't generate download script?? Come on! Why not? Thanks for the grabpackages.py!

Compare with another mothod http://www.tuxradar.com/answers/517

The list generated by grabpackages.py is very long, while the list generated by apt-get+grep+cut is short[as needed by apt-get] and easier with fewer steps =)

Yes, the list is longer because grabpackages.py lists any package needed even by the dependencies of the given package (you can activate an option to avoid listing packages that are already in your local cache). This way you don't end up frustrated for a missing package.

#14

Vist:- http://www.keryxproject.org/ then you can download packages with its dependencies at once using another online pc. That online pc could Ubuntu or windows pc.

#15

meka4996 said: Apt-get command doesn't generate download script?? Come on! Why not?

Thanks for the grabpackages.py!

Apt-get command doesn't generate download script?? Come on! Why not? Thanks for the grabpackages.py!

Compare with another mothod http://www.tuxradar.com/answers/517

The list generated by grabpackages.py is very long, while the list generated by apt-get+grep+cut is short[as needed by apt-get] and easier with fewer steps =)

Thanks a lot! Using this command you can generate a summarized suitable list of all packages needed to update your command-line based system (For example Ubuntu Server Edition):

apt-get --print-uris --yes upgrade | grep ^\' | cut -d\' -f2 >downloads.list

You can also change the work upgrade to install <package_name> to install any package with name <package_name>. Hope this helps.