Last updated on July 22, 2020 by Dan Nanni
If you are a system admin, at some point you may have wondered how to install a list of software packages in one shot. Manually installing software programs on multiple Linux systems would be a tedious job, and your time can be better spent elsewhere. If you seek to install multiple packages in non-interactive batch mode, you can check out this guideline. This is for Debian or Ubuntu systems.
APT is a Debian way of managing software packages. APT handles installation, removal and update of software packages, as well as automatically resolves problems of inter-package dependencies. As such, APT is ideal for non-interactive package installation.
If you have a text file containing a list of software packages to install, you can bulk install all the packages in one shot as follows.
$ sudo apt-get install -y `cat package.txt | tr "n" " "`
In the above, I assume that package.txt
contains a list of package names (one package name in each row). The -y
option forces yes
for every confirmation dialog during installation, and thus is necessary in non-interactive batch mode.
While apt-get install
command can easily override any confirmation prompt with -y
option, apt-get upgrade
that can pop-up various screens for configuration and warnings may not work. For example, when you upgrade your kernel using apt-get
, you cannot circumvent a pop-up screen warning of reboot. In order to get around such pop-up configuration screens as well, there are two ways to do it.
In order to force non-interactive mode in apt-get
system-wide, you can use reconfigure debconf
as follows.
$ sudo dpkg-reconfigure debconf
In the subsequent package configuration screen, choose noninteractive
interface. Then you won't be asked any question while using apt-get
.
If you think that such system-wide change is too risky, you can set DEBIAN_FRONTEND
environment variable to enter a temporary batch mode as follows.
$ sudo DEBIAN_FRONTEND=noninteractive apt-get install `cat package.txt | tr "n" " "`
Then non-interactive batch mode will be applied to a single invocation of apt-get install
.
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean