0

I've found several posts about mass installing Linux packages with one command here, here, and here.

Here's my situation. I'm in a 3rd-world country right now with limited internet access. I want to know if there's a way to download a bunch of packages, store them somewhere, and write a little bash script to mass install them.

Is there a website that has a repository where I can do a one-time download of these permanently instead of having to use a bunch of data doing "apt-get" every time I try out a fresh installation of a Linux distro?

After I download these is there a way I can easily install them all these deb or tar files by writing a little bash script?

  • sudo apt-get download <package_name> will down the package but won't install so you could write a script to download all files in a text file with the names of the packages passed to that commad! Then to install them from some directory you put them into do sudo apt-get install *.deb in that folder where they all are! – George Udosen Nov 29 '18 at 9:57
1

To download them all:

  1. Create a text file with their names, one on each line.
  2. Create a folder to store these package files:

    mkdir ~/packages_store
    
  3. Read and download the deb file of each package on that list:

    #!/usr/bin/env bash
    
    # Change to the storage folder
    # or exit if it doesn't exist
    cd ~/packages_store || exit
    
    # Remove blank lines first then read
    # from file
    
    sed '/^$/d' "$1" | while read -r line; do            
        apt-get download "$line"
    done
    
    • Usage: chmod +x myscript.sh, then sudo ./myscript.sh /path/to/text_with_packagenames
  4. To install all:

    1. Change into that folder cd ~/packages_store
    2. Run installer:

      sudo apt-get install *.deb
      

Hopefully this is what you’re looking for!

| improve this answer | |
  • Could you explain what your sed | while block does? Wouldn’t < "$1" xargs apt-get download do the work? – Melebius Nov 29 '18 at 12:50
  • It removes spacd's that OP might add. And that works please add an answer using that method. – George Udosen Nov 29 '18 at 13:04
  • And @melebius when dealing with an inexperienced it's best to take it slow break it down so they learn and improve at their own pace! – George Udosen Nov 29 '18 at 13:28
  • Thank you for the script. Can you clarify how/where I can get these deb packages? I'm running Bodhi 4, and I think it's a Xenial Ubuntu, but when I go to the package list on this site nothing is there: packages.ubuntu.com/xenial/allpackages – Benji A. Nov 29 '18 at 14:51
0

Here is the repository of Ubuntu Packages. Search desired package with ubuntu flavour and install it with apt procedure.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.