porting install scripts : can rpm replace apt? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionHow can I reliably get the operating system's name?Can rpm handle an install of another OS into another Logical Volume?Package breaks when upgrading from Debian stable to testingYum failing: Requires installed packagesCan't download python-devAPT commands stall on `update-initramfs: Generating /boot/initrd.img-4.8.0-58-generic`Package has no installation candidateCan't install Zabbix by apt-get - checksum error - Debian 9yum install fails with 401 Authorization requiredWrong amdgpu drivers installed and unable to uninstall itrestore under RHEL 7

Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?

Bete Noir -- no dairy

What's the meaning of 間時肆拾貳 at a car parking sign

Align equal signs while including text over equalities

List *all* the tuples!

How to answer "Have you ever been terminated?"

The logistics of corpse disposal

How to find all the available tools in macOS terminal?

What does an IRS interview request entail when called in to verify expenses for a sole proprietor small business?

List of Python versions

Can a USB port passively 'listen only'?

What would be the ideal power source for a cybernetic eye?

Denied boarding although I have proper visa and documentation. To whom should I make a complaint?

How to deal with a team lead who never gives me credit?

51k Euros annually for a family of 4 in Berlin: Is it enough?

Why did the IBM 650 use bi-quinary?

How do I stop a creek from eroding my steep embankment?

Seeking colloquialism for “just because”

What is the meaning of the new sigil in Game of Thrones Season 8 intro?

illegal generic type for instanceof when using local classes

Are two submodules (where one is contained in the other) isomorphic if their quotientmodules are isomorphic?

How to bypass password on Windows XP account?

How would the world control an invulnerable immortal mass murderer?

Why did the rest of the Eastern Bloc not invade Yugoslavia?



porting install scripts : can rpm replace apt?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionHow can I reliably get the operating system's name?Can rpm handle an install of another OS into another Logical Volume?Package breaks when upgrading from Debian stable to testingYum failing: Requires installed packagesCan't download python-devAPT commands stall on `update-initramfs: Generating /boot/initrd.img-4.8.0-58-generic`Package has no installation candidateCan't install Zabbix by apt-get - checksum error - Debian 9yum install fails with 401 Authorization requiredWrong amdgpu drivers installed and unable to uninstall itrestore under RHEL 7



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








3















I have the following install script for ubuntu :



#!/bin/bash

sudo apt update
sudo apt full-upgrade -y
sudo apt install jq
sudo apt autoclean -y
sudo apt autoremove


will the following work under fedora, red hat, mageia or other rpm-based distros



...or does the syntax have to change more?



#!/bin/bash

sudo rpm update
sudo rpm full-upgrade -y
sudo rpm install jq
sudo rpm autoclean -y
sudo rpm autoremove


also can I do something to the effect of the following? :



#!/bin/bash
if [ $(command -v yum) ]
then
sudo yum update
sudo yum full-upgrade -y
sudo yum install jq
sudo yum autoclean -y
sudo yum autoremove
else
sudo rpm update
sudo rpm full-upgrade -y
sudo rpm install jq
sudo rpm autoclean -y
sudo rpm autoremove
fi









share|improve this question






























    3















    I have the following install script for ubuntu :



    #!/bin/bash

    sudo apt update
    sudo apt full-upgrade -y
    sudo apt install jq
    sudo apt autoclean -y
    sudo apt autoremove


    will the following work under fedora, red hat, mageia or other rpm-based distros



    ...or does the syntax have to change more?



    #!/bin/bash

    sudo rpm update
    sudo rpm full-upgrade -y
    sudo rpm install jq
    sudo rpm autoclean -y
    sudo rpm autoremove


    also can I do something to the effect of the following? :



    #!/bin/bash
    if [ $(command -v yum) ]
    then
    sudo yum update
    sudo yum full-upgrade -y
    sudo yum install jq
    sudo yum autoclean -y
    sudo yum autoremove
    else
    sudo rpm update
    sudo rpm full-upgrade -y
    sudo rpm install jq
    sudo rpm autoclean -y
    sudo rpm autoremove
    fi









    share|improve this question


























      3












      3








      3








      I have the following install script for ubuntu :



      #!/bin/bash

      sudo apt update
      sudo apt full-upgrade -y
      sudo apt install jq
      sudo apt autoclean -y
      sudo apt autoremove


      will the following work under fedora, red hat, mageia or other rpm-based distros



      ...or does the syntax have to change more?



      #!/bin/bash

      sudo rpm update
      sudo rpm full-upgrade -y
      sudo rpm install jq
      sudo rpm autoclean -y
      sudo rpm autoremove


      also can I do something to the effect of the following? :



      #!/bin/bash
      if [ $(command -v yum) ]
      then
      sudo yum update
      sudo yum full-upgrade -y
      sudo yum install jq
      sudo yum autoclean -y
      sudo yum autoremove
      else
      sudo rpm update
      sudo rpm full-upgrade -y
      sudo rpm install jq
      sudo rpm autoclean -y
      sudo rpm autoremove
      fi









      share|improve this question
















      I have the following install script for ubuntu :



      #!/bin/bash

      sudo apt update
      sudo apt full-upgrade -y
      sudo apt install jq
      sudo apt autoclean -y
      sudo apt autoremove


      will the following work under fedora, red hat, mageia or other rpm-based distros



      ...or does the syntax have to change more?



      #!/bin/bash

      sudo rpm update
      sudo rpm full-upgrade -y
      sudo rpm install jq
      sudo rpm autoclean -y
      sudo rpm autoremove


      also can I do something to the effect of the following? :



      #!/bin/bash
      if [ $(command -v yum) ]
      then
      sudo yum update
      sudo yum full-upgrade -y
      sudo yum install jq
      sudo yum autoclean -y
      sudo yum autoremove
      else
      sudo rpm update
      sudo rpm full-upgrade -y
      sudo rpm install jq
      sudo rpm autoclean -y
      sudo rpm autoremove
      fi






      shell-script apt yum rpm software-distribution






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 7 hours ago









      Rui F Ribeiro

      42.1k1484142




      42.1k1484142










      asked 7 hours ago









      tatsutatsu

      1437




      1437




















          2 Answers
          2






          active

          oldest

          votes


















          9














          rpm is mostly equivalent to dpkg, not apt; the apt equivalent is yum or dnf. For your specific commands:



          sudo dnf distro-sync
          sudo dnf install jq
          sudo dnf clean all
          sudo dnf autoremove


          or



          sudo yum upgrade
          sudo yum install jq
          sudo yum clean all


          (This works because jq is packaged under the same name in both cases. This isn’t always true.)



          See the Pacman Rosetta and the Ubuntu RHEL migration guide for details.



          You might want to look into configuration management tools instead, they will help you abstract the differences away (or at least, deal with them more robustly).



          Your if [ $(command -v yum) ] test is flawed because yum can be installed on Debian derivatives (including Ubuntu); its presence doesn’t mean it’s the package manager. You should probably detect the running operating system and base your choice on that; see How can I reliably get the operating system's name? for details.






          share|improve this answer























          • aw shucks package name can change? whyyyy?

            – tatsu
            7 hours ago











          • who has dnf? redhat? and I assume yum is more towards mageia and fedora?

            – tatsu
            7 hours ago






          • 1





            Because they’re different distribution, with different packaging practices, naming rules, etc.

            – Stephen Kitt
            7 hours ago






          • 1





            yum is used in RHEL up to version 7, CentOS up to version 7, and probably other RPM-based distributions; dnf is used in Fedora, and RHEL 8 and later.

            – Stephen Kitt
            7 hours ago






          • 1





            No, it hasn’t for quite a while.

            – Stephen Kitt
            7 hours ago


















          4














          No, the options and arguments to apt and yum are different, so are package names in a lot of cases.



          You also seem to be getting rpm and yum confused, yum is the equivalent of apt, rpm is the equivalent of dpkg. dpkg is the backend for apt, rpm is the backend for yum.



          You will have to look at the man pages for both apt and yum to find the equivalent options. Alternativly you could look at a configuration management tool like puppet which will abstract a lot of OS differences between distros, but this may be overkill for what you're doing.






          share|improve this answer























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512799%2fporting-install-scripts-can-rpm-replace-apt%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            9














            rpm is mostly equivalent to dpkg, not apt; the apt equivalent is yum or dnf. For your specific commands:



            sudo dnf distro-sync
            sudo dnf install jq
            sudo dnf clean all
            sudo dnf autoremove


            or



            sudo yum upgrade
            sudo yum install jq
            sudo yum clean all


            (This works because jq is packaged under the same name in both cases. This isn’t always true.)



            See the Pacman Rosetta and the Ubuntu RHEL migration guide for details.



            You might want to look into configuration management tools instead, they will help you abstract the differences away (or at least, deal with them more robustly).



            Your if [ $(command -v yum) ] test is flawed because yum can be installed on Debian derivatives (including Ubuntu); its presence doesn’t mean it’s the package manager. You should probably detect the running operating system and base your choice on that; see How can I reliably get the operating system's name? for details.






            share|improve this answer























            • aw shucks package name can change? whyyyy?

              – tatsu
              7 hours ago











            • who has dnf? redhat? and I assume yum is more towards mageia and fedora?

              – tatsu
              7 hours ago






            • 1





              Because they’re different distribution, with different packaging practices, naming rules, etc.

              – Stephen Kitt
              7 hours ago






            • 1





              yum is used in RHEL up to version 7, CentOS up to version 7, and probably other RPM-based distributions; dnf is used in Fedora, and RHEL 8 and later.

              – Stephen Kitt
              7 hours ago






            • 1





              No, it hasn’t for quite a while.

              – Stephen Kitt
              7 hours ago















            9














            rpm is mostly equivalent to dpkg, not apt; the apt equivalent is yum or dnf. For your specific commands:



            sudo dnf distro-sync
            sudo dnf install jq
            sudo dnf clean all
            sudo dnf autoremove


            or



            sudo yum upgrade
            sudo yum install jq
            sudo yum clean all


            (This works because jq is packaged under the same name in both cases. This isn’t always true.)



            See the Pacman Rosetta and the Ubuntu RHEL migration guide for details.



            You might want to look into configuration management tools instead, they will help you abstract the differences away (or at least, deal with them more robustly).



            Your if [ $(command -v yum) ] test is flawed because yum can be installed on Debian derivatives (including Ubuntu); its presence doesn’t mean it’s the package manager. You should probably detect the running operating system and base your choice on that; see How can I reliably get the operating system's name? for details.






            share|improve this answer























            • aw shucks package name can change? whyyyy?

              – tatsu
              7 hours ago











            • who has dnf? redhat? and I assume yum is more towards mageia and fedora?

              – tatsu
              7 hours ago






            • 1





              Because they’re different distribution, with different packaging practices, naming rules, etc.

              – Stephen Kitt
              7 hours ago






            • 1





              yum is used in RHEL up to version 7, CentOS up to version 7, and probably other RPM-based distributions; dnf is used in Fedora, and RHEL 8 and later.

              – Stephen Kitt
              7 hours ago






            • 1





              No, it hasn’t for quite a while.

              – Stephen Kitt
              7 hours ago













            9












            9








            9







            rpm is mostly equivalent to dpkg, not apt; the apt equivalent is yum or dnf. For your specific commands:



            sudo dnf distro-sync
            sudo dnf install jq
            sudo dnf clean all
            sudo dnf autoremove


            or



            sudo yum upgrade
            sudo yum install jq
            sudo yum clean all


            (This works because jq is packaged under the same name in both cases. This isn’t always true.)



            See the Pacman Rosetta and the Ubuntu RHEL migration guide for details.



            You might want to look into configuration management tools instead, they will help you abstract the differences away (or at least, deal with them more robustly).



            Your if [ $(command -v yum) ] test is flawed because yum can be installed on Debian derivatives (including Ubuntu); its presence doesn’t mean it’s the package manager. You should probably detect the running operating system and base your choice on that; see How can I reliably get the operating system's name? for details.






            share|improve this answer













            rpm is mostly equivalent to dpkg, not apt; the apt equivalent is yum or dnf. For your specific commands:



            sudo dnf distro-sync
            sudo dnf install jq
            sudo dnf clean all
            sudo dnf autoremove


            or



            sudo yum upgrade
            sudo yum install jq
            sudo yum clean all


            (This works because jq is packaged under the same name in both cases. This isn’t always true.)



            See the Pacman Rosetta and the Ubuntu RHEL migration guide for details.



            You might want to look into configuration management tools instead, they will help you abstract the differences away (or at least, deal with them more robustly).



            Your if [ $(command -v yum) ] test is flawed because yum can be installed on Debian derivatives (including Ubuntu); its presence doesn’t mean it’s the package manager. You should probably detect the running operating system and base your choice on that; see How can I reliably get the operating system's name? for details.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 7 hours ago









            Stephen KittStephen Kitt

            182k25415495




            182k25415495












            • aw shucks package name can change? whyyyy?

              – tatsu
              7 hours ago











            • who has dnf? redhat? and I assume yum is more towards mageia and fedora?

              – tatsu
              7 hours ago






            • 1





              Because they’re different distribution, with different packaging practices, naming rules, etc.

              – Stephen Kitt
              7 hours ago






            • 1





              yum is used in RHEL up to version 7, CentOS up to version 7, and probably other RPM-based distributions; dnf is used in Fedora, and RHEL 8 and later.

              – Stephen Kitt
              7 hours ago






            • 1





              No, it hasn’t for quite a while.

              – Stephen Kitt
              7 hours ago

















            • aw shucks package name can change? whyyyy?

              – tatsu
              7 hours ago











            • who has dnf? redhat? and I assume yum is more towards mageia and fedora?

              – tatsu
              7 hours ago






            • 1





              Because they’re different distribution, with different packaging practices, naming rules, etc.

              – Stephen Kitt
              7 hours ago






            • 1





              yum is used in RHEL up to version 7, CentOS up to version 7, and probably other RPM-based distributions; dnf is used in Fedora, and RHEL 8 and later.

              – Stephen Kitt
              7 hours ago






            • 1





              No, it hasn’t for quite a while.

              – Stephen Kitt
              7 hours ago
















            aw shucks package name can change? whyyyy?

            – tatsu
            7 hours ago





            aw shucks package name can change? whyyyy?

            – tatsu
            7 hours ago













            who has dnf? redhat? and I assume yum is more towards mageia and fedora?

            – tatsu
            7 hours ago





            who has dnf? redhat? and I assume yum is more towards mageia and fedora?

            – tatsu
            7 hours ago




            1




            1





            Because they’re different distribution, with different packaging practices, naming rules, etc.

            – Stephen Kitt
            7 hours ago





            Because they’re different distribution, with different packaging practices, naming rules, etc.

            – Stephen Kitt
            7 hours ago




            1




            1





            yum is used in RHEL up to version 7, CentOS up to version 7, and probably other RPM-based distributions; dnf is used in Fedora, and RHEL 8 and later.

            – Stephen Kitt
            7 hours ago





            yum is used in RHEL up to version 7, CentOS up to version 7, and probably other RPM-based distributions; dnf is used in Fedora, and RHEL 8 and later.

            – Stephen Kitt
            7 hours ago




            1




            1





            No, it hasn’t for quite a while.

            – Stephen Kitt
            7 hours ago





            No, it hasn’t for quite a while.

            – Stephen Kitt
            7 hours ago













            4














            No, the options and arguments to apt and yum are different, so are package names in a lot of cases.



            You also seem to be getting rpm and yum confused, yum is the equivalent of apt, rpm is the equivalent of dpkg. dpkg is the backend for apt, rpm is the backend for yum.



            You will have to look at the man pages for both apt and yum to find the equivalent options. Alternativly you could look at a configuration management tool like puppet which will abstract a lot of OS differences between distros, but this may be overkill for what you're doing.






            share|improve this answer



























              4














              No, the options and arguments to apt and yum are different, so are package names in a lot of cases.



              You also seem to be getting rpm and yum confused, yum is the equivalent of apt, rpm is the equivalent of dpkg. dpkg is the backend for apt, rpm is the backend for yum.



              You will have to look at the man pages for both apt and yum to find the equivalent options. Alternativly you could look at a configuration management tool like puppet which will abstract a lot of OS differences between distros, but this may be overkill for what you're doing.






              share|improve this answer

























                4












                4








                4







                No, the options and arguments to apt and yum are different, so are package names in a lot of cases.



                You also seem to be getting rpm and yum confused, yum is the equivalent of apt, rpm is the equivalent of dpkg. dpkg is the backend for apt, rpm is the backend for yum.



                You will have to look at the man pages for both apt and yum to find the equivalent options. Alternativly you could look at a configuration management tool like puppet which will abstract a lot of OS differences between distros, but this may be overkill for what you're doing.






                share|improve this answer













                No, the options and arguments to apt and yum are different, so are package names in a lot of cases.



                You also seem to be getting rpm and yum confused, yum is the equivalent of apt, rpm is the equivalent of dpkg. dpkg is the backend for apt, rpm is the backend for yum.



                You will have to look at the man pages for both apt and yum to find the equivalent options. Alternativly you could look at a configuration management tool like puppet which will abstract a lot of OS differences between distros, but this may be overkill for what you're doing.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 7 hours ago









                rusty shacklefordrusty shackleford

                1,415117




                1,415117



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512799%2fporting-install-scripts-can-rpm-replace-apt%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown