Unattended installation from a list
For an unattended installation of a list of packages and adding several ppa to our system we may use the following script:
#! /bin/bash
# Save as e.g. 'uptodate' and make executable
# Usage:
# sudo ./uptodate <mysources> <packages>
sudo cp $1 /etc/apt/sources.list.d/mysource.list
sudo apt-get update
xargs -a "$2" sudo apt-get -y install
The script has two arguments. The first is a file (e.g. mysources
) in the script directory where we saved a list of our software sources according to specifications for a sources.list e.g.:
deb http://ppa.launchpad.net/<maintainer>/<name>/<ubuntu> <release> main
deb http://ppa.launchpad.net/<other_maintainer>/<name>/<ubuntu> <release> main
...
Replace all variables by the desired values
The second argument is a file (e.g. packages
) with a list of packages we wish to install in the format e.g.:
packagename
otherpackage
...
Save the script with e.g the name uptodate
, make it executable and run from a terminal:
cd /directory/of/script
sudo ./uptodate mysources packages
What does the the script do?
It just copies our mysources
list to /etc/sources.list.d/mysources.list
, updates package information and installs all packages from the packages
list we provided by using xargs.
Note: we may also have to download a valid key from launchpad keyserver to be able to install from the ppa we added.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 72D340A3
Replace the signing key (here 72D340A3) by the appropriate one
Note 2: It is a good idea to run the script in a terminal and not by a double-click because we do want to know about errors.
apt-get install -y
and it won't prompt you for the "Y to continue". Maybeadd-apt-repository
supports the same option? – Scaine Jan 09 '12 at 16:42add-apt-repository
supports-y
– jcollado Jan 09 '12 at 21:27