Results 1 to 4 of 4

Thread: How to install a list of packages from a text file

  1. #1
    Join Date
    Jul 2011
    Location
    The Great Ocean
    Beans
    Hidden!
    Distro
    Lubuntu

    How to install a list of packages from a text file

    Everyone knows that it's easy to install Lubuntu on a new PC.
    Did you also know that it's easy to take a list of packages and install them automatically?

    I based this post loosely on this.

    open terminal (of course)
    assuming you have a file named packages.txt that looks like this:
    Code:
    firefox
    vim-gtk
    guake
    xchat-gnome
    vlc
    ispell
    wordnet
    rar
     unrar
    htop
    text file needs to list exactly one package per line, and no extra lines!

    now in the terminal, execute the following 4 lines individually: (note the parens)
    Code:
    sudo su
    apt-get install dselect 
    while read line;do echo -en "$line install\n"; done <packages.txt|dpkg --set-selections
    dselect
    (type i at the prompt)

    And it starts!

    what I did, was every time I installed a package, i added a line to a text file named 'packages.txt'
    So, I'm not installing anything not listed in the packages.txt file
    Enjoy!

    another way here
    Last edited by marinara; March 19th, 2012 at 12:02 PM.

  2. #2
    Join Date
    Jul 2011
    Location
    The Great Ocean
    Beans
    Hidden!
    Distro
    Lubuntu

    Re: How to install a list of packages from a text file

    ok in the above, packages.txt is the name of the package listing. you will need to run dselect after you read the file with the bash script.
    type i to install and wait

  3. #3
    Join Date
    Jun 2006
    Location
    Brisbane Australia
    Beans
    713

    Re: How to install a list of packages from a text file

    This is much easier.
    Code:
    sudo xargs -a packages.txt apt-get install

  4. #4
    Join Date
    Jul 2008
    Location
    Lubuntu One Stop Group
    Beans
    141
    Distro
    Lubuntu 11.10 Oneiric Ocelot

    Re: How to install a list of packages from a text file

    An easier way is to make your text file like this:

    firefox install
    vim-gtk install
    clementine install
    cowsay install
    and then do:

    sudo dpkg --set-selections < packages.txt
    sudo apt-get -u dselect-upgrade
    The advantage is that it allows you to remove packages as well, so you can replace install next to a package name with purge and it will remove that package. Also, there's no need to install the dselect package with this method.

    Cheers
    My Blog
    Using Kubuntu + Lubuntu

    Give me ambiguity or give me something else.

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
  •