{"id":614,"date":"2014-11-14T15:08:43","date_gmt":"2014-11-14T15:08:43","guid":{"rendered":"http:\/\/vickistan.com\/?p=614"},"modified":"2014-11-14T15:17:18","modified_gmt":"2014-11-14T15:17:18","slug":"how-to-create-a-local-yum-repository","status":"publish","type":"post","link":"https:\/\/vickistan.com\/?p=614","title":{"rendered":"How to create a local yum repository"},"content":{"rendered":"<p><strong>Yum Server Side<\/strong><\/p>\n<p>Take a look at the available repositories with the repolist option to yum:<\/p>\n<p>$yum repolist<br \/>\nLoaded plugins: fastestmirror<br \/>\nLoading mirror speeds from cached hostfile<br \/>\nepel\/metalink | 13 kB 00:00<br \/>\n* base: mirror.symnds.com<br \/>\n* epel: epel.mirror.constant.com<br \/>\n* extras: mirrors.advancedhosters.com<br \/>\n* updates: mirrors.lga7.us.voxel.net<br \/>\nbase | 3.7 kB 00:00<br \/>\nepel | 4.4 kB 00:00<br \/>\nepel\/primary_db | 6.4 MB 00:00<br \/>\nextras | 3.4 kB 00:00<br \/>\nnewrelic | 951 B 00:00<br \/>\nshells_fish_release_2 | 1.2 kB 00:00<br \/>\nupdates | 3.4 kB 00:00<br \/>\nvirtualbox<\/p>\n<p>Add required supporting packages:<br \/>\n$yum install libxml2-python deltarpm python-deltarpm vsftpd<\/p>\n<p>Create a directory to store the rpm files or mount a directory which contains them.<br \/>\n$mkdir \/var\/ftp\/pub\/localrepo<\/p>\n<p>Copy rpms to \/var\/ftp\/pub\/localrepo<br \/>\n$cp \/mnt\/disk\/*.rpm \/var\/ftp\/pub\/localrepo\/<\/p>\n<p>Add the repo config file:<br \/>\n$vim \/etc\/yum.repos.d\/localrepo.repo<br \/>\nAdd the following lines:<\/p>\n<p>[localrepo]<br \/>\nname=Local Repository<br \/>\nbaseurl=file:\/\/\/var\/ftp\/pub\/localrepo<br \/>\ngpgcheck=0<br \/>\nenabled=1<\/p>\n<p>Build the local repository:<br \/>\n$createrepo -v \/var\/ftp\/pub\/localrepo<\/p>\n<p>Now use the yum command that we used above to verify that yum sees the new repo:<br \/>\n$yum repolist<\/p>\n<p>As a good practice, run clean all and update:<\/p>\n<p>$yum clean all<br \/>\n$yum update<\/p>\n<p>Remember to add the repo to any client machine that should have access to it:<\/p>\n<p><strong>Client Side Configuration<\/strong><br \/>\nNow, go to your client systems. Create a new repository file as shown above under \/etc\/yum.repos.d\/ directory.<\/p>\n<p>$vim \/etc\/yum.repos.d\/localrepo.repo<br \/>\nand add the following contents:<\/p>\n<p>[localrepo]<br \/>\nname=Local Repository<br \/>\nbaseurl=ftp:\/\/{IP OF LOCALREPO}\/pub\/localrepo<br \/>\ngpgcheck=0<br \/>\nenabled=1<\/p>\n<p>Now, list out the repositories using the following command:<br \/>\n$yum repolist<\/p>\n<p>Clean the Yum cache and update the repository lists:<\/p>\n<p>$yum clean all<br \/>\n$yum update<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yum Server Side Take a look at the available repositories with the repolist option to yum: $yum repolist Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile epel\/metalink | 13 kB 00:00 * base: mirror.symnds.com * epel: epel.mirror.constant.com * extras: &hellip; <a href=\"https:\/\/vickistan.com\/?p=614\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-614","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/posts\/614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=614"}],"version-history":[{"count":5,"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/posts\/614\/revisions"}],"predecessor-version":[{"id":620,"href":"https:\/\/vickistan.com\/index.php?rest_route=\/wp\/v2\/posts\/614\/revisions\/620"}],"wp:attachment":[{"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vickistan.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}