Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: HOWTO: Download package dependencies for offline installation

  1. #1
    Join Date
    Jan 2006
    Location
    Guadalajara, Mexico
    Beans
    76
    Distro
    Ubuntu

    Lightbulb HOWTO: Download package dependencies for offline installation

    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.

    Follow these Steps:

    1. 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 grabpackages.py (attached). Type python grabpackages.py -h to see the help. This is the command you would use to download Inkscape and its dependencies:
      Code:
      python grabpackages.py -o download_script_file inkscape
      Now take download_script_file to the computer with internet access.
    2. 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:
      Code:
      mkdir packages_dir
      cd packages_dir
      Copy download_script_file into this directory and execute it:
      Code:
      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:

      1. Install wget

        In Debian/Ubuntu:
        Code:
        sudo apt-get install wget
        In Redhat/Fedora:
        Code:
        yum install wget
        In Windows: see here.
      2. 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 downloadscript2html.py (attached):
        Code:
        python downloadscript2html.py download_script_file download_page.html
        If not, grabpackages.py (attached) will work too (using the --html option). Revisiting the Inkscape example:
        Code:
        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).

    3. 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:
      Code:
      sudo cp *.deb /var/cache/apt/archives
      or start Nautilus as root and copy the files in the usual way.
    4. Install the packages

      Just open a terminal and type
      Code:
      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.

    Note:

    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.

    Additional references:

  2. #2
    Join Date
    Jun 2009
    Beans
    1

    Re: HOWTO: Download package dependencies for offline installation

    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:
    Code:
    python grabpackages.py --html -o download_page.html xchm
    Here is an example of the link generated:

    I hope someone could help.
    Attached Files Attached Files

  3. #3
    Join Date
    Feb 2008
    Location
    Ohio, USA
    Beans
    15
    Distro
    Ubuntu Development Release

    Re: HOWTO: Download package dependencies for offline installation

    Quote Originally Posted by potwak View Post
    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. #4
    Join Date
    Nov 2008
    Beans
    158

    Re: HOWTO: Download package dependencies for offline installation

    Quote Originally Posted by sergiodlc View Post
    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.

    Follow these Steps:

    [LIST=1][*]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. #5
    Join Date
    Oct 2009
    Beans
    1

    Re: HOWTO: Download package dependencies for offline installation

    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. #6
    Join Date
    Mar 2008
    Beans
    115

    Re: HOWTO: Download package dependencies for offline installation

    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.
    Last edited by sh4d0w808; October 7th, 2009 at 02:57 PM.
    Being a target means being on the internet. End of line.
    Takedown blog (hungarian)

  7. #7
    Join Date
    Jan 2009
    Beans
    9

    Re: HOWTO: Download package dependencies for offline installation

    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
    Code:
    python grabpackages.py -o download_script_file inkscape
    I get confused. Can someone please explain to me if the "inkscape" part of the command means it will only download packages associated to it and if so, does it mean I have to do the same for every software I wanna install? while on it, is it possible to have updates downloaded using this method?

    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. #8
    Join Date
    Nov 2009
    Location
    Moscow
    Beans
    2
    Distro
    Kubuntu 9.10 Karmic Koala

    Re: HOWTO: Download package dependencies for offline installation

    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. #9
    Join Date
    Jan 2006
    Location
    Guadalajara, Mexico
    Beans
    76
    Distro
    Ubuntu

    Re: HOWTO: Download package dependencies for offline installation

    Quote Originally Posted by kirzhanov View Post
    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. #10
    Join Date
    Jan 2006
    Location
    Guadalajara, Mexico
    Beans
    76
    Distro
    Ubuntu

    Re: HOWTO: Download package dependencies for offline installation

    Quote Originally Posted by tsh3po View Post
    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
    Code:
    python grabpackages.py -o download_script_file inkscape
    I get confused. Can someone please explain to me if the "inkscape" part of the command means it will only download packages associated to it and if so, does it mean I have to do the same for every software I wanna install? while on it, is it possible to have updates downloaded using this method?

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

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •