{"id":94199,"date":"2024-04-27T02:33:58","date_gmt":"2024-04-26T18:33:58","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=94199"},"modified":"2024-04-27T02:33:58","modified_gmt":"2024-04-26T18:33:58","slug":"create-yum-repository","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/create-yum-repository.html","title":{"rendered":"Centos\/RHEL\/Fedora \u521b\u5efa\u4e00\u4e2a Yum \u4ed3\u5e93"},"content":{"rendered":"
Yum \u662f Centos\/RHEL\/Fedora \u4e2d\u6700\u91cd\u8981\u7684\u5de5\u5177\u4e4b\u4e00\u3002\u5c3d\u7ba1\u5728 Fedora \u7684\u6700\u65b0\u7248\u672c\u4e2d\uff0c\u5b83\u5df2\u7ecf\u88ab DNF \u6240\u53d6\u4ee3\uff0c\u4f46\u8fd9\u5e76\u4e0d\u610f\u5473\u7740\u5b83\u81ea\u751f\u81ea\u706d\u4e86\u3002\u5b83\u4ecd\u7136\u88ab\u5e7f\u6cdb\u7528\u4e8e\u5b89\u88c5 rpm \u5305\uff0c\u6211\u4eec\u5df2\u7ecf\u5728\u524d\u9762\u7684\u6559\u7a0b\uff08\u5728\u8fd9\u91cc\u9605\u8bfb<\/strong><\/a>[1]<\/span>\uff09\u4e2d\u7528\u793a\u4f8b\u8ba8\u8bba\u4e86 Yum\u3002<\/p>\n \u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u5b66\u4e60\u521b\u5efa\u4e00\u4e2a\u672c\u5730 Yum \u4ed3\u5e93\uff0c\u9996\u5148\u4f7f\u7528\u7cfb\u7edf\u7684 ISO \u955c\u50cf\uff0c\u7136\u540e\u521b\u5efa\u4e00\u4e2a\u5728\u7ebf Yum \u4ed3\u5e93\u7684\u955c\u50cf\u3002<\/p>\n \u6211\u4eec\u5728\u672c\u6559\u7a0b\u4e2d\u4f7f\u7528 Centos 7 dvd\uff0c\u540c\u6837\u7684\u8fc7\u7a0b\u4e5f\u5e94\u8be5\u53ef\u4ee5\u7528\u5728 RHEL 7 \u4e0a\u3002<\/p>\n \u9996\u5148\u5728\u6839\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a Yum \u7684\u76ee\u5f55<\/p>\n \u7136\u540e\u6302\u8f7d Centos 7 ISO\uff1a<\/p>\n \u63a5\u4e0b\u6765\uff0c\u4ece\u6302\u8f7d\u7684 ISO \u4e2d\u590d\u5236\u8f6f\u4ef6\u5305\u5230 \/YUM<\/span> \u4e2d\u3002\u5f53\u6240\u6709\u7684\u8f6f\u4ef6\u5305\u90fd\u88ab\u590d\u5236\u5230\u7cfb\u7edf\u4e2d\u540e\uff0c\u6211\u4eec\u5c06\u5b89\u88c5\u521b\u5efa Yum \u6240\u9700\u7684\u8f6f\u4ef6\u5305\u3002\u6253\u5f00 \/YUM<\/span> \u5e76\u5b89\u88c5\u4ee5\u4e0b RPM \u5305\uff1a<\/p>\n \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u5c06\u5728 \/etc\/yum.repos.d<\/span> \u4e2d\u521b\u5efa\u4e00\u4e2a\u540d \u4e3a local.repo<\/span> \u7684\u6587\u4ef6\uff0c\u5176\u4e2d\u5305\u542b\u6240\u6709\u7684 Yum \u4fe1\u606f\u3002<\/p>\n \u4fdd\u5b58\u5e76\u9000\u51fa\u6587\u4ef6\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u521b\u5efa\u4ed3\u5e93\u6570\u636e\u3002<\/p>\n \u521b\u5efa\u4ed3\u5e93\u6570\u636e\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\u3002\u4e00\u5207\u5b8c\u6210\u540e\uff0c\u8bf7\u8fd0\u884c\uff1a<\/p>\n \u6e05\u7406\u7f13\u5b58\uff0c\u7136\u540e\u8fd0\u884c\uff1a<\/p>\n \u68c0\u67e5\u6240\u6709\u4ed3\u5e93\u5217\u8868\u3002\u4f60\u5e94\u8be5\u5728\u5217\u8868\u4e2d\u770b\u5230 local.repo<\/span>\u3002<\/p>\n \u521b\u5efa\u5728\u7ebf Yum \u7684\u8fc7\u7a0b\u4e0e\u4f7f\u7528 ISO \u955c\u50cf\u521b\u5efa Yum \u7c7b\u4f3c\uff0c\u53ea\u662f\u6211\u4eec\u5c06\u4ece\u5728\u7ebf\u4ed3\u5e93\u800c\u4e0d\u662f ISO \u4e2d\u83b7\u53d6 rpm \u8f6f\u4ef6\u5305\u3002<\/p>\n \u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u627e\u5230\u4e00\u4e2a\u5728\u7ebf\u4ed3\u5e93\u6765\u83b7\u53d6\u6700\u65b0\u7684\u8f6f\u4ef6\u5305\u3002\u5efa\u8bae\u4f60\u627e\u4e00\u4e2a\u79bb\u4f60\u4f4d\u7f6e\u6700\u8fd1\u7684\u5728\u7ebf Yum \u4ed3\u5e93\uff0c\u4ee5\u4f18\u5316\u4e0b\u8f7d\u901f\u5ea6\u3002\u6211\u4eec\u5c06\u4f7f\u7528\u4e0b\u9762\u7684\u955c\u50cf\uff0c\u4f60\u53ef\u4ee5\u4ece CENTOS \u955c\u50cf\u5217\u8868<\/a>[2]<\/span>\u4e2d\u9009\u62e9\u4e00\u4e2a\u79bb\u4f60\u6700\u8fd1\u7684\u955c\u50cf\u3002<\/p>\n \u9009\u62e9\u955c\u50cf\u4e4b\u540e\uff0c\u6211\u4eec\u5c06\u4f7f\u7528 rsync<\/span> \u5c06\u8be5\u955c\u50cf\u4e0e\u6211\u4eec\u7684\u7cfb\u7edf\u540c\u6b65\uff0c\u4f46\u5728\u6b64\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u4f60\u670d\u52a1\u5668\u4e0a\u6709\u8db3\u591f\u7684\u7a7a\u95f4\u3002<\/p>\n \u540c\u6b65\u5c06\u9700\u8981\u76f8\u5f53\u957f\u4e00\u6bb5\u65f6\u95f4\uff08\u4e5f\u8bb8\u4e00\u4e2a\u5c0f\u65f6\uff09\uff0c\u8fd9\u53d6\u51b3\u4e8e\u4f60\u4e92\u8054\u7f51\u7684\u901f\u5ea6\u3002\u540c\u6b65\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u5c06\u66f4\u65b0\u6211\u4eec\u7684\u4ed3\u5e93\u6570\u636e\u3002<\/p>\n \u6211\u4eec\u7684 Yum \u5df2\u7ecf\u53ef\u4ee5\u4f7f\u7528\u4e86\u3002\u6211\u4eec\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a cron \u4efb\u52a1\u6765\u6839\u636e\u4f60\u7684\u9700\u6c42\u6bcf\u5929\u6216\u6bcf\u5468\u5b9a\u65f6\u5730\u81ea\u52a8\u66f4\u65b0\u4ed3\u5e93\u6570\u636e\u3002<\/p>\n \u8981\u521b\u5efa\u4e00\u4e2a\u7528\u4e8e\u540c\u6b65\u4ed3\u5e93\u7684 cron \u4efb\u52a1\uff0c\u8bf7\u8fd0\u884c\uff1a<\/p>\n \u5e76\u6dfb\u52a0\u4ee5\u4e0b\u884c<\/p>\n \u8fd9\u4f1a\u5728\u6bcf\u665a 12:30 \u540c\u6b65 Yum\u3002\u8fd8\u8bf7\u8bb0\u4f4f\u5728 \/etc\/yum.repos.d<\/span> \u4e2d\u521b\u5efa\u4ed3\u5e93\u914d\u7f6e\u6587\u4ef6\uff0c\u5c31\u50cf\u6211\u4eec\u4e0a\u9762\u6240\u505a\u7684\u4e00\u6837\u3002<\/p>\n \u5c31\u662f\u8fd9\u6837\uff0c\u4f60\u73b0\u5728\u4f7f\u7528\u4f60\u81ea\u5df1\u7684 Yum \u4ed3\u5e93\u4e86\u3002<\/p>\n via: http:\/\/linuxtechlab.com\/creating-yum-repository-iso-online-repo\/<\/a><\/p>\n \u4f5c\u8005\uff1aShusain<\/a>[3]<\/span> \u8bd1\u8005\uff1ageekpi<\/a>[4]<\/span> \u6821\u5bf9\uff1awxy<\/a>[5]<\/span><\/p>\n \u672c\u6587\u7531 LCTT<\/a>[6]<\/span> \u539f\u521b\u7f16\u8bd1\uff0cLinux\u4e2d\u56fd<\/a>[7]<\/span> \u8363\u8a89\u63a8\u51fa<\/p>\n \u539f\u6587\u6765\u81ea\uff1ahttps:\/\/linux.cn\/article-9296-1.html<\/a><\/p>\n$ mkdir \/YUM\r\n<\/pre>\n
$ mount -t iso9660 -o loop \/home\/dan\/Centos-7-x86_x64-DVD.iso \/mnt\/iso\/\r\n<\/pre>\n
$ rpm -ivh deltarpm\r\n$ rpm -ivh python-deltarpm\r\n$ rpm -ivh createrepo\r\n<\/pre>\n
$ vi \/etc\/yum.repos.d\/local.repo\r\n<\/pre>\n
LOCAL REPO]\r\nName=Local YUM\r\nbaseurl=file:\/\/\/YUM\r\ngpgcheck=0\r\nenabled=1\r\n<\/pre>\n
$ createrepo -v \/YUM\r\n<\/pre>\n
$ yum clean all\r\n<\/pre>\n
$ yum repolist\r\n<\/pre>\n
$ rsync -avz rsync:\/\/mirror.fibergrid.in\/centos\/7.2\/os\/x86_64\/Packages\/s\/ \/YUM\r\n<\/pre>\n
$ createrepo - v \/YUM\r\n<\/pre>\n
$ crontab -e\r\n<\/pre>\n
30 12 * * * rsync -avz http:\/\/mirror.centos.org\/centos\/7\/os\/x86_64\/Packages\/ \/YUM\r\n<\/pre>\n
\n\n