{"id":2371,"date":"2020-10-17T21:47:44","date_gmt":"2020-10-17T13:47:44","guid":{"rendered":"http:\/\/blog.ywdevops.cn\/?p=2371"},"modified":"2023-11-29T16:46:24","modified_gmt":"2023-11-29T08:46:24","slug":"yum-3","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2020\/10\/17\/yum-3\/","title":{"rendered":"\u57fa\u4e8ehttp\u914d\u7f6eyum\u7f51\u7edc\u6e90"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">YUM \u5149\u76d8\u6e90\u9ed8\u8ba4\u53ea\u80fd\u672c\u673a\u4f7f\u7528\uff0c\u5c40\u57df\u7f51\u5176\u4ed6\u670d\u52a1\u5668\u65e0\u6cd5\u4f7f\u7528 YUM \u5149\u76d8\u6e90\uff0c\u5982\u679c\u60f3 \u4f7f\u7528\u7684\u8bdd\uff0c\u9700\u8981\u5728\u6bcf\u53f0\u670d\u52a1\u5668\u4e0a\u6784\u5efa YUM \u672c\u5730\u6e90\uff0c\u8be5\u65b9\u6848\u5728\u4f01\u4e1a\u4e2d\u4e0d\u53ef\u53d6\uff0c\u6240\u4ee5\u9700\u8981\u6784 \u5efa HTTP \u5c40\u57df\u7f51 YUM \u6e90\u89e3\u51b3\uff0c\u53ef\u4ee5\u901a\u8fc7 CreateRepo \u521b\u5efa\u672c\u5730 YUM \u6e90\u7aef\uff0crepo \u5373\u4e3a Repository\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> <strong>\u6784\u5efa HTTP \u5c40\u57df\u7f51 YUM \u6e90\u65b9\u6cd5\u53ca\u6b65\u9aa4\u5982\u4e0b\uff1a  <\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001 \u6302\u8f7d\u5149\u76d8\u955c\u50cf\u6587\u4ef6\u81f3\/mnt      (\u6302\u8f7d\u8def\u5f84\u53ef\u6839\u636e\u9700\u8981\u81ea\u5df1\u9009\u62e9)\uff0c\u6267\u884c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>mount  \/dev\/cdrom  \/mnt<\/strong>\/<strong>cdrom<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001 \u672c\u5730 YUM \u6e90\u901a\u8fc7 CreateRepo \u642d\u5efa\u5b8c\u6bd5\uff0c\u9700\u8981\u501f\u52a9 HTTP WEB \u670d\u52a1\u5668\u53d1\u5e03 \/var\/www\/html\/centos\/\u4e2d\u6240\u6709\u8f6f\u4ef6\uff0cYUM \u6216\u8005 RPM \u5b89\u88c5 HTTP WEB \u670d\u52a1\u5668\uff0c\u5e76\u542f \u52a8 httpd \u670d\u52a1\u3002  (<strong>\u4e0d\u4e00\u5b9a\u662fhttpd\uff0cnginx\u4e5f\u53ef\u4ee5\u7684<\/strong>) ,\u5b89\u88c5httpd\u670d\u52a1\u5668\uff0c\u53ef\u76f4\u63a5\u6267\u884c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum -y install httpd\nuseradd apache -g apache\nsystemctl start httpd<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001apache\u9ed8\u8ba4\u5b89\u88c5\u7684\u76ee\u5f55\u4e3a\/var\/www\/html\uff0c\u5728\u6b64\u76ee\u5f55\u4e0b\u521b\u5efa\u6587\u4ef6\u5939centos(\u76ee\u5f55\u53ef\u6839\u636e\u9700\u8981\u81ea\u5b9a\u4e49\u8bbe\u7f6e)\uff0c\u7136\u540e\u62f7\u8d1d\/mnt\/Packages \u76ee\u5f55\u4e0b\u6240\u6709\u8f6f\u4ef6\u5305\u81f3\/var\/www\/html\/centos\/ <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>cp -a  \/mnt\/Packages\/*    \/var\/www\/html\/centos<\/strong><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">4\u3001 \u4f7f\u7528 Createrepo \u521b\u5efa\u672c\u5730\u6e90\uff0c\u6267\u884c\u5982\u4e0b\u547d\u4ee4\u4f1a\u5728 Centos \u76ee\u5f55\u751f\u6210 repodata\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum -y install  createrepo*          \/\/\u5148\u5b89\u88c5createrepo\ncd  \/var\/www\/html\/centos\/            \/\/\u8fdb\u5165\u521b\u5efa\u7684\u76ee\u5f55\ncreaterepo    .                     \/\/\u521b\u5efa\u672c\u5730\u6e90<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6b64\u65f6\u901a\u8fc7ip\u5730\u5740\u52a0\u540e\u7f00centos\u8bbf\u95ee\u53ef\u4ee5\u770b\u5230\u8f6f\u4ef6\u6e90\u4fe1\u606f\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"596\" height=\"253\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/12-1.png\" alt=\"\" class=\"wp-image-2372\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/12-1.png 596w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/12-1-300x127.png 300w\" sizes=\"auto, (max-width: 596px) 100vw, 596px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">5\u3001\u63a5\u4e0b\u6765\u5728\u540c\u4e00\u5c40\u57df\u7f51\u4e2d\u5176\u4ed6\u673a\u5668\u914d\u7f6eyum\u6e90\uff0c\u5e76\u6d4b\u8bd5\u4f7f\u7528\uff0c\u9996\u5148\u8fdb\u5165\u76ee\u5f55\/etc\/yum.repos.d\/\u76ee\u5f55\u4e2d\uff0c\u5220\u9664\u5176\u4f59\u7684repo\u6587\u4ef6\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/etc\/yum.repos.d   &amp;&amp;   rm -rf  .\/*<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">6\u3001\u7f16\u8f91\u6587\u4ef6vim   httpd.repo \uff0c\u8f93\u5165\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"243\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/13.png\" alt=\"\" class=\"wp-image-2373\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/13.png 602w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/13-300x121.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/13-600x242.png 600w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">7\u3001\u7f16\u8f91\u5b8c\u6210\u540e\u6d4b\u8bd5\u662f\u5426\u53ef\u4ee5\u6b63\u5e38\u4e0b\u8f7d\u8f6f\u4ef6\uff0c\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"381\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/14.png\" alt=\"\" class=\"wp-image-2374\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/14.png 600w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/14-300x191.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">8\u3001\u6d4b\u8bd5\u5b89\u88c5\u8f6f\u4ef6\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"597\" height=\"251\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/15.png\" alt=\"\" class=\"wp-image-2375\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/15.png 597w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/15-300x126.png 300w\" sizes=\"auto, (max-width: 597px) 100vw, 597px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size wp-block-paragraph\"><strong>yum\u6e90\u7aef\u8f6f\u4ef6\u5305\u6269\u5c55<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u9ed8\u8ba4\u4f7f\u7528 ISO \u955c\u50cf\u6587\u4ef6\u4e2d\u7684\u8f6f\u4ef6\u5305\u6784\u5efa\u7684 HTTP YUM \u6e90\uff0c\u4f1a\u53d1\u73b0\u7f3a\u5c11\u5f88\u591a\u8f6f\u4ef6\u5305\uff0c \u5982\u679c\u670d\u52a1\u5668\u9700\u8981\u6302\u8f7d\u79fb\u52a8\u786c\u76d8\uff0cMount \u6302\u8f7d\u79fb\u52a8\u786c\u76d8\u9700\u8981 ntfs-3g \u8f6f\u4ef6\u5305\u652f\u6301\uff0c\u800c\u672c\u5730 \u5149\u76d8\u955c\u50cf\u4e2d\u6ca1\u6709\u8be5\u8f6f\u4ef6\u5305\uff0c\u6b64\u65f6\u9700\u8981\u5f80 YUM \u6e90\u7aef\u6dfb\u52a0 ntfs-3g \u8f6f\u4ef6\u5305\uff0c\u6dfb\u52a0\u65b9\u6cd5\u5982\u4e0b\uff1a <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u901a\u8fc7\u7f51\u7edc\u4e0b\u8f7dntfs-3g\u7684rpm\u5305\uff0c\u4e0b\u8f7d\u540e\u5c06\u5176\u79fb\u52a8\u5230\/var\/www\/html\/centos\u76ee\u5f55\u4e2d<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u8fdb\u5165\u5230\/var\/www\/html\/centos\u76ee\u5f55\u4e2d\uff0c\u901a\u8fc7createrepo\u66f4\u65b0\u8f6f\u4ef6\u5305\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>createrepo  --update  .      \/\/\u66f4\u65b0\u8f6f\u4ef6\u5305\uff0c\u6ce8\u610f\u6709\u4e00\u4e2a.\u8868\u793a\u5f53\u524d\u76ee\u5f55\uff0cupdate\u524d\u9762\u4e24\u4e2a\"-\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u5728\u5176\u4ed6\u673a\u5668\u4e0a\u5148\u6e05\u695a\u7f13\u5b58\uff0c\u7136\u540e\u5728\u901a\u8fc7\u547d\u4ee4\u5b89\u88c5\u5373\u53ef\uff0c\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum  clean all\nyum -y  install ntfs-3g<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6ce8\u610f\uff1a\u5982\u679c\u6709\u5176\u4ed6\u7684rpm\u5305\u9700\u8981\u6269\u5c55\u90fd\u53ef\u4ee5\u901a\u8fc7\u6b64\u65b9\u5f0f\u8fdb\u884c\u66f4\u65b0(createrepo &#8211;update   \u76ee\u5f55)<\/p>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size wp-block-paragraph\"><strong>\u540c\u6b65\u5916\u7f51yum\u6e90\u8f6f\u4ef6\u5305\u5230\u672c\u5730<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u4f01\u4e1a\u5b9e\u9645\u5e94\u7528\u573a\u666f\u4e2d\uff0c\u4ec5\u4ec5\u9760\u5149\u76d8\u91cc\u9762\u7684 RPM \u8f6f\u4ef6\u5305\u662f\u4e0d\u80fd\u6ee1\u8db3\u9700\u8981\uff0c\u6211\u4eec\u53ef\u4ee5 \u628a\u5916\u7f51\u7684 YUM \u6e90\u4e2d\u7684\u6240\u6709\u8f6f\u4ef6\u5305\u540c\u6b65\u81f3\u672c\u5730\uff0c\u53ef\u4ee5\u5b8c\u5584\u672c\u5730 YUM \u6e90\u7684\u8f6f\u4ef6\u5305\u6570\u91cf\u53ca\u5b8c\u6574\u6027\u3002 <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u83b7\u53d6\u5916\u7f51 YUM \u6e90\u8f6f\u4ef6\u5e38\u89c1\u65b9\u6cd5\u5305\u62ec Rsync\u3001Wget\u3001Reposync\uff0c\u4e09\u79cd\u540c\u6b65\u65b9\u6cd5\u7684 \u533a\u522b Rsync \u65b9\u5f0f\u9700\u8981\u5916\u7f51 YUM \u6e90\u652f\u6301 RSYNC \u534f\u8bae\uff0cWget \u53ef\u4ee5\u76f4\u63a5\u83b7\u53d6\uff0c\u800c Reposync \u53ef\u4ee5\u540c\u6b65\u51e0\u4e4e\u6240\u6709\u7684 YUM \u6e90\uff0c\u4e0b\u9762\u4ee5 Reporsync \u4e3a\u6848\u4f8b\uff0c\u540c\u6b65\u5916\u7f51 YUM \u6e90\u8f6f\u4ef6\u81f3\u672c\u5730\uff0c\u6b65\u9aa4\u5982\u4e0b\uff1a <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001 \u4e0b\u8f7d CentOS7 REPO \u6587\u4ef6\u81f3\/etc\/yum.repos.d\/\uff0c\u5e76\u5b89\u88c5 reposync \u547d\u4ee4\u5de5\u5177\uff1a <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget http:\/\/mirrors.163.com\/.help\/CentOS7-Base-163.repo\nmv   CentOS7-Base-163.repo   \/etc\/yum.repos.d\/centos.repo\nyum clean all\nyum install yum-utils createrepo \u2013y \nyum repolist <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001 \u901a\u8fc7 reposync \u547d\u4ee4\u5de5\u5177\u83b7\u53d6\u5916\u7f51 YUM \u6e90\u6240\u6709\u8f6f\u4ef6\u5305\uff0c-r \u6307\u5b9a repolist id\uff0c\u9ed8\u8ba4\u4e0d\u52a0-r \u8868\u793a\u83b7\u53d6\u5916\u7f51\u6240\u6709 YUM \u8f6f\u4ef6\u5305\uff0c-p \u53c2\u6570\u8868\u793a\u6307\u5b9a\u4e0b\u8f7d\u8f6f\u4ef6\u7684\u8def\u5f84\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>reposync -r   base   -p    \/var\/www\/html\/centos\nreposync -r  updates -p   \/var\/www\/html\/centos<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"599\" height=\"282\" src=\"http:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/16.png\" alt=\"\" class=\"wp-image-2377\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/16.png 599w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2020\/10\/16-300x141.png 300w\" sizes=\"auto, (max-width: 599px) 100vw, 599px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u66f4\u65b0\u5b8c\u5b89\u88c5\u5305\u540e\uff0c\u9700\u8981\u901a\u8fc7createrepo\u66f4\u65b0\u672c\u5730yum\u5e93\uff0c\u6267\u884c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>createrepo --update   \/var\/www\/html\/centos<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>YUM \u5149\u76d8\u6e90\u9ed8\u8ba4\u53ea\u80fd\u672c\u673a\u4f7f\u7528\uff0c\u5c40\u57df\u7f51\u5176\u4ed6\u670d\u52a1\u5668\u65e0\u6cd5\u4f7f\u7528 YUM \u5149\u76d8\u6e90\uff0c\u5982\u679c\u60f3 \u4f7f\u7528\u7684\u8bdd\uff0c\u9700\u8981\u5728\u6bcf\u53f0\u670d\u52a1\u5668\u4e0a [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":2378,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,22],"tags":[],"class_list":["post-2371","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-server"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/2371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2371"}],"version-history":[{"count":8,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/2371\/revisions"}],"predecessor-version":[{"id":15689,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/2371\/revisions\/15689"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/2378"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}