{"id":3635,"date":"2017-04-03T12:24:53","date_gmt":"2017-04-03T06:54:53","guid":{"rendered":"https:\/\/www.wikitechy.com\/technology\/?p=3635"},"modified":"2018-10-27T15:40:53","modified_gmt":"2018-10-27T10:10:53","slug":"install-rpms-directory","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/technology\/install-rpms-directory\/","title":{"rendered":"How to install all RPMs in a directory"},"content":{"rendered":"<h2 id=\"method-1\"><span style=\"color: #003366;\"><label class=\"label label-success\">METHOD 1:<\/label><\/span><\/h2>\n<h3 id=\"make-rpm-auto-install-dependencies\"><span style=\"color: #993300;\"><b>Make rpm auto install dependencies:<\/b><\/span><\/h3>\n<p>Create a (<strong>local<\/strong>) repository and use <strong>yum<\/strong> to have it resolve the dependencies for you.<\/p>\n<ul>\n<li><strong>Create a directory<\/strong> for you local repository, e.g. \/home\/user\/repo.<\/li>\n<li>Move the<strong> RPMs<\/strong> into that directory.<\/li>\n<li><strong>Fix<\/strong> some ownership and file system permissions:<\/li>\n<\/ul>\n[pastacode lang=\u201dbash\u201d manual=\u201d%23%20chown%20-R%20root.root%20%2Fhome%2Fuser%2Frepo%0A\u201d message=\u201dbash code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<ul>\n<li>Install the <strong>createrepo package<\/strong> if not installed yet, and run<\/li>\n<\/ul>\n[pastacode lang=\u201dbash\u201d manual=\u201d%23%20createrepo%20%2Fhome%2Fuser%2Frepo%0A%23%20chmod%20-R%20o-w%2Br%20%2Fhome%2Fuser%2Frepo\u201d message=\u201dbash code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n[ad type=\u201dbanner\u201d]\n<ul>\n<li>Create a <strong>repository configuration file<\/strong>, e.g. \/etc\/yum.repos.d\/myrepo.repo containing<\/li>\n<\/ul>\n[pastacode lang=\u201dbash\u201d manual=\u201d%5Blocal%5D%0Aname%3DMy%20Awesome%20Repo%0Abaseurl%3Dfile%3A%2F%2F%2Fhome%2Fuser%2Frepo%0Aenabled%3D1%0Agpgcheck%3D0%0A\u201d message=\u201dbash code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<ul>\n<li><strong>Install<\/strong> your package using<\/li>\n<\/ul>\n[pastacode lang=\u201dbash\u201d manual=\u201d%23%20yum%20install%20packagename\u201d message=\u201dbash code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<h2 id=\"method-2\"><span style=\"color: #003366;\"><label class=\"label label-success\">METHOD 2:<\/label><\/span><\/h2>\n<h3 id=\"installing-a-rpm-package-using-rpm-ivh\"><span style=\"color: #ff6600;\"><b>Installing a RPM package Using rpm \u2013<\/b><b>ivh<\/b><\/span><\/h3>\n<ul>\n<li><strong>RPM filename<\/strong> has packagename, version, release and architecture name.<\/li>\n<li><strong>For example<\/strong>, In the MySQL-client-3.23.57-1.i386.rpm file:<\/li>\n<\/ul>\n[pastacode lang=\u201dbash\u201d manual=\u201dMySQL-client%20%E2%80%93%20Package%20Name%0A3.23.57%20%E2%80%93%20Version%0A1%20%E2%80%93%20Release%0Ai386%20%E2%80%93%20Architecture%0A\u201d message=\u201dbash code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n[ad type=\u201dbanner\u201d]\n<ul>\n<li>When you install a RPM, it checks whether your system is suitable for the software the <a href=\"https:\/\/www.wikitechy.com\/technology\/proscons-deb-vs-rpm\/\" target=\"_blank\" rel=\"noopener\">RPM<\/a> package contains, figures out where to <strong>install the files<\/strong> located inside the rpm package, installs them on your system, and adds that piece of software into its database of installed RPM packages.<\/li>\n<li>The following <strong>rpm command<\/strong> installs Mysql client package.<\/li>\n<\/ul>\n[pastacode lang=\u201dbash\u201d manual=\u201d%23%20rpm%20-ivh%20%20MySQL-client-3.23.57-1.i386.rpm%0APreparing\u2026%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%20%5B100%25%5D%0A%20%20%201%3AMySQL-client%20%20%20%20%20%20%20%20%20%20%20%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%20%5B100%25%5D%0A\u201d message=\u201dbash code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<ul>\n<li>rpm command and options\n<ul>\n<li><strong>-i<\/strong> : install a package<\/li>\n<li><strong>-v<\/strong> : verbose<\/li>\n<li><strong>-h<\/strong> : print hash marks as the package archive is unpacked.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2 id=\"method-3\"><span style=\"color: #003366;\"><label class=\"label label-success\">METHOD 3:<\/label><\/span><\/h2>\n<h4 id=\"install-the-stuff-you-need-and-make-a-place-to-put-the-downloaded-rpms\"><span style=\"color: #008080;\"><b>Install the stuff you need and make a place to put the downloaded RPMs :<\/b><\/span><\/h4>\n[pastacode lang=\u201dbash\u201d manual=\u201d%23%20yum%20install%20yum-plugin-downloadonly%20yum-utils%20createrepo%0A%23%20mkdir%20%2Fvar%2Ftmp%2Fhttpd%0A%23%20mkdir%20%2Fvar%2Ftmp%2Fhttpd-installroot%0A\u201d message=\u201dbash code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<ul>\n<li>Download the RPMs. This uses the <strong>installroot<\/strong> trick suggested here to force a full download of all dependencies since nothing is installed in that empty root.<\/li>\n<li><strong>Yum<\/strong> will create some metadata in there, but we\u2019re going to throw it all away. Note that for <strong>CentOS7 releasever<\/strong> would be \u201c7\u201d.<\/li>\n<\/ul>\n[pastacode lang=\u201dbash\u201d manual=\u201d%23%20yum%20install%20\u2013downloadonly%20\u2013installroot%3D%2Fvar%2Ftmp%2Fhttpd-installroot%20\u2013releasever%3D6%20\u2013downloaddir%3D%2Fvar%2Ftmp%2Fhttpd%20httpd%0A\u201d message=\u201dbash code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n[ad type=\u201dbanner\u201d]\n<ul>\n<li>Yes, that\u00a0was\u00a0the small version. You should have seen the <strong>size of the full-repo downloads!<\/strong><\/li>\n<li><strong>Generate the metadata<\/strong> needed to turn our new pile of RPMs into a YUM repo and clean up the stuff we no longer need:<\/li>\n<\/ul>\n[pastacode lang=\u201dbash\u201d manual=\u201d%23%20createrepo%20\u2013database%20%2Fvar%2Ftmp%2Fhttpd%0A%23%20rm%20-rf%20httpd-installroot%0A\u201d message=\u201dbash code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<ul>\n<li>Configure the download directory as a <strong>repo<\/strong>. Note that for CentOS7 the gpgkey would be named \u201c<strong>7<\/strong>\u201d instead of 6:<\/li>\n<\/ul>\n[pastacode lang=\u201dbash\u201d manual=\u201d%23%20vi%20%2Fetc%2Fyum.repos.d%2Foffline-httpd.repo%0A%5Boffline-httpd%5D%0Aname%3DCentOS-%24releasever%20-%20httpd%0Abaseurl%3Dfile%3A%2F%2F%2Fvar%2Ftmp%2Fhttpd%0Aenabled%3D0%0Agpgcheck%3D1%0Agpgkey%3Dfile%3A%2F%2F%2Fetc%2Fpki%2Frpm-gpg%2FRPM-GPG-KEY-CentOS-6%0A\u201d message=\u201dbash code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<ul>\n<li>To check the missing dependencies:<\/li>\n<\/ul>\n[pastacode lang=\u201dbash\u201d manual=\u201d%23%20repoclosure%20\u2013repoid%3Doffline-httpd%20%20%20%0A\u201d message=\u201dbash code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n[ad type=\u201dbanner\u201d]\n<ul>\n<li>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.<\/li>\n<li>Still, if you see something obviously missing, this might be a good chance to go back and add it using the same yum install \u2013download only method above.<\/li>\n<li>When offline or after copying the \/var\/tmp\/httpd repo directory to the other server set up the repo there:<\/li>\n<\/ul>\n[pastacode lang=\u201dbash\u201d manual=\u201d%23%20vi%20%2Fetc%2Fyum.repos.d%2Foffline-httpd.repo%0A%5Boffline-httpd%5D%0Aname%3DCentOS-%24releasever%20-%20httpd%0Abaseurl%3Dfile%3A%2F%2F%2Fvar%2Ftmp%2Fhttpd%0Aenabled%3D0%0Agpgcheck%3D1%0Agpgkey%3Dfile%3A%2F%2F%2Fetc%2Fpki%2Frpm-gpg%2FRPM-GPG-KEY-CentOS-6%0A%23%20yum%20\u2013disablerepo%3D%5C*%20\u2013enablerepo%3Doffline-httpd%20install%20httpd%0A\u201d message=\u201dbash code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to install all RPMs in a directory &#8211; When you install a RPM, it checks whether your system is suitable for the software the RPM<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1699],"tags":[6764,6765,6760,6758,6763,6761,6759,6757,6756,6762],"class_list":["post-3635","post","type-post","status-publish","format-standard","hentry","category-linux","tag-centos-7-php-7-you-could-try-using-skip-broken-to-work-around-the-problem","tag-get-centos-version","tag-how-to-install-rpm-in-a-particular-directory","tag-how-to-install-rpm-package-with-dependencies-in-redhat","tag-install-php-5-6-centos-7","tag-rpm-force-install","tag-yum-download-dependencies","tag-yum-install-local-rpm-with-dependencies","tag-yum-install-rpm-with-dependencies","tag-yum-list-dependencies-requires-httpd-mmn-20051115"],"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/3635","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/comments?post=3635"}],"version-history":[{"count":0,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/3635\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media?parent=3635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/categories?post=3635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/tags?post=3635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}