{"id":317,"date":"2024-11-23T17:56:23","date_gmt":"2024-11-23T09:56:23","guid":{"rendered":"http:\/\/192.168.5.24\/?p=317"},"modified":"2025-06-24T08:48:33","modified_gmt":"2025-06-24T00:48:33","slug":"%e5%bb%ba%e7%ab%8b%e8%87%aa%e5%b7%b1%e7%9a%84%e7%a7%81%e6%9c%89yum%e4%bb%93%e5%ba%93","status":"publish","type":"post","link":"https:\/\/bigvip.dpdns.org\/?p=317","title":{"rendered":"\u5efa\u7acb\u81ea\u5df1\u7684\u79c1\u6709yum\u4ed3\u5e93"},"content":{"rendered":"\n<p>\u5efa\u7acb\u79c1\u6709\u7684\u5185\u90e8yum\u6e90\uff0c\u4ee5\u65b9\u4fbf\u5185\u90e8\u65e0\u6cd5\u8054\u7f51\u7684\u7528\u6237\u4f7f\u7528\u3002<\/p>\n\n\n\n<p>\u6211\u7684\u73af\u5883\uff1aFTP\u670d\u52a1\u5668\uff0cCentOS7\u7cfb\u7edf\u3002<\/p>\n\n\n\n<p>\u5fc5\u5907\u8f6f\u4ef6\uff1acreaterepo<\/p>\n\n\n\n<p>\u4e0b\u8f7d\u8f6f\u4ef6\u5305\uff1a<\/p>\n\n\n\n<p>1\u3001\u81ea\u884c\u4e0b\u8f7d\u3002<\/p>\n\n\n\n<p>2\u3001\u4f7f\u7528yum\u547d\u4ee4\u4e0b\u8f7d\u76f8\u5173\u8f6f\u4ef6\u5305\u53ca\u4f9d\u8d56\u5305\uff0c\u5efa\u8bae\u4f7f\u7528\u8be5\u65b9\u6cd5\uff0c\u53ef\u4ee5\u89e3\u51b3\u4f9d\u8d56\u95ee\u9898\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u5148\u914d\u7f6e\u670d\u52a1\u5668\u7684\u4ed3\u5e93\uff1a\nwget -O \/etc\/yum.repos.d\/epel.repo https:\/\/mirrors.aliyun.com\/repo\/epel-7.repo<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>yum -y install --downloadonly  --downloaddir=\/ftproot\/linux_soft\/  <strong><em>software_name<\/em><\/strong><\/code><\/pre>\n\n\n\n<p>3\u3001\u521b\u5efayum\u4ed3\u5e93\u7684\u5143\u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/ftproot\/linux_soft\/\ncreaterepo -o . .<\/code><\/pre>\n\n\n\n<p>\u7f16\u5199\u81ea\u52a8\u521b\u5efa\u811a\u672c\uff0c\u8bbe\u7f6e\u5f00\u673a\u81ea\u52a8\u540e\u53f0\u8fd0\u884c\u5373\u53ef\u5b9e\u73b0\u81ea\u52a8\u66f4\u65b0\u4ed3\u5e93\u6570\u636e\u5e93<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost linux_soft]# cat \/usr\/local\/share\/script\/automkrepo.sh\n#!\/bin\/bash\n\n#\u76d1\u63a7\u76ee\u5f55\nlocal_dir=\"\/ftproot\/linux_soft\/rpm\"\n# \u76d1\u63a7\u672c\u5730\u76ee\u5f55\u7684\u521b\u5efa\u548c\u5220\u9664\u4e8b\u4ef6\n\/usr\/bin\/inotifywait -mq -e create -e delete --timefmt '%Y-%m-%d %H:%M:%S' --format '%T %w%f %e' \"$local_dir\" | while read date time file event\ndo\n#if &#91; $event = \"DELETE\" ]||&#91; $event = \"CREATE\" ] then\n   \/usr\/bin\/createrepo --update -o \/ftproot\/linux_soft\/ \/ftproot\/linux_soft\/\n#fi\ndone\n<\/code><\/pre>\n\n\n\n<p>\u521b\u5efa\u8f6f\u4ef6\u7ec4\u7684\u5143\u6570\u636e\u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/ftproot\/linux_soft\/\ncreaterepo -g . .<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">4\u3001\u642d\u5efaftp\u670d\u52a1\u5668\u6216http\u670d\u52a1\u5668\uff0c\u628a\u4ed3\u5e93\u6240\u5728\u76ee\u5f55\u5171\u4eab\u7ed9\u7528\u6237\u4e0b\u8f7d<\/p>\n\n\n\n<p>         \u5982ftp\u670d\u52a1\u5668\u53ef\u4ee5\u4f7f\u7528\u533f\u540d\u7528\u6237\u4e0b\u8f7d\uff0c\u8bbe\u7f6e\u533f\u540d\u7528\u6237\u7684\u6839\u76ee\u5f55\u5230\u8f6f\u4ef6\u76ee\u5f55\u5373\u53ef\uff08anon_root  \/path\/to\/rpmdir\/\uff09\u3002http\u65b9\u5f0f\u8fd9\u628aDocument Root  \u6307\u5411 \/path\/to\/rpmdir\/\u5373\u53ef\u3002<\/p>\n\n\n\n<p>5\u3001\u914d\u7f6e<strong>\u5ba2\u6237\u7aef<\/strong>\u7684yum\u4ed3\u5e93\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi \/etc\/yum.repos.d\/My_repo.repo\n&#91;development]\nname=guimei-repo\n<em><strong>#ftp\u7684\u8def\u5f84\u9700\u8981\u6307\u5411\u4ed3\u5e93\u7684\u5143\u6587\u4ef6<\/strong><\/em>\nbaseurl=ftp:\/\/192.168.5.24\/linux_soft\/\ngpgcheck=0\nenabled=1<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5efa\u7acb\u79c1\u6709\u7684\u5185\u90e8yum\u6e90\uff0c\u4ee5\u65b9\u4fbf\u5185\u90e8\u65e0\u6cd5\u8054\u7f51\u7684\u7528\u6237\u4f7f\u7528\u3002 \u6211\u7684\u73af\u5883\uff1aFTP\u670d\u52a1\u5668\uff0cCentOS7\u7cfb\u7edf\u3002 \u5fc5\u5907\u8f6f\u4ef6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":{"footnotes":""},"categories":[20,36],"tags":[55],"class_list":["post-317","post","type-post","status-publish","format-aside","hentry","category-linux","category-36","tag-yum","post_format-post-format-aside"],"_links":{"self":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/317","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=317"}],"version-history":[{"count":14,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/317\/revisions"}],"predecessor-version":[{"id":1107,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/317\/revisions\/1107"}],"wp:attachment":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=317"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=317"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}