{"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<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">bash code<\/span> <\/div> <pre class=\"language-bash code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-bash code-embed-code\"># chown -R root.root \/home\/user\/repo<\/code><\/pre> <\/div>\n<ul>\n<li>Install the <strong>createrepo package<\/strong> if not installed yet, and run<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">bash code<\/span> <\/div> <pre class=\"language-bash code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-bash code-embed-code\"># createrepo \/home\/user\/repo<br\/># chmod -R o-w+r \/home\/user\/repo<\/code><\/pre> <\/div>\n[ad type=&#8221;banner&#8221;]\n<ul>\n<li>Create a <strong>repository configuration file<\/strong>, e.g. \/etc\/yum.repos.d\/myrepo.repo containing<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">bash code<\/span> <\/div> <pre class=\"language-bash code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-bash code-embed-code\">[local]<br\/>name=My Awesome Repo<br\/>baseurl=file:\/\/\/home\/user\/repo<br\/>enabled=1<br\/>gpgcheck=0<\/code><\/pre> <\/div>\n<ul>\n<li><strong>Install<\/strong> your package using<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">bash code<\/span> <\/div> <pre class=\"language-bash code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-bash code-embed-code\"># yum install packagename<\/code><\/pre> <\/div>\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 &#8211;<\/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<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">bash code<\/span> <\/div> <pre class=\"language-bash code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-bash code-embed-code\">MySQL-client \u2013 Package Name<br\/>3.23.57 \u2013 Version<br\/>1 \u2013 Release<br\/>i386 \u2013 Architecture<\/code><\/pre> <\/div>\n[ad type=&#8221;banner&#8221;]\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<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">bash code<\/span> <\/div> <pre class=\"language-bash code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-bash code-embed-code\"># rpm -ivh  MySQL-client-3.23.57-1.i386.rpm<br\/>Preparing...                ########################################### [100%]<br\/>   1:MySQL-client           ########################################### [100%]<\/code><\/pre> <\/div>\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<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">bash code<\/span> <\/div> <pre class=\"language-bash code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-bash code-embed-code\"># yum install yum-plugin-downloadonly yum-utils createrepo<br\/># mkdir \/var\/tmp\/httpd<br\/># mkdir \/var\/tmp\/httpd-installroot<\/code><\/pre> <\/div>\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&#8217;re going to throw it all away. Note that for <strong>CentOS7 releasever<\/strong> would be &#8220;7&#8221;.<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">bash code<\/span> <\/div> <pre class=\"language-bash code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-bash code-embed-code\"># yum install --downloadonly --installroot=\/var\/tmp\/httpd-installroot --releasever=6 --downloaddir=\/var\/tmp\/httpd httpd<\/code><\/pre> <\/div>\n[ad type=&#8221;banner&#8221;]\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<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">bash code<\/span> <\/div> <pre class=\"language-bash code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-bash code-embed-code\"># createrepo --database \/var\/tmp\/httpd<br\/># rm -rf httpd-installroot<\/code><\/pre> <\/div>\n<ul>\n<li>Configure the download directory as a <strong>repo<\/strong>. Note that for CentOS7 the gpgkey would be named &#8220;<strong>7<\/strong>&#8221; instead of 6:<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">bash code<\/span> <\/div> <pre class=\"language-bash code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-bash code-embed-code\"># vi \/etc\/yum.repos.d\/offline-httpd.repo<br\/>[offline-httpd]<br\/>name=CentOS-$releasever - httpd<br\/>baseurl=file:\/\/\/var\/tmp\/httpd<br\/>enabled=0<br\/>gpgcheck=1<br\/>gpgkey=file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-CentOS-6<\/code><\/pre> <\/div>\n<ul>\n<li>To check the missing dependencies:<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">bash code<\/span> <\/div> <pre class=\"language-bash code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-bash code-embed-code\"># repoclosure --repoid=offline-httpd   <\/code><\/pre> <\/div>\n[ad type=&#8221;banner&#8221;]\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<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">bash code<\/span> <\/div> <pre class=\"language-bash code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-bash code-embed-code\"># vi \/etc\/yum.repos.d\/offline-httpd.repo<br\/>[offline-httpd]<br\/>name=CentOS-$releasever - httpd<br\/>baseurl=file:\/\/\/var\/tmp\/httpd<br\/>enabled=0<br\/>gpgcheck=1<br\/>gpgkey=file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-CentOS-6<br\/># yum --disablerepo=\\* --enablerepo=offline-httpd install httpd<\/code><\/pre> <\/div>\n<p>&nbsp;<\/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}]}}