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/Ubuntu systems.
Advanced Packaging Tool (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.
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.
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.
Then non-interactive batch mode will be applied to a single invocation of "apt-get install".
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to install Suricata intrusion detection system on Linux - September 3, 2015
- How to switch from NetworkManager to systemd-networkd on Linux - August 31, 2015
- How to set up a system status page of your infrastructure - August 25, 2015