How to use yum to get all RPMs required, for offline use?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












21














I have one server with net connectivity, where I can use "yum install $PACKAGE".

I want some yum command, like yum cache-rpms $PACKAGE $DIRECTORY such that all required RPM files will be downloaded to $DIRECTORY, which will also have a file (Install.sh) stating the order in which to install these RPMs, on many other servers without net connectivity.
Install.sh may even be a shell script, which has the same behaviour as yum install $PACKAGE, except that it will not use the network, but will only use $DIRECTORY.



Possible?



I am looking for a general solution where yum and RPM is available, but for specificity: It is on a set of CENTOS 6.7 servers.










share|improve this question























  • I can think of a couple of solutions-- which works better for you? (1) The single package approach. This downloads less, but requires more manual work. Or... (2) The whole repo approach. This downloads lots, but can be done with more automation.
    – Steve Bonds
    Feb 4 '16 at 0:27










  • @SteveBonds , I would like (1) "single package", because (2) "whole repo" will take time to download and consume too much space.
    – Prem
    Feb 4 '16 at 3:10










  • Have you looked at Spacewalk?
    – fpmurphy
    Feb 6 '16 at 1:03















21














I have one server with net connectivity, where I can use "yum install $PACKAGE".

I want some yum command, like yum cache-rpms $PACKAGE $DIRECTORY such that all required RPM files will be downloaded to $DIRECTORY, which will also have a file (Install.sh) stating the order in which to install these RPMs, on many other servers without net connectivity.
Install.sh may even be a shell script, which has the same behaviour as yum install $PACKAGE, except that it will not use the network, but will only use $DIRECTORY.



Possible?



I am looking for a general solution where yum and RPM is available, but for specificity: It is on a set of CENTOS 6.7 servers.










share|improve this question























  • I can think of a couple of solutions-- which works better for you? (1) The single package approach. This downloads less, but requires more manual work. Or... (2) The whole repo approach. This downloads lots, but can be done with more automation.
    – Steve Bonds
    Feb 4 '16 at 0:27










  • @SteveBonds , I would like (1) "single package", because (2) "whole repo" will take time to download and consume too much space.
    – Prem
    Feb 4 '16 at 3:10










  • Have you looked at Spacewalk?
    – fpmurphy
    Feb 6 '16 at 1:03













21












21








21


13





I have one server with net connectivity, where I can use "yum install $PACKAGE".

I want some yum command, like yum cache-rpms $PACKAGE $DIRECTORY such that all required RPM files will be downloaded to $DIRECTORY, which will also have a file (Install.sh) stating the order in which to install these RPMs, on many other servers without net connectivity.
Install.sh may even be a shell script, which has the same behaviour as yum install $PACKAGE, except that it will not use the network, but will only use $DIRECTORY.



Possible?



I am looking for a general solution where yum and RPM is available, but for specificity: It is on a set of CENTOS 6.7 servers.










share|improve this question















I have one server with net connectivity, where I can use "yum install $PACKAGE".

I want some yum command, like yum cache-rpms $PACKAGE $DIRECTORY such that all required RPM files will be downloaded to $DIRECTORY, which will also have a file (Install.sh) stating the order in which to install these RPMs, on many other servers without net connectivity.
Install.sh may even be a shell script, which has the same behaviour as yum install $PACKAGE, except that it will not use the network, but will only use $DIRECTORY.



Possible?



I am looking for a general solution where yum and RPM is available, but for specificity: It is on a set of CENTOS 6.7 servers.







yum rpm






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 3 '16 at 22:00









Gilles

528k12810571583




528k12810571583










asked Feb 3 '16 at 17:12









Prem

1,49121229




1,49121229











  • I can think of a couple of solutions-- which works better for you? (1) The single package approach. This downloads less, but requires more manual work. Or... (2) The whole repo approach. This downloads lots, but can be done with more automation.
    – Steve Bonds
    Feb 4 '16 at 0:27










  • @SteveBonds , I would like (1) "single package", because (2) "whole repo" will take time to download and consume too much space.
    – Prem
    Feb 4 '16 at 3:10










  • Have you looked at Spacewalk?
    – fpmurphy
    Feb 6 '16 at 1:03
















  • I can think of a couple of solutions-- which works better for you? (1) The single package approach. This downloads less, but requires more manual work. Or... (2) The whole repo approach. This downloads lots, but can be done with more automation.
    – Steve Bonds
    Feb 4 '16 at 0:27










  • @SteveBonds , I would like (1) "single package", because (2) "whole repo" will take time to download and consume too much space.
    – Prem
    Feb 4 '16 at 3:10










  • Have you looked at Spacewalk?
    – fpmurphy
    Feb 6 '16 at 1:03















I can think of a couple of solutions-- which works better for you? (1) The single package approach. This downloads less, but requires more manual work. Or... (2) The whole repo approach. This downloads lots, but can be done with more automation.
– Steve Bonds
Feb 4 '16 at 0:27




I can think of a couple of solutions-- which works better for you? (1) The single package approach. This downloads less, but requires more manual work. Or... (2) The whole repo approach. This downloads lots, but can be done with more automation.
– Steve Bonds
Feb 4 '16 at 0:27












@SteveBonds , I would like (1) "single package", because (2) "whole repo" will take time to download and consume too much space.
– Prem
Feb 4 '16 at 3:10




@SteveBonds , I would like (1) "single package", because (2) "whole repo" will take time to download and consume too much space.
– Prem
Feb 4 '16 at 3:10












Have you looked at Spacewalk?
– fpmurphy
Feb 6 '16 at 1:03




Have you looked at Spacewalk?
– fpmurphy
Feb 6 '16 at 1:03










3 Answers
3






active

oldest

votes


















29














Here's a specific example using "httpd" as the package to download and install. This process was tested on both CentOS6 and CentOS7.



Install the stuff you need and make a place to put the downloaded RPMs:



# yum install yum-plugin-downloadonly yum-utils createrepo
# mkdir /var/tmp/httpd
# mkdir /var/tmp/httpd-installroot


Download the RPMs. This uses the installroot trick suggested here to force a full download of all dependencies since nothing is installed in that empty root. Yum will create some metadata in there, but we're going to throw it all away. Note that for CentOS7 releasever would be "7".



# yum install --downloadonly --installroot=/var/tmp/httpd-installroot --releasever=6 --downloaddir=/var/tmp/httpd httpd


Yes, that was the small version. You should have seen the size of the full-repo downloads!



Generate the metadata needed to turn our new pile of RPMs into a YUM repo and clean up the stuff we no longer need:



# createrepo --database /var/tmp/httpd
# rm -rf /var/tmp/httpd-installroot


Configure the download directory as a repo. Note that for CentOS7 the gpgkey would be named "7" instead of "6":



# vi /etc/yum.repos.d/offline-httpd.repo
[offline-httpd]
name=CentOS-$releasever - httpd
baseurl=file:///var/tmp/httpd
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6


To check the missing dependencies:



# repoclosure --repoid=offline-httpd


I haven't figured out why on CentOS7 this reports things like libssl.so.10(libssl.so.10)(64bit) missing from httpd-tools when openssl-libs-1.0.1e-51.el7_2.2.x86_64.rpm (the provider of that library) is clearly present in the directory. Still, if you see something obviously missing, this might be a good chance to go back and add it using the same yum install --downloadonly method above.



When offline or after copying the /var/tmp/httpd repo directory to the other server set up the repo there:



# vi /etc/yum.repos.d/offline-httpd.repo
[offline-httpd]
name=CentOS-$releasever - httpd
baseurl=file:///var/tmp/httpd
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# yum --disablerepo=* --enablerepo=offline-httpd install httpd


Hopefully no missing dependencies!






share|improve this answer


















  • 3




    I tried following your guide to build the folder on CentOS 7 and install it on Red Hat 7, it all worked without errors
    – Piyin
    Jan 16 at 19:38






  • 1




    While the compatibility between the two OSes is good enough that things like that work, in order to ensure RedHat support, you should download RedHat software from RedHat's servers using a similar process.
    – Steve Bonds
    Jan 17 at 18:08










  • Yes, you're right. But in this case it was a close environment with network rules I couldn't alter. Like some say: "the customer is always right"
    – Piyin
    Jan 17 at 20:53







  • 1




    working very well in Centos 7, thanks !
    – Carlos Vega
    Mar 21 at 18:00



















4














Seems you're asking for yumdownloader which is contained in the package yum-utils. There are already a few questions and answers about this, see e.g. Download all dependencies with yumdownloader, even if already installed? or How do I find package URLs with Yum?



yumdownloader will download the packages, although it will not generate a file Install.sh as the order can be determined by yum itself, so you can install the packages on the target box via
yum install ./*rpm in the folder with your downloaded packages (which needs to include all dependencies compared to a base installation - see the first link above regarding repotrack)






share|improve this answer






















  • +1 , Sounds like what I want ! I will experiment and update if it matches what I want !
    – Prem
    Feb 5 '16 at 4:46


















0














I needed it several times, so I automated @Steve Bonds answer. Just be sure do define PKG as the package to install on both machines (Disclaimer: for CentOS 7. For CentOS 6, change the --releasever and CentOS-7 spot.



online machine



PKG=... # NAME OF THE PACKAGE TO INSTALL ON OFFLINE MACHINE
yum install --downloadonly --installroot=/tmp/$PKG-installroot --releasever=7 --downloaddir=/tmp/$PKG $PKG
createrepo --database /tmp/$PKG
rm -rf /tmp/$PKG-installroot
rsync -arv /tmp/$PKG/ [IP of the machine]:/tmp/$PKG


on offline machine:



PKG=... # NAME OF THE PACKAGE
echo "[offline-$PKG]
name=CentOS-$releasever - $PKG
baseurl=file:///tmp/$PKG/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7" > /etc/yum.repos.d/offline-$PKG.repo

# install package offline:
yum --disablerepo=* --enablerepo=offline-$PKG install --nogpgcheck $PKG





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%2f259640%2fhow-to-use-yum-to-get-all-rpms-required-for-offline-use%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    29














    Here's a specific example using "httpd" as the package to download and install. This process was tested on both CentOS6 and CentOS7.



    Install the stuff you need and make a place to put the downloaded RPMs:



    # yum install yum-plugin-downloadonly yum-utils createrepo
    # mkdir /var/tmp/httpd
    # mkdir /var/tmp/httpd-installroot


    Download the RPMs. This uses the installroot trick suggested here to force a full download of all dependencies since nothing is installed in that empty root. Yum will create some metadata in there, but we're going to throw it all away. Note that for CentOS7 releasever would be "7".



    # yum install --downloadonly --installroot=/var/tmp/httpd-installroot --releasever=6 --downloaddir=/var/tmp/httpd httpd


    Yes, that was the small version. You should have seen the size of the full-repo downloads!



    Generate the metadata needed to turn our new pile of RPMs into a YUM repo and clean up the stuff we no longer need:



    # createrepo --database /var/tmp/httpd
    # rm -rf /var/tmp/httpd-installroot


    Configure the download directory as a repo. Note that for CentOS7 the gpgkey would be named "7" instead of "6":



    # vi /etc/yum.repos.d/offline-httpd.repo
    [offline-httpd]
    name=CentOS-$releasever - httpd
    baseurl=file:///var/tmp/httpd
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6


    To check the missing dependencies:



    # repoclosure --repoid=offline-httpd


    I haven't figured out why on CentOS7 this reports things like libssl.so.10(libssl.so.10)(64bit) missing from httpd-tools when openssl-libs-1.0.1e-51.el7_2.2.x86_64.rpm (the provider of that library) is clearly present in the directory. Still, if you see something obviously missing, this might be a good chance to go back and add it using the same yum install --downloadonly method above.



    When offline or after copying the /var/tmp/httpd repo directory to the other server set up the repo there:



    # vi /etc/yum.repos.d/offline-httpd.repo
    [offline-httpd]
    name=CentOS-$releasever - httpd
    baseurl=file:///var/tmp/httpd
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    # yum --disablerepo=* --enablerepo=offline-httpd install httpd


    Hopefully no missing dependencies!






    share|improve this answer


















    • 3




      I tried following your guide to build the folder on CentOS 7 and install it on Red Hat 7, it all worked without errors
      – Piyin
      Jan 16 at 19:38






    • 1




      While the compatibility between the two OSes is good enough that things like that work, in order to ensure RedHat support, you should download RedHat software from RedHat's servers using a similar process.
      – Steve Bonds
      Jan 17 at 18:08










    • Yes, you're right. But in this case it was a close environment with network rules I couldn't alter. Like some say: "the customer is always right"
      – Piyin
      Jan 17 at 20:53







    • 1




      working very well in Centos 7, thanks !
      – Carlos Vega
      Mar 21 at 18:00
















    29














    Here's a specific example using "httpd" as the package to download and install. This process was tested on both CentOS6 and CentOS7.



    Install the stuff you need and make a place to put the downloaded RPMs:



    # yum install yum-plugin-downloadonly yum-utils createrepo
    # mkdir /var/tmp/httpd
    # mkdir /var/tmp/httpd-installroot


    Download the RPMs. This uses the installroot trick suggested here to force a full download of all dependencies since nothing is installed in that empty root. Yum will create some metadata in there, but we're going to throw it all away. Note that for CentOS7 releasever would be "7".



    # yum install --downloadonly --installroot=/var/tmp/httpd-installroot --releasever=6 --downloaddir=/var/tmp/httpd httpd


    Yes, that was the small version. You should have seen the size of the full-repo downloads!



    Generate the metadata needed to turn our new pile of RPMs into a YUM repo and clean up the stuff we no longer need:



    # createrepo --database /var/tmp/httpd
    # rm -rf /var/tmp/httpd-installroot


    Configure the download directory as a repo. Note that for CentOS7 the gpgkey would be named "7" instead of "6":



    # vi /etc/yum.repos.d/offline-httpd.repo
    [offline-httpd]
    name=CentOS-$releasever - httpd
    baseurl=file:///var/tmp/httpd
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6


    To check the missing dependencies:



    # repoclosure --repoid=offline-httpd


    I haven't figured out why on CentOS7 this reports things like libssl.so.10(libssl.so.10)(64bit) missing from httpd-tools when openssl-libs-1.0.1e-51.el7_2.2.x86_64.rpm (the provider of that library) is clearly present in the directory. Still, if you see something obviously missing, this might be a good chance to go back and add it using the same yum install --downloadonly method above.



    When offline or after copying the /var/tmp/httpd repo directory to the other server set up the repo there:



    # vi /etc/yum.repos.d/offline-httpd.repo
    [offline-httpd]
    name=CentOS-$releasever - httpd
    baseurl=file:///var/tmp/httpd
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    # yum --disablerepo=* --enablerepo=offline-httpd install httpd


    Hopefully no missing dependencies!






    share|improve this answer


















    • 3




      I tried following your guide to build the folder on CentOS 7 and install it on Red Hat 7, it all worked without errors
      – Piyin
      Jan 16 at 19:38






    • 1




      While the compatibility between the two OSes is good enough that things like that work, in order to ensure RedHat support, you should download RedHat software from RedHat's servers using a similar process.
      – Steve Bonds
      Jan 17 at 18:08










    • Yes, you're right. But in this case it was a close environment with network rules I couldn't alter. Like some say: "the customer is always right"
      – Piyin
      Jan 17 at 20:53







    • 1




      working very well in Centos 7, thanks !
      – Carlos Vega
      Mar 21 at 18:00














    29












    29








    29






    Here's a specific example using "httpd" as the package to download and install. This process was tested on both CentOS6 and CentOS7.



    Install the stuff you need and make a place to put the downloaded RPMs:



    # yum install yum-plugin-downloadonly yum-utils createrepo
    # mkdir /var/tmp/httpd
    # mkdir /var/tmp/httpd-installroot


    Download the RPMs. This uses the installroot trick suggested here to force a full download of all dependencies since nothing is installed in that empty root. Yum will create some metadata in there, but we're going to throw it all away. Note that for CentOS7 releasever would be "7".



    # yum install --downloadonly --installroot=/var/tmp/httpd-installroot --releasever=6 --downloaddir=/var/tmp/httpd httpd


    Yes, that was the small version. You should have seen the size of the full-repo downloads!



    Generate the metadata needed to turn our new pile of RPMs into a YUM repo and clean up the stuff we no longer need:



    # createrepo --database /var/tmp/httpd
    # rm -rf /var/tmp/httpd-installroot


    Configure the download directory as a repo. Note that for CentOS7 the gpgkey would be named "7" instead of "6":



    # vi /etc/yum.repos.d/offline-httpd.repo
    [offline-httpd]
    name=CentOS-$releasever - httpd
    baseurl=file:///var/tmp/httpd
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6


    To check the missing dependencies:



    # repoclosure --repoid=offline-httpd


    I haven't figured out why on CentOS7 this reports things like libssl.so.10(libssl.so.10)(64bit) missing from httpd-tools when openssl-libs-1.0.1e-51.el7_2.2.x86_64.rpm (the provider of that library) is clearly present in the directory. Still, if you see something obviously missing, this might be a good chance to go back and add it using the same yum install --downloadonly method above.



    When offline or after copying the /var/tmp/httpd repo directory to the other server set up the repo there:



    # vi /etc/yum.repos.d/offline-httpd.repo
    [offline-httpd]
    name=CentOS-$releasever - httpd
    baseurl=file:///var/tmp/httpd
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    # yum --disablerepo=* --enablerepo=offline-httpd install httpd


    Hopefully no missing dependencies!






    share|improve this answer














    Here's a specific example using "httpd" as the package to download and install. This process was tested on both CentOS6 and CentOS7.



    Install the stuff you need and make a place to put the downloaded RPMs:



    # yum install yum-plugin-downloadonly yum-utils createrepo
    # mkdir /var/tmp/httpd
    # mkdir /var/tmp/httpd-installroot


    Download the RPMs. This uses the installroot trick suggested here to force a full download of all dependencies since nothing is installed in that empty root. Yum will create some metadata in there, but we're going to throw it all away. Note that for CentOS7 releasever would be "7".



    # yum install --downloadonly --installroot=/var/tmp/httpd-installroot --releasever=6 --downloaddir=/var/tmp/httpd httpd


    Yes, that was the small version. You should have seen the size of the full-repo downloads!



    Generate the metadata needed to turn our new pile of RPMs into a YUM repo and clean up the stuff we no longer need:



    # createrepo --database /var/tmp/httpd
    # rm -rf /var/tmp/httpd-installroot


    Configure the download directory as a repo. Note that for CentOS7 the gpgkey would be named "7" instead of "6":



    # vi /etc/yum.repos.d/offline-httpd.repo
    [offline-httpd]
    name=CentOS-$releasever - httpd
    baseurl=file:///var/tmp/httpd
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6


    To check the missing dependencies:



    # repoclosure --repoid=offline-httpd


    I haven't figured out why on CentOS7 this reports things like libssl.so.10(libssl.so.10)(64bit) missing from httpd-tools when openssl-libs-1.0.1e-51.el7_2.2.x86_64.rpm (the provider of that library) is clearly present in the directory. Still, if you see something obviously missing, this might be a good chance to go back and add it using the same yum install --downloadonly method above.



    When offline or after copying the /var/tmp/httpd repo directory to the other server set up the repo there:



    # vi /etc/yum.repos.d/offline-httpd.repo
    [offline-httpd]
    name=CentOS-$releasever - httpd
    baseurl=file:///var/tmp/httpd
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    # yum --disablerepo=* --enablerepo=offline-httpd install httpd


    Hopefully no missing dependencies!







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jan 17 at 5:30









    Prem

    1,49121229




    1,49121229










    answered Feb 6 '16 at 0:46









    Steve Bonds

    93169




    93169







    • 3




      I tried following your guide to build the folder on CentOS 7 and install it on Red Hat 7, it all worked without errors
      – Piyin
      Jan 16 at 19:38






    • 1




      While the compatibility between the two OSes is good enough that things like that work, in order to ensure RedHat support, you should download RedHat software from RedHat's servers using a similar process.
      – Steve Bonds
      Jan 17 at 18:08










    • Yes, you're right. But in this case it was a close environment with network rules I couldn't alter. Like some say: "the customer is always right"
      – Piyin
      Jan 17 at 20:53







    • 1




      working very well in Centos 7, thanks !
      – Carlos Vega
      Mar 21 at 18:00













    • 3




      I tried following your guide to build the folder on CentOS 7 and install it on Red Hat 7, it all worked without errors
      – Piyin
      Jan 16 at 19:38






    • 1




      While the compatibility between the two OSes is good enough that things like that work, in order to ensure RedHat support, you should download RedHat software from RedHat's servers using a similar process.
      – Steve Bonds
      Jan 17 at 18:08










    • Yes, you're right. But in this case it was a close environment with network rules I couldn't alter. Like some say: "the customer is always right"
      – Piyin
      Jan 17 at 20:53







    • 1




      working very well in Centos 7, thanks !
      – Carlos Vega
      Mar 21 at 18:00








    3




    3




    I tried following your guide to build the folder on CentOS 7 and install it on Red Hat 7, it all worked without errors
    – Piyin
    Jan 16 at 19:38




    I tried following your guide to build the folder on CentOS 7 and install it on Red Hat 7, it all worked without errors
    – Piyin
    Jan 16 at 19:38




    1




    1




    While the compatibility between the two OSes is good enough that things like that work, in order to ensure RedHat support, you should download RedHat software from RedHat's servers using a similar process.
    – Steve Bonds
    Jan 17 at 18:08




    While the compatibility between the two OSes is good enough that things like that work, in order to ensure RedHat support, you should download RedHat software from RedHat's servers using a similar process.
    – Steve Bonds
    Jan 17 at 18:08












    Yes, you're right. But in this case it was a close environment with network rules I couldn't alter. Like some say: "the customer is always right"
    – Piyin
    Jan 17 at 20:53





    Yes, you're right. But in this case it was a close environment with network rules I couldn't alter. Like some say: "the customer is always right"
    – Piyin
    Jan 17 at 20:53





    1




    1




    working very well in Centos 7, thanks !
    – Carlos Vega
    Mar 21 at 18:00





    working very well in Centos 7, thanks !
    – Carlos Vega
    Mar 21 at 18:00














    4














    Seems you're asking for yumdownloader which is contained in the package yum-utils. There are already a few questions and answers about this, see e.g. Download all dependencies with yumdownloader, even if already installed? or How do I find package URLs with Yum?



    yumdownloader will download the packages, although it will not generate a file Install.sh as the order can be determined by yum itself, so you can install the packages on the target box via
    yum install ./*rpm in the folder with your downloaded packages (which needs to include all dependencies compared to a base installation - see the first link above regarding repotrack)






    share|improve this answer






















    • +1 , Sounds like what I want ! I will experiment and update if it matches what I want !
      – Prem
      Feb 5 '16 at 4:46















    4














    Seems you're asking for yumdownloader which is contained in the package yum-utils. There are already a few questions and answers about this, see e.g. Download all dependencies with yumdownloader, even if already installed? or How do I find package URLs with Yum?



    yumdownloader will download the packages, although it will not generate a file Install.sh as the order can be determined by yum itself, so you can install the packages on the target box via
    yum install ./*rpm in the folder with your downloaded packages (which needs to include all dependencies compared to a base installation - see the first link above regarding repotrack)






    share|improve this answer






















    • +1 , Sounds like what I want ! I will experiment and update if it matches what I want !
      – Prem
      Feb 5 '16 at 4:46













    4












    4








    4






    Seems you're asking for yumdownloader which is contained in the package yum-utils. There are already a few questions and answers about this, see e.g. Download all dependencies with yumdownloader, even if already installed? or How do I find package URLs with Yum?



    yumdownloader will download the packages, although it will not generate a file Install.sh as the order can be determined by yum itself, so you can install the packages on the target box via
    yum install ./*rpm in the folder with your downloaded packages (which needs to include all dependencies compared to a base installation - see the first link above regarding repotrack)






    share|improve this answer














    Seems you're asking for yumdownloader which is contained in the package yum-utils. There are already a few questions and answers about this, see e.g. Download all dependencies with yumdownloader, even if already installed? or How do I find package URLs with Yum?



    yumdownloader will download the packages, although it will not generate a file Install.sh as the order can be determined by yum itself, so you can install the packages on the target box via
    yum install ./*rpm in the folder with your downloaded packages (which needs to include all dependencies compared to a base installation - see the first link above regarding repotrack)







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 13 '17 at 12:36









    Community

    1




    1










    answered Feb 4 '16 at 8:00









    doktor5000

    2,040820




    2,040820











    • +1 , Sounds like what I want ! I will experiment and update if it matches what I want !
      – Prem
      Feb 5 '16 at 4:46
















    • +1 , Sounds like what I want ! I will experiment and update if it matches what I want !
      – Prem
      Feb 5 '16 at 4:46















    +1 , Sounds like what I want ! I will experiment and update if it matches what I want !
    – Prem
    Feb 5 '16 at 4:46




    +1 , Sounds like what I want ! I will experiment and update if it matches what I want !
    – Prem
    Feb 5 '16 at 4:46











    0














    I needed it several times, so I automated @Steve Bonds answer. Just be sure do define PKG as the package to install on both machines (Disclaimer: for CentOS 7. For CentOS 6, change the --releasever and CentOS-7 spot.



    online machine



    PKG=... # NAME OF THE PACKAGE TO INSTALL ON OFFLINE MACHINE
    yum install --downloadonly --installroot=/tmp/$PKG-installroot --releasever=7 --downloaddir=/tmp/$PKG $PKG
    createrepo --database /tmp/$PKG
    rm -rf /tmp/$PKG-installroot
    rsync -arv /tmp/$PKG/ [IP of the machine]:/tmp/$PKG


    on offline machine:



    PKG=... # NAME OF THE PACKAGE
    echo "[offline-$PKG]
    name=CentOS-$releasever - $PKG
    baseurl=file:///tmp/$PKG/
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7" > /etc/yum.repos.d/offline-$PKG.repo

    # install package offline:
    yum --disablerepo=* --enablerepo=offline-$PKG install --nogpgcheck $PKG





    share|improve this answer

























      0














      I needed it several times, so I automated @Steve Bonds answer. Just be sure do define PKG as the package to install on both machines (Disclaimer: for CentOS 7. For CentOS 6, change the --releasever and CentOS-7 spot.



      online machine



      PKG=... # NAME OF THE PACKAGE TO INSTALL ON OFFLINE MACHINE
      yum install --downloadonly --installroot=/tmp/$PKG-installroot --releasever=7 --downloaddir=/tmp/$PKG $PKG
      createrepo --database /tmp/$PKG
      rm -rf /tmp/$PKG-installroot
      rsync -arv /tmp/$PKG/ [IP of the machine]:/tmp/$PKG


      on offline machine:



      PKG=... # NAME OF THE PACKAGE
      echo "[offline-$PKG]
      name=CentOS-$releasever - $PKG
      baseurl=file:///tmp/$PKG/
      enabled=0
      gpgcheck=1
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7" > /etc/yum.repos.d/offline-$PKG.repo

      # install package offline:
      yum --disablerepo=* --enablerepo=offline-$PKG install --nogpgcheck $PKG





      share|improve this answer























        0












        0








        0






        I needed it several times, so I automated @Steve Bonds answer. Just be sure do define PKG as the package to install on both machines (Disclaimer: for CentOS 7. For CentOS 6, change the --releasever and CentOS-7 spot.



        online machine



        PKG=... # NAME OF THE PACKAGE TO INSTALL ON OFFLINE MACHINE
        yum install --downloadonly --installroot=/tmp/$PKG-installroot --releasever=7 --downloaddir=/tmp/$PKG $PKG
        createrepo --database /tmp/$PKG
        rm -rf /tmp/$PKG-installroot
        rsync -arv /tmp/$PKG/ [IP of the machine]:/tmp/$PKG


        on offline machine:



        PKG=... # NAME OF THE PACKAGE
        echo "[offline-$PKG]
        name=CentOS-$releasever - $PKG
        baseurl=file:///tmp/$PKG/
        enabled=0
        gpgcheck=1
        gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7" > /etc/yum.repos.d/offline-$PKG.repo

        # install package offline:
        yum --disablerepo=* --enablerepo=offline-$PKG install --nogpgcheck $PKG





        share|improve this answer












        I needed it several times, so I automated @Steve Bonds answer. Just be sure do define PKG as the package to install on both machines (Disclaimer: for CentOS 7. For CentOS 6, change the --releasever and CentOS-7 spot.



        online machine



        PKG=... # NAME OF THE PACKAGE TO INSTALL ON OFFLINE MACHINE
        yum install --downloadonly --installroot=/tmp/$PKG-installroot --releasever=7 --downloaddir=/tmp/$PKG $PKG
        createrepo --database /tmp/$PKG
        rm -rf /tmp/$PKG-installroot
        rsync -arv /tmp/$PKG/ [IP of the machine]:/tmp/$PKG


        on offline machine:



        PKG=... # NAME OF THE PACKAGE
        echo "[offline-$PKG]
        name=CentOS-$releasever - $PKG
        baseurl=file:///tmp/$PKG/
        enabled=0
        gpgcheck=1
        gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7" > /etc/yum.repos.d/offline-$PKG.repo

        # install package offline:
        yum --disablerepo=* --enablerepo=offline-$PKG install --nogpgcheck $PKG






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 17 at 12:13









        shosaco

        1011




        1011



























            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2f259640%2fhow-to-use-yum-to-get-all-rpms-required-for-offline-use%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






            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?