Check and install multiple packages if not installed - using bash [closed]How to know whether a particular package is installed on ubuntu?How to make Python-3.4.2 use already installed Numpy?Apt-get install multiple packages without stoppinghow to find which packages from official Ubuntu repositories need to be updated (in respect to current state)?How can I check for apt-get errors in a bash script?apt-get exits bash script after installing packagesBash - Check directory for files against list of partial file namesHow do I create a program similar to 'fortune', that can be installed using apt-get installlist of programs with apt installation with missing packagesMost elegant way to add ppa through scripterror for not using bash?

Infinitely many hats

Why to use water tanks from Space shuttle in museum?

Mother abusing my finances

How can I prevent interns from being expendable?

How can I grammatically understand "Wir über uns"?

Is there a rule that prohibits us from using 2 possessives in a row?

How to capture more stars?

Is the world in Game of Thrones spherical or flat?

How to detach yourself from a character you're going to kill?

Expenditure in Poland - Forex doesn't have Zloty

Points within polygons in different projections

What does "Marchentalender" on the front of a postcard mean?

Decrypting WPA2-Enterprise (EAP-PEAP) in Wireshark

Why does the UK have more political parties than the US?

Can non-English-speaking characters use wordplay specific to English?

What's the most polite way to tell a manager "shut up and let me work"?

How was Apollo supposed to rendezvous in the case of a lunar abort?

Creating Fictional Slavic Place Names

Can a helicopter mask itself from Radar?

If a problem only occurs randomly once in every N times on average, how many tests do I have to perform to be certain that it's now fixed?

Beginner's snake game using PyGame

Select row of data if next row contains zero

How to prevent bad sectors?

Where can I find the list of all tendons in the human body?



Check and install multiple packages if not installed - using bash [closed]


How to know whether a particular package is installed on ubuntu?How to make Python-3.4.2 use already installed Numpy?Apt-get install multiple packages without stoppinghow to find which packages from official Ubuntu repositories need to be updated (in respect to current state)?How can I check for apt-get errors in a bash script?apt-get exits bash script after installing packagesBash - Check directory for files against list of partial file namesHow do I create a program similar to 'fortune', that can be installed using apt-get installlist of programs with apt installation with missing packagesMost elegant way to add ppa through scripterror for not using bash?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I need to Bash script which will install few packages.
For Example:
I need install packages: Molecule and Ansible



Bash script should do it and I need it for Ubuntu/Debian:



If Molecule exist > print "Molecule Installed"
else
apt-get install Molecule
then
if Ansible exist > print "Ansible installed"
else
apt-get install Ansible


Can you tell me how will look script in bash, which will contain the above instructions?



Thank you in advance!










share|improve this question













closed as too broad by mikewhatever, Eric Carvalho, Bruni, mniess, waltinator Apr 17 at 16:01


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 1





    You should definitely learn how to write such a script. Start here: linuxcommand.org/lc3_lts0010.php

    – mikewhatever
    Apr 13 at 21:15












  • Maybe a half-duplicate of this (or one of it's duplicates): askubuntu.com/questions/879877/…

    – Xen2050
    Apr 14 at 10:52

















0















I need to Bash script which will install few packages.
For Example:
I need install packages: Molecule and Ansible



Bash script should do it and I need it for Ubuntu/Debian:



If Molecule exist > print "Molecule Installed"
else
apt-get install Molecule
then
if Ansible exist > print "Ansible installed"
else
apt-get install Ansible


Can you tell me how will look script in bash, which will contain the above instructions?



Thank you in advance!










share|improve this question













closed as too broad by mikewhatever, Eric Carvalho, Bruni, mniess, waltinator Apr 17 at 16:01


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 1





    You should definitely learn how to write such a script. Start here: linuxcommand.org/lc3_lts0010.php

    – mikewhatever
    Apr 13 at 21:15












  • Maybe a half-duplicate of this (or one of it's duplicates): askubuntu.com/questions/879877/…

    – Xen2050
    Apr 14 at 10:52













0












0








0








I need to Bash script which will install few packages.
For Example:
I need install packages: Molecule and Ansible



Bash script should do it and I need it for Ubuntu/Debian:



If Molecule exist > print "Molecule Installed"
else
apt-get install Molecule
then
if Ansible exist > print "Ansible installed"
else
apt-get install Ansible


Can you tell me how will look script in bash, which will contain the above instructions?



Thank you in advance!










share|improve this question














I need to Bash script which will install few packages.
For Example:
I need install packages: Molecule and Ansible



Bash script should do it and I need it for Ubuntu/Debian:



If Molecule exist > print "Molecule Installed"
else
apt-get install Molecule
then
if Ansible exist > print "Ansible installed"
else
apt-get install Ansible


Can you tell me how will look script in bash, which will contain the above instructions?



Thank you in advance!







command-line bash scripts






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 13 at 21:11









BElluuBElluu

234




234




closed as too broad by mikewhatever, Eric Carvalho, Bruni, mniess, waltinator Apr 17 at 16:01


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as too broad by mikewhatever, Eric Carvalho, Bruni, mniess, waltinator Apr 17 at 16:01


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1





    You should definitely learn how to write such a script. Start here: linuxcommand.org/lc3_lts0010.php

    – mikewhatever
    Apr 13 at 21:15












  • Maybe a half-duplicate of this (or one of it's duplicates): askubuntu.com/questions/879877/…

    – Xen2050
    Apr 14 at 10:52












  • 1





    You should definitely learn how to write such a script. Start here: linuxcommand.org/lc3_lts0010.php

    – mikewhatever
    Apr 13 at 21:15












  • Maybe a half-duplicate of this (or one of it's duplicates): askubuntu.com/questions/879877/…

    – Xen2050
    Apr 14 at 10:52







1




1





You should definitely learn how to write such a script. Start here: linuxcommand.org/lc3_lts0010.php

– mikewhatever
Apr 13 at 21:15






You should definitely learn how to write such a script. Start here: linuxcommand.org/lc3_lts0010.php

– mikewhatever
Apr 13 at 21:15














Maybe a half-duplicate of this (or one of it's duplicates): askubuntu.com/questions/879877/…

– Xen2050
Apr 14 at 10:52





Maybe a half-duplicate of this (or one of it's duplicates): askubuntu.com/questions/879877/…

– Xen2050
Apr 14 at 10:52










2 Answers
2






active

oldest

votes


















3














You don't really need such script. Whenever, you attempt to install a package that is already installed, apt will output <pkg-name> is already the newest version. string. You can see an example of that here:



$ sudo apt-get install python3-numpy
[sudo] password for ubuntuadmin:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-numpy is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 323 not upgraded.
$


Thus your problem reduces to simply using apt command itself to install multiple packages



sudo apt-get install molecule ansible 





share|improve this answer






























    2














    Open the terminal and type:



    apt policy molecule ansible 


    The output is self-explanatory. It will be similar to this example:



    $ apt policy molecule ansible
    ansible:
    Installed: 2.5.1+dfsg-1
    Candidate: 2.5.1+dfsg-1
    Version table:
    *** 2.5.1+dfsg-1 500
    500 http://archive.ubuntu.com/ubuntu/pub/ubuntu bionic/universe amd64 Packages
    500 http://archive.ubuntu.com/ubuntu/pub/ubuntu bionic/universe i386 Packages
    100 /var/lib/dpkg/status
    N: Unable to locate package molecule





    share|improve this answer





























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      3














      You don't really need such script. Whenever, you attempt to install a package that is already installed, apt will output <pkg-name> is already the newest version. string. You can see an example of that here:



      $ sudo apt-get install python3-numpy
      [sudo] password for ubuntuadmin:
      Reading package lists... Done
      Building dependency tree
      Reading state information... Done
      python3-numpy is already the newest version.
      0 upgraded, 0 newly installed, 0 to remove and 323 not upgraded.
      $


      Thus your problem reduces to simply using apt command itself to install multiple packages



      sudo apt-get install molecule ansible 





      share|improve this answer



























        3














        You don't really need such script. Whenever, you attempt to install a package that is already installed, apt will output <pkg-name> is already the newest version. string. You can see an example of that here:



        $ sudo apt-get install python3-numpy
        [sudo] password for ubuntuadmin:
        Reading package lists... Done
        Building dependency tree
        Reading state information... Done
        python3-numpy is already the newest version.
        0 upgraded, 0 newly installed, 0 to remove and 323 not upgraded.
        $


        Thus your problem reduces to simply using apt command itself to install multiple packages



        sudo apt-get install molecule ansible 





        share|improve this answer

























          3












          3








          3







          You don't really need such script. Whenever, you attempt to install a package that is already installed, apt will output <pkg-name> is already the newest version. string. You can see an example of that here:



          $ sudo apt-get install python3-numpy
          [sudo] password for ubuntuadmin:
          Reading package lists... Done
          Building dependency tree
          Reading state information... Done
          python3-numpy is already the newest version.
          0 upgraded, 0 newly installed, 0 to remove and 323 not upgraded.
          $


          Thus your problem reduces to simply using apt command itself to install multiple packages



          sudo apt-get install molecule ansible 





          share|improve this answer













          You don't really need such script. Whenever, you attempt to install a package that is already installed, apt will output <pkg-name> is already the newest version. string. You can see an example of that here:



          $ sudo apt-get install python3-numpy
          [sudo] password for ubuntuadmin:
          Reading package lists... Done
          Building dependency tree
          Reading state information... Done
          python3-numpy is already the newest version.
          0 upgraded, 0 newly installed, 0 to remove and 323 not upgraded.
          $


          Thus your problem reduces to simply using apt command itself to install multiple packages



          sudo apt-get install molecule ansible 






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 13 at 21:20









          Sergiy KolodyazhnyySergiy Kolodyazhnyy

          76.2k10161336




          76.2k10161336























              2














              Open the terminal and type:



              apt policy molecule ansible 


              The output is self-explanatory. It will be similar to this example:



              $ apt policy molecule ansible
              ansible:
              Installed: 2.5.1+dfsg-1
              Candidate: 2.5.1+dfsg-1
              Version table:
              *** 2.5.1+dfsg-1 500
              500 http://archive.ubuntu.com/ubuntu/pub/ubuntu bionic/universe amd64 Packages
              500 http://archive.ubuntu.com/ubuntu/pub/ubuntu bionic/universe i386 Packages
              100 /var/lib/dpkg/status
              N: Unable to locate package molecule





              share|improve this answer



























                2














                Open the terminal and type:



                apt policy molecule ansible 


                The output is self-explanatory. It will be similar to this example:



                $ apt policy molecule ansible
                ansible:
                Installed: 2.5.1+dfsg-1
                Candidate: 2.5.1+dfsg-1
                Version table:
                *** 2.5.1+dfsg-1 500
                500 http://archive.ubuntu.com/ubuntu/pub/ubuntu bionic/universe amd64 Packages
                500 http://archive.ubuntu.com/ubuntu/pub/ubuntu bionic/universe i386 Packages
                100 /var/lib/dpkg/status
                N: Unable to locate package molecule





                share|improve this answer

























                  2












                  2








                  2







                  Open the terminal and type:



                  apt policy molecule ansible 


                  The output is self-explanatory. It will be similar to this example:



                  $ apt policy molecule ansible
                  ansible:
                  Installed: 2.5.1+dfsg-1
                  Candidate: 2.5.1+dfsg-1
                  Version table:
                  *** 2.5.1+dfsg-1 500
                  500 http://archive.ubuntu.com/ubuntu/pub/ubuntu bionic/universe amd64 Packages
                  500 http://archive.ubuntu.com/ubuntu/pub/ubuntu bionic/universe i386 Packages
                  100 /var/lib/dpkg/status
                  N: Unable to locate package molecule





                  share|improve this answer













                  Open the terminal and type:



                  apt policy molecule ansible 


                  The output is self-explanatory. It will be similar to this example:



                  $ apt policy molecule ansible
                  ansible:
                  Installed: 2.5.1+dfsg-1
                  Candidate: 2.5.1+dfsg-1
                  Version table:
                  *** 2.5.1+dfsg-1 500
                  500 http://archive.ubuntu.com/ubuntu/pub/ubuntu bionic/universe amd64 Packages
                  500 http://archive.ubuntu.com/ubuntu/pub/ubuntu bionic/universe i386 Packages
                  100 /var/lib/dpkg/status
                  N: Unable to locate package molecule






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 13 at 21:38









                  karelkarel

                  62.5k13136162




                  62.5k13136162













                      Popular posts from this blog

                      Tamil (spriik) Luke uk diar | Nawigatjuun

                      Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

                      Training a classifier when some of the features are unknownWhy does Gradient Boosting regression predict negative values when there are no negative y-values in my training set?How to improve an existing (trained) classifier?What is effect when I set up some self defined predisctor variables?Why Matlab neural network classification returns decimal values on prediction dataset?Fitting and transforming text data in training, testing, and validation setsHow to quantify the performance of the classifier (multi-class SVM) using the test data?How do I control for some patients providing multiple samples in my training data?Training and Test setTraining a convolutional neural network for image denoising in MatlabShouldn't an autoencoder with #(neurons in hidden layer) = #(neurons in input layer) be “perfect”?