How to install multiple RPM packages using Shell script and by taking it from comma separated input file?...












1















I have to install multiple packages using shell script and rpm (package) name is in the input file.



I have done it in this below way.



My input file is path is = /mstr/mstr_input_file.txt



MY Script is:



enter image description here
But instead using sleep command i need to keep condition when one package got installed it should start for another to install.



My input file contains:



packagelist=mailx,nc,expect,nfs-utils,telnet,glibc,libX11,libxcb,libXcomposite,libXcursor,libXdamage,libXext,libXfixes,libXi,libXrender,libXtst,glib2,nss,nss-util,nspr,cups-libs,dbus-libs,expat,libXScrnSaver,libXrandr,alsa-lib,cairo,at-spi2-atk,gtk3,gdk-pixbuf2,ibgcc,atk,at-spi2-atk,at-spi2-core,GConf2,libXScrnSaver,libxkbcommon,libwayland-client,libwayland-cursor,gtk3,gdk-pixbuf2 









share|improve this question















closed as unclear what you're asking by jimmij, Rui F Ribeiro, Jeff Schaller, Kusalananda, Romeo Ninov Feb 20 at 13:21


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. 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.



















  • Is it Okay Now?

    – Santosh Garole
    Feb 22 at 10:02











  • Please don't post screenshots of text

    – Olorin
    Feb 27 at 7:08
















1















I have to install multiple packages using shell script and rpm (package) name is in the input file.



I have done it in this below way.



My input file is path is = /mstr/mstr_input_file.txt



MY Script is:



enter image description here
But instead using sleep command i need to keep condition when one package got installed it should start for another to install.



My input file contains:



packagelist=mailx,nc,expect,nfs-utils,telnet,glibc,libX11,libxcb,libXcomposite,libXcursor,libXdamage,libXext,libXfixes,libXi,libXrender,libXtst,glib2,nss,nss-util,nspr,cups-libs,dbus-libs,expat,libXScrnSaver,libXrandr,alsa-lib,cairo,at-spi2-atk,gtk3,gdk-pixbuf2,ibgcc,atk,at-spi2-atk,at-spi2-core,GConf2,libXScrnSaver,libxkbcommon,libwayland-client,libwayland-cursor,gtk3,gdk-pixbuf2 









share|improve this question















closed as unclear what you're asking by jimmij, Rui F Ribeiro, Jeff Schaller, Kusalananda, Romeo Ninov Feb 20 at 13:21


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. 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.



















  • Is it Okay Now?

    – Santosh Garole
    Feb 22 at 10:02











  • Please don't post screenshots of text

    – Olorin
    Feb 27 at 7:08














1












1








1








I have to install multiple packages using shell script and rpm (package) name is in the input file.



I have done it in this below way.



My input file is path is = /mstr/mstr_input_file.txt



MY Script is:



enter image description here
But instead using sleep command i need to keep condition when one package got installed it should start for another to install.



My input file contains:



packagelist=mailx,nc,expect,nfs-utils,telnet,glibc,libX11,libxcb,libXcomposite,libXcursor,libXdamage,libXext,libXfixes,libXi,libXrender,libXtst,glib2,nss,nss-util,nspr,cups-libs,dbus-libs,expat,libXScrnSaver,libXrandr,alsa-lib,cairo,at-spi2-atk,gtk3,gdk-pixbuf2,ibgcc,atk,at-spi2-atk,at-spi2-core,GConf2,libXScrnSaver,libxkbcommon,libwayland-client,libwayland-cursor,gtk3,gdk-pixbuf2 









share|improve this question
















I have to install multiple packages using shell script and rpm (package) name is in the input file.



I have done it in this below way.



My input file is path is = /mstr/mstr_input_file.txt



MY Script is:



enter image description here
But instead using sleep command i need to keep condition when one package got installed it should start for another to install.



My input file contains:



packagelist=mailx,nc,expect,nfs-utils,telnet,glibc,libX11,libxcb,libXcomposite,libXcursor,libXdamage,libXext,libXfixes,libXi,libXrender,libXtst,glib2,nss,nss-util,nspr,cups-libs,dbus-libs,expat,libXScrnSaver,libXrandr,alsa-lib,cairo,at-spi2-atk,gtk3,gdk-pixbuf2,ibgcc,atk,at-spi2-atk,at-spi2-core,GConf2,libXScrnSaver,libxkbcommon,libwayland-client,libwayland-cursor,gtk3,gdk-pixbuf2 






linux shell-script amazon-linux






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 22 at 10:06









Kusalananda

134k17255418




134k17255418










asked Feb 20 at 10:16









Santosh GaroleSantosh Garole

62




62




closed as unclear what you're asking by jimmij, Rui F Ribeiro, Jeff Schaller, Kusalananda, Romeo Ninov Feb 20 at 13:21


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. 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 unclear what you're asking by jimmij, Rui F Ribeiro, Jeff Schaller, Kusalananda, Romeo Ninov Feb 20 at 13:21


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. 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.















  • Is it Okay Now?

    – Santosh Garole
    Feb 22 at 10:02











  • Please don't post screenshots of text

    – Olorin
    Feb 27 at 7:08



















  • Is it Okay Now?

    – Santosh Garole
    Feb 22 at 10:02











  • Please don't post screenshots of text

    – Olorin
    Feb 27 at 7:08

















Is it Okay Now?

– Santosh Garole
Feb 22 at 10:02





Is it Okay Now?

– Santosh Garole
Feb 22 at 10:02













Please don't post screenshots of text

– Olorin
Feb 27 at 7:08





Please don't post screenshots of text

– Olorin
Feb 27 at 7:08










3 Answers
3






active

oldest

votes


















1














I dont have a rpm based system in front of me to test that out but assuming your list is called rpmlist.txt and you want to install it with rpm and not yum.



First do:



for i in `cat rpmlist.txt | tr ',' 'n'`; do echo $i ; done


if the output shows a the packages now line by line it should work with:



for i in `cat rpmlist.txt | tr ',' 'n'`; do rpm -i $i ; done


Note: you could replace rpm -i with yum -y (the -y makes shure, you dont have to agree to install the packages it just install them without asking.)






share|improve this answer

































    1














    You can use:



    yum install $(awk -F ',' 'BEGIN {ORS=" "} {for(i=1;i<=NF;i++) {print $i}}' filename)


    awk command will give packages names separated by space as input to yum.






    share|improve this answer

































      1














      You could use xargs to feed comma separated values to a command:



      xargs -d',' yum install < inputfile.csv


      If you want to install the packages one by one, you could pass the -n 1 flag to xargs:



      xargs -n1 -d',' yum install < inputfile.csv




      • < sends the input file to xargs


      • xargs -d',' takes ',' as delimiter to generate a list of arguments from the input file to pass them to yum.


      You can find and split the lines starting with packagelist with awk:



      </mstr/mstr_input_file.txt awk -F'=' '/packagelist=/{print $2}' | xargs -n1 -d',' yum install





      share|improve this answer


























      • In my Input file So many inputs are there not only rpm Packages

        – Santosh Garole
        Feb 22 at 10:01


















      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      I dont have a rpm based system in front of me to test that out but assuming your list is called rpmlist.txt and you want to install it with rpm and not yum.



      First do:



      for i in `cat rpmlist.txt | tr ',' 'n'`; do echo $i ; done


      if the output shows a the packages now line by line it should work with:



      for i in `cat rpmlist.txt | tr ',' 'n'`; do rpm -i $i ; done


      Note: you could replace rpm -i with yum -y (the -y makes shure, you dont have to agree to install the packages it just install them without asking.)






      share|improve this answer






























        1














        I dont have a rpm based system in front of me to test that out but assuming your list is called rpmlist.txt and you want to install it with rpm and not yum.



        First do:



        for i in `cat rpmlist.txt | tr ',' 'n'`; do echo $i ; done


        if the output shows a the packages now line by line it should work with:



        for i in `cat rpmlist.txt | tr ',' 'n'`; do rpm -i $i ; done


        Note: you could replace rpm -i with yum -y (the -y makes shure, you dont have to agree to install the packages it just install them without asking.)






        share|improve this answer




























          1












          1








          1







          I dont have a rpm based system in front of me to test that out but assuming your list is called rpmlist.txt and you want to install it with rpm and not yum.



          First do:



          for i in `cat rpmlist.txt | tr ',' 'n'`; do echo $i ; done


          if the output shows a the packages now line by line it should work with:



          for i in `cat rpmlist.txt | tr ',' 'n'`; do rpm -i $i ; done


          Note: you could replace rpm -i with yum -y (the -y makes shure, you dont have to agree to install the packages it just install them without asking.)






          share|improve this answer















          I dont have a rpm based system in front of me to test that out but assuming your list is called rpmlist.txt and you want to install it with rpm and not yum.



          First do:



          for i in `cat rpmlist.txt | tr ',' 'n'`; do echo $i ; done


          if the output shows a the packages now line by line it should work with:



          for i in `cat rpmlist.txt | tr ',' 'n'`; do rpm -i $i ; done


          Note: you could replace rpm -i with yum -y (the -y makes shure, you dont have to agree to install the packages it just install them without asking.)







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 20 at 10:40

























          answered Feb 20 at 10:34









          Dorian GaensslenDorian Gaensslen

          315




          315

























              1














              You can use:



              yum install $(awk -F ',' 'BEGIN {ORS=" "} {for(i=1;i<=NF;i++) {print $i}}' filename)


              awk command will give packages names separated by space as input to yum.






              share|improve this answer






























                1














                You can use:



                yum install $(awk -F ',' 'BEGIN {ORS=" "} {for(i=1;i<=NF;i++) {print $i}}' filename)


                awk command will give packages names separated by space as input to yum.






                share|improve this answer




























                  1












                  1








                  1







                  You can use:



                  yum install $(awk -F ',' 'BEGIN {ORS=" "} {for(i=1;i<=NF;i++) {print $i}}' filename)


                  awk command will give packages names separated by space as input to yum.






                  share|improve this answer















                  You can use:



                  yum install $(awk -F ',' 'BEGIN {ORS=" "} {for(i=1;i<=NF;i++) {print $i}}' filename)


                  awk command will give packages names separated by space as input to yum.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Feb 20 at 10:44

























                  answered Feb 20 at 10:21









                  PRYPRY

                  2,61231026




                  2,61231026























                      1














                      You could use xargs to feed comma separated values to a command:



                      xargs -d',' yum install < inputfile.csv


                      If you want to install the packages one by one, you could pass the -n 1 flag to xargs:



                      xargs -n1 -d',' yum install < inputfile.csv




                      • < sends the input file to xargs


                      • xargs -d',' takes ',' as delimiter to generate a list of arguments from the input file to pass them to yum.


                      You can find and split the lines starting with packagelist with awk:



                      </mstr/mstr_input_file.txt awk -F'=' '/packagelist=/{print $2}' | xargs -n1 -d',' yum install





                      share|improve this answer


























                      • In my Input file So many inputs are there not only rpm Packages

                        – Santosh Garole
                        Feb 22 at 10:01
















                      1














                      You could use xargs to feed comma separated values to a command:



                      xargs -d',' yum install < inputfile.csv


                      If you want to install the packages one by one, you could pass the -n 1 flag to xargs:



                      xargs -n1 -d',' yum install < inputfile.csv




                      • < sends the input file to xargs


                      • xargs -d',' takes ',' as delimiter to generate a list of arguments from the input file to pass them to yum.


                      You can find and split the lines starting with packagelist with awk:



                      </mstr/mstr_input_file.txt awk -F'=' '/packagelist=/{print $2}' | xargs -n1 -d',' yum install





                      share|improve this answer


























                      • In my Input file So many inputs are there not only rpm Packages

                        – Santosh Garole
                        Feb 22 at 10:01














                      1












                      1








                      1







                      You could use xargs to feed comma separated values to a command:



                      xargs -d',' yum install < inputfile.csv


                      If you want to install the packages one by one, you could pass the -n 1 flag to xargs:



                      xargs -n1 -d',' yum install < inputfile.csv




                      • < sends the input file to xargs


                      • xargs -d',' takes ',' as delimiter to generate a list of arguments from the input file to pass them to yum.


                      You can find and split the lines starting with packagelist with awk:



                      </mstr/mstr_input_file.txt awk -F'=' '/packagelist=/{print $2}' | xargs -n1 -d',' yum install





                      share|improve this answer















                      You could use xargs to feed comma separated values to a command:



                      xargs -d',' yum install < inputfile.csv


                      If you want to install the packages one by one, you could pass the -n 1 flag to xargs:



                      xargs -n1 -d',' yum install < inputfile.csv




                      • < sends the input file to xargs


                      • xargs -d',' takes ',' as delimiter to generate a list of arguments from the input file to pass them to yum.


                      You can find and split the lines starting with packagelist with awk:



                      </mstr/mstr_input_file.txt awk -F'=' '/packagelist=/{print $2}' | xargs -n1 -d',' yum install






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Feb 22 at 11:06

























                      answered Feb 20 at 10:36









                      ctxctx

                      1,644414




                      1,644414













                      • In my Input file So many inputs are there not only rpm Packages

                        – Santosh Garole
                        Feb 22 at 10:01



















                      • In my Input file So many inputs are there not only rpm Packages

                        – Santosh Garole
                        Feb 22 at 10:01

















                      In my Input file So many inputs are there not only rpm Packages

                      – Santosh Garole
                      Feb 22 at 10:01





                      In my Input file So many inputs are there not only rpm Packages

                      – Santosh Garole
                      Feb 22 at 10:01



                      Popular posts from this blog

                      How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

                      is 'sed' thread safe

                      How to make a Squid Proxy server?