Is there a way to force “Yes” to any prompts when installing from apt-get (from a bash script)?...












10
















This question already has an answer here:




  • How to install a package with apt without the “Do you want to continue [Y/n]?” prompt?

    4 answers




I am trying to make a bash script that automates the installation of several packages that I use on any ubuntu machine. I frequently create virtual machines either through Amazon AWS or Digital Ocean and would like to just run one script to install all the packages I use.



Some of the packages I would like to install are Emacs and Node.js



The normal way I install these would be to run apt-get install Emacs, and while doing this I am always prompted with a warning about how much space this app will take up and if I am sure I want to continue.



Is there a way to automate this process, from a script, and always say "yes" to these prompts?










share|improve this question















marked as duplicate by karel, Thomas, Eric Carvalho, Community Jan 7 at 0:07


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















  • yes | apt-get ...

    – Joshua
    Jul 31 '16 at 3:30






  • 1





    You could also set up an image of a machine after you've set it up the way you want, and then make clones of it when you need new ones. Another option (especially if you have a long list that sometimes changes) is pkgsync. That program takes care of keeping the packages you need installed and up to date, and removing the ones that are not needed or actively unwanted.

    – ToVine
    Jul 31 '16 at 13:53






  • 1





    You might want to take a look at Ansible, Puppet, or Chef, which were designed to solve exactly this sort of problem. Ansible in particular is an easy one to get up and running as it operates over SSH. You can either send your own commands to your nodes, or (more likely) use the many modules that have been written to solve common tasks (such as installing packages). Once you have it set up, you only need to run a single command and it ensures that your entire inventory of servers are all in the correct state.

    – Jon Bentley
    Jul 31 '16 at 18:37











  • Also read: superuser.com/a/164580/320611

    – DRS David Soft
    Mar 18 '17 at 12:31
















10
















This question already has an answer here:




  • How to install a package with apt without the “Do you want to continue [Y/n]?” prompt?

    4 answers




I am trying to make a bash script that automates the installation of several packages that I use on any ubuntu machine. I frequently create virtual machines either through Amazon AWS or Digital Ocean and would like to just run one script to install all the packages I use.



Some of the packages I would like to install are Emacs and Node.js



The normal way I install these would be to run apt-get install Emacs, and while doing this I am always prompted with a warning about how much space this app will take up and if I am sure I want to continue.



Is there a way to automate this process, from a script, and always say "yes" to these prompts?










share|improve this question















marked as duplicate by karel, Thomas, Eric Carvalho, Community Jan 7 at 0:07


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















  • yes | apt-get ...

    – Joshua
    Jul 31 '16 at 3:30






  • 1





    You could also set up an image of a machine after you've set it up the way you want, and then make clones of it when you need new ones. Another option (especially if you have a long list that sometimes changes) is pkgsync. That program takes care of keeping the packages you need installed and up to date, and removing the ones that are not needed or actively unwanted.

    – ToVine
    Jul 31 '16 at 13:53






  • 1





    You might want to take a look at Ansible, Puppet, or Chef, which were designed to solve exactly this sort of problem. Ansible in particular is an easy one to get up and running as it operates over SSH. You can either send your own commands to your nodes, or (more likely) use the many modules that have been written to solve common tasks (such as installing packages). Once you have it set up, you only need to run a single command and it ensures that your entire inventory of servers are all in the correct state.

    – Jon Bentley
    Jul 31 '16 at 18:37











  • Also read: superuser.com/a/164580/320611

    – DRS David Soft
    Mar 18 '17 at 12:31














10












10








10


1







This question already has an answer here:




  • How to install a package with apt without the “Do you want to continue [Y/n]?” prompt?

    4 answers




I am trying to make a bash script that automates the installation of several packages that I use on any ubuntu machine. I frequently create virtual machines either through Amazon AWS or Digital Ocean and would like to just run one script to install all the packages I use.



Some of the packages I would like to install are Emacs and Node.js



The normal way I install these would be to run apt-get install Emacs, and while doing this I am always prompted with a warning about how much space this app will take up and if I am sure I want to continue.



Is there a way to automate this process, from a script, and always say "yes" to these prompts?










share|improve this question

















This question already has an answer here:




  • How to install a package with apt without the “Do you want to continue [Y/n]?” prompt?

    4 answers




I am trying to make a bash script that automates the installation of several packages that I use on any ubuntu machine. I frequently create virtual machines either through Amazon AWS or Digital Ocean and would like to just run one script to install all the packages I use.



Some of the packages I would like to install are Emacs and Node.js



The normal way I install these would be to run apt-get install Emacs, and while doing this I am always prompted with a warning about how much space this app will take up and if I am sure I want to continue.



Is there a way to automate this process, from a script, and always say "yes" to these prompts?





This question already has an answer here:




  • How to install a package with apt without the “Do you want to continue [Y/n]?” prompt?

    4 answers








command-line apt bash






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 3 '18 at 7:21









Community

1




1










asked Jul 30 '16 at 23:45









StartecStartec

3382315




3382315




marked as duplicate by karel, Thomas, Eric Carvalho, Community Jan 7 at 0:07


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by karel, Thomas, Eric Carvalho, Community Jan 7 at 0:07


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • yes | apt-get ...

    – Joshua
    Jul 31 '16 at 3:30






  • 1





    You could also set up an image of a machine after you've set it up the way you want, and then make clones of it when you need new ones. Another option (especially if you have a long list that sometimes changes) is pkgsync. That program takes care of keeping the packages you need installed and up to date, and removing the ones that are not needed or actively unwanted.

    – ToVine
    Jul 31 '16 at 13:53






  • 1





    You might want to take a look at Ansible, Puppet, or Chef, which were designed to solve exactly this sort of problem. Ansible in particular is an easy one to get up and running as it operates over SSH. You can either send your own commands to your nodes, or (more likely) use the many modules that have been written to solve common tasks (such as installing packages). Once you have it set up, you only need to run a single command and it ensures that your entire inventory of servers are all in the correct state.

    – Jon Bentley
    Jul 31 '16 at 18:37











  • Also read: superuser.com/a/164580/320611

    – DRS David Soft
    Mar 18 '17 at 12:31



















  • yes | apt-get ...

    – Joshua
    Jul 31 '16 at 3:30






  • 1





    You could also set up an image of a machine after you've set it up the way you want, and then make clones of it when you need new ones. Another option (especially if you have a long list that sometimes changes) is pkgsync. That program takes care of keeping the packages you need installed and up to date, and removing the ones that are not needed or actively unwanted.

    – ToVine
    Jul 31 '16 at 13:53






  • 1





    You might want to take a look at Ansible, Puppet, or Chef, which were designed to solve exactly this sort of problem. Ansible in particular is an easy one to get up and running as it operates over SSH. You can either send your own commands to your nodes, or (more likely) use the many modules that have been written to solve common tasks (such as installing packages). Once you have it set up, you only need to run a single command and it ensures that your entire inventory of servers are all in the correct state.

    – Jon Bentley
    Jul 31 '16 at 18:37











  • Also read: superuser.com/a/164580/320611

    – DRS David Soft
    Mar 18 '17 at 12:31

















yes | apt-get ...

– Joshua
Jul 31 '16 at 3:30





yes | apt-get ...

– Joshua
Jul 31 '16 at 3:30




1




1





You could also set up an image of a machine after you've set it up the way you want, and then make clones of it when you need new ones. Another option (especially if you have a long list that sometimes changes) is pkgsync. That program takes care of keeping the packages you need installed and up to date, and removing the ones that are not needed or actively unwanted.

– ToVine
Jul 31 '16 at 13:53





You could also set up an image of a machine after you've set it up the way you want, and then make clones of it when you need new ones. Another option (especially if you have a long list that sometimes changes) is pkgsync. That program takes care of keeping the packages you need installed and up to date, and removing the ones that are not needed or actively unwanted.

– ToVine
Jul 31 '16 at 13:53




1




1





You might want to take a look at Ansible, Puppet, or Chef, which were designed to solve exactly this sort of problem. Ansible in particular is an easy one to get up and running as it operates over SSH. You can either send your own commands to your nodes, or (more likely) use the many modules that have been written to solve common tasks (such as installing packages). Once you have it set up, you only need to run a single command and it ensures that your entire inventory of servers are all in the correct state.

– Jon Bentley
Jul 31 '16 at 18:37





You might want to take a look at Ansible, Puppet, or Chef, which were designed to solve exactly this sort of problem. Ansible in particular is an easy one to get up and running as it operates over SSH. You can either send your own commands to your nodes, or (more likely) use the many modules that have been written to solve common tasks (such as installing packages). Once you have it set up, you only need to run a single command and it ensures that your entire inventory of servers are all in the correct state.

– Jon Bentley
Jul 31 '16 at 18:37













Also read: superuser.com/a/164580/320611

– DRS David Soft
Mar 18 '17 at 12:31





Also read: superuser.com/a/164580/320611

– DRS David Soft
Mar 18 '17 at 12:31










3 Answers
3






active

oldest

votes


















30














From the OPTIONS section of man apt-get



-y, --yes, --assume-yes
Automatic yes to prompts; assume "yes" as answer to all prompts and
run non-interactively. If an undesirable situation, such as
changing a held package, trying to install a unauthenticated
package or removing an essential package occurs then apt-get will
abort. Configuration Item: APT::Get::Assume-Yes.





share|improve this answer



















  • 2





    I once ran into a package that was immune to --yes. APT didn't ask any questions, but I think a preinst or postinst script was always waiting for some trivial input

    – Xen2050
    Jul 31 '16 at 9:03






  • 1





    sudo DEBIAN_FRONTEND=noninteractive apt-get -y install foo

    – Roger Lipscombe
    Jul 31 '16 at 19:23






  • 1





    @RogerLipscombe I am sorry, can you explain your comment a bit more?

    – Startec
    Jul 31 '16 at 21:47






  • 1





    The DEBIAN_FRONTEND=noninteractive stops preinst and postinst scripts from asking questions.

    – Roger Lipscombe
    Aug 1 '16 at 5:37



















4














There is a unix command called




yes




Without options it outputs the string "y" repeatedly until killed.



To use it, simply pipe the result to the command where you need the confirmations:



yes | apt-get install ...


Read more in the Unix man pages or in the SO post The “yes” command.






share|improve this answer

































    0














    You can add -y To any library install to answer yes



    Eg : apt-get install -y nodejs



    Eg : apt-get install -y gnupg






    share|improve this answer






























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      30














      From the OPTIONS section of man apt-get



      -y, --yes, --assume-yes
      Automatic yes to prompts; assume "yes" as answer to all prompts and
      run non-interactively. If an undesirable situation, such as
      changing a held package, trying to install a unauthenticated
      package or removing an essential package occurs then apt-get will
      abort. Configuration Item: APT::Get::Assume-Yes.





      share|improve this answer



















      • 2





        I once ran into a package that was immune to --yes. APT didn't ask any questions, but I think a preinst or postinst script was always waiting for some trivial input

        – Xen2050
        Jul 31 '16 at 9:03






      • 1





        sudo DEBIAN_FRONTEND=noninteractive apt-get -y install foo

        – Roger Lipscombe
        Jul 31 '16 at 19:23






      • 1





        @RogerLipscombe I am sorry, can you explain your comment a bit more?

        – Startec
        Jul 31 '16 at 21:47






      • 1





        The DEBIAN_FRONTEND=noninteractive stops preinst and postinst scripts from asking questions.

        – Roger Lipscombe
        Aug 1 '16 at 5:37
















      30














      From the OPTIONS section of man apt-get



      -y, --yes, --assume-yes
      Automatic yes to prompts; assume "yes" as answer to all prompts and
      run non-interactively. If an undesirable situation, such as
      changing a held package, trying to install a unauthenticated
      package or removing an essential package occurs then apt-get will
      abort. Configuration Item: APT::Get::Assume-Yes.





      share|improve this answer



















      • 2





        I once ran into a package that was immune to --yes. APT didn't ask any questions, but I think a preinst or postinst script was always waiting for some trivial input

        – Xen2050
        Jul 31 '16 at 9:03






      • 1





        sudo DEBIAN_FRONTEND=noninteractive apt-get -y install foo

        – Roger Lipscombe
        Jul 31 '16 at 19:23






      • 1





        @RogerLipscombe I am sorry, can you explain your comment a bit more?

        – Startec
        Jul 31 '16 at 21:47






      • 1





        The DEBIAN_FRONTEND=noninteractive stops preinst and postinst scripts from asking questions.

        – Roger Lipscombe
        Aug 1 '16 at 5:37














      30












      30








      30







      From the OPTIONS section of man apt-get



      -y, --yes, --assume-yes
      Automatic yes to prompts; assume "yes" as answer to all prompts and
      run non-interactively. If an undesirable situation, such as
      changing a held package, trying to install a unauthenticated
      package or removing an essential package occurs then apt-get will
      abort. Configuration Item: APT::Get::Assume-Yes.





      share|improve this answer













      From the OPTIONS section of man apt-get



      -y, --yes, --assume-yes
      Automatic yes to prompts; assume "yes" as answer to all prompts and
      run non-interactively. If an undesirable situation, such as
      changing a held package, trying to install a unauthenticated
      package or removing an essential package occurs then apt-get will
      abort. Configuration Item: APT::Get::Assume-Yes.






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jul 30 '16 at 23:54









      steeldriversteeldriver

      66.4k11107179




      66.4k11107179








      • 2





        I once ran into a package that was immune to --yes. APT didn't ask any questions, but I think a preinst or postinst script was always waiting for some trivial input

        – Xen2050
        Jul 31 '16 at 9:03






      • 1





        sudo DEBIAN_FRONTEND=noninteractive apt-get -y install foo

        – Roger Lipscombe
        Jul 31 '16 at 19:23






      • 1





        @RogerLipscombe I am sorry, can you explain your comment a bit more?

        – Startec
        Jul 31 '16 at 21:47






      • 1





        The DEBIAN_FRONTEND=noninteractive stops preinst and postinst scripts from asking questions.

        – Roger Lipscombe
        Aug 1 '16 at 5:37














      • 2





        I once ran into a package that was immune to --yes. APT didn't ask any questions, but I think a preinst or postinst script was always waiting for some trivial input

        – Xen2050
        Jul 31 '16 at 9:03






      • 1





        sudo DEBIAN_FRONTEND=noninteractive apt-get -y install foo

        – Roger Lipscombe
        Jul 31 '16 at 19:23






      • 1





        @RogerLipscombe I am sorry, can you explain your comment a bit more?

        – Startec
        Jul 31 '16 at 21:47






      • 1





        The DEBIAN_FRONTEND=noninteractive stops preinst and postinst scripts from asking questions.

        – Roger Lipscombe
        Aug 1 '16 at 5:37








      2




      2





      I once ran into a package that was immune to --yes. APT didn't ask any questions, but I think a preinst or postinst script was always waiting for some trivial input

      – Xen2050
      Jul 31 '16 at 9:03





      I once ran into a package that was immune to --yes. APT didn't ask any questions, but I think a preinst or postinst script was always waiting for some trivial input

      – Xen2050
      Jul 31 '16 at 9:03




      1




      1





      sudo DEBIAN_FRONTEND=noninteractive apt-get -y install foo

      – Roger Lipscombe
      Jul 31 '16 at 19:23





      sudo DEBIAN_FRONTEND=noninteractive apt-get -y install foo

      – Roger Lipscombe
      Jul 31 '16 at 19:23




      1




      1





      @RogerLipscombe I am sorry, can you explain your comment a bit more?

      – Startec
      Jul 31 '16 at 21:47





      @RogerLipscombe I am sorry, can you explain your comment a bit more?

      – Startec
      Jul 31 '16 at 21:47




      1




      1





      The DEBIAN_FRONTEND=noninteractive stops preinst and postinst scripts from asking questions.

      – Roger Lipscombe
      Aug 1 '16 at 5:37





      The DEBIAN_FRONTEND=noninteractive stops preinst and postinst scripts from asking questions.

      – Roger Lipscombe
      Aug 1 '16 at 5:37













      4














      There is a unix command called




      yes




      Without options it outputs the string "y" repeatedly until killed.



      To use it, simply pipe the result to the command where you need the confirmations:



      yes | apt-get install ...


      Read more in the Unix man pages or in the SO post The “yes” command.






      share|improve this answer






























        4














        There is a unix command called




        yes




        Without options it outputs the string "y" repeatedly until killed.



        To use it, simply pipe the result to the command where you need the confirmations:



        yes | apt-get install ...


        Read more in the Unix man pages or in the SO post The “yes” command.






        share|improve this answer




























          4












          4








          4







          There is a unix command called




          yes




          Without options it outputs the string "y" repeatedly until killed.



          To use it, simply pipe the result to the command where you need the confirmations:



          yes | apt-get install ...


          Read more in the Unix man pages or in the SO post The “yes” command.






          share|improve this answer















          There is a unix command called




          yes




          Without options it outputs the string "y" repeatedly until killed.



          To use it, simply pipe the result to the command where you need the confirmations:



          yes | apt-get install ...


          Read more in the Unix man pages or in the SO post The “yes” command.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 13 '17 at 12:37









          Community

          1




          1










          answered Jul 31 '16 at 16:50









          WeSeeWeSee

          1413




          1413























              0














              You can add -y To any library install to answer yes



              Eg : apt-get install -y nodejs



              Eg : apt-get install -y gnupg






              share|improve this answer




























                0














                You can add -y To any library install to answer yes



                Eg : apt-get install -y nodejs



                Eg : apt-get install -y gnupg






                share|improve this answer


























                  0












                  0








                  0







                  You can add -y To any library install to answer yes



                  Eg : apt-get install -y nodejs



                  Eg : apt-get install -y gnupg






                  share|improve this answer













                  You can add -y To any library install to answer yes



                  Eg : apt-get install -y nodejs



                  Eg : apt-get install -y gnupg







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 6 at 7:13









                  vijayvijay

                  1013




                  1013















                      Popular posts from this blog

                      Human spaceflight

                      Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                      File:DeusFollowingSea.jpg