How do I install multiple packages?
For example, I want to install both
package X and
Package Y, I know that this is not possible by default but is there any alternate way of doing this or Can I atleast queue them for installation?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
You can do this, why not!? You can run the following single command to install
sudo apt-get install package-x package-y
It has been mentioned that you can add the
-y flag to
apt-get to answer Yes to all the prompts. This usually only saves you from having to say Yes once, anyways. It's nice to know about the
-y flag, but be careful, because it can also automatically remove things that you may not want removed. Typically, I omit the
-y flag and manually review all Added or Removed packages to prevent myself from making mistakes that could have horrible affects on my computer. However,
apt-get upgrade -y seems to be a good option and less volatile.
sudo apt-get upgrade package-x package-y -y
To install packages use:
sudo apt-get install package-name
To install multiple packages simply list one after the other:
sudo apt-get install package-name1 package-name2 package-name3
apt-get install to answer
yes to any
are you sure you want to install this package? questions which may arise add a
-y to the end
sudo apt-get install package1 package2 package3 -y
I'm not sure about other users but I find it helpful to keep a file that has a list of all packages/programs that I commonly use so that in the event I need to reinstall I can simply copy and paste the command rather than having to spend the next few weeks figuring out what I have and haven't got.
As Angel identified below keeping a copy of
dpkg --get-selections will allow you to keep handy all the packages you had in case of reinstall.
You can also restore
pkg metadata by using
apt-mark showauto > auto.lst and
apt-mark showmanual > manual.lst to get metadata and
apt-mark auto < auto.lst and
apt-mark manual.lst to restore it.