{"id":194,"date":"2023-11-23T14:48:30","date_gmt":"2023-11-23T06:48:30","guid":{"rendered":"http:\/\/8.141.4.74\/?p=194"},"modified":"2024-03-29T14:33:27","modified_gmt":"2024-03-29T06:33:27","slug":"%e5%9c%a8centos%e4%b8%8a%e6%9e%84%e5%bb%ba%e4%bc%81%e4%b8%9a%e7%ba%a7%e5%86%85%e9%83%a8yum%e4%bb%93%e5%ba%93%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"http:\/\/8.141.4.74\/?p=194","title":{"rendered":"\u5728CentOS\u4e0a\u6784\u5efa\u4f01\u4e1a\u7ea7\u5185\u90e8YUM\u4ed3\u5e93\u670d\u52a1\u5668"},"content":{"rendered":"<h1>\u5728CentOS\u4e0a\u6784\u5efa\u4f01\u4e1a\u7ea7\u5185\u90e8YUM\u4ed3\u5e93\u670d\u52a1\u5668<\/h1>\n<blockquote>\n<p>\u642d\u5efa\u539f\u7406\uff1a\u672c\u6b21\u642d\u5efa\u516c\u53f8\u5185\u90e8yum\u6e90\u670d\u52a1\u5668\u9700\u8981\u4f7f\u7528\u6302\u8f7d\u7684\u5149\u9a71\u6765\u8fdb\u884c\u642d\u5efa\uff0c\u5e76\u4e14\u8fd9\u91cc\u4f7f\u7528\u7684autofs\u81ea\u52a8\u6302\u8f7d\u3002<\/p>\n<\/blockquote>\n<h2>1.autofs\u81ea\u52a8\u6302\u8f7d\u5149\u9a71<\/h2>\n<pre><code class=\"language-shell\">[root@centos8 ~]#rpm -q autofs || yum -y install autofs\n\n[root@CentOS8 ~]# systemctl enable --now autofs\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/autofs.service \u2192 \/usr\/lib\/systemd\/system\/autofs.service.\n\n[root@CentOS8 ~]# systemctl status autofs\n\n[root@CentOS8 ~]# ls \/misc\/ \n#\u53d1\u73b0\/misc\u4e0b\u9762\u662f\u6ca1\u6709\u4e1c\u897f\u7684\uff0c\u5f53\u6211\u4eeccd\u6216\u8005ls \/misc\/cd\u7684\u65f6\u5019\uff0c\u5c31\u4f1a\u81ea\u52a8\u6302\u8f7d\u5149\u9a71\uff0c\u770b\u5230\u4e0b\u9762\u7684\u6587\u4ef6\u3002\n[root@CentOS8 ~]# ls \/misc\/cd\nCentOS_BuildTag  EFI  EULA  GPL  images  isolinux  LiveOS  Packages  repodata  RPM-GPG-KEY-CentOS-7  RPM-GPG-KEY-CentOS-Testing-7  TRANS.TBL\n[root@CentOS8 ~]# lsblk\nNAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT\nsda      8:0    0  200G  0 disk\n\u251c\u2500sda1   8:1    0  100G  0 part \/\n\u251c\u2500sda2   8:2    0   50G  0 part \/data\n\u251c\u2500sda3   8:3    0    2G  0 part [SWAP]\n\u251c\u2500sda4   8:4    0    1K  0 part\n\u2514\u2500sda5   8:5    0    1G  0 part \/boot\nsdb      8:16   0   20G  0 disk\nsr0     11:0    1  9.5G  0 rom  \/misc\/cd\nsr1     11:1    1 1024M  0 rom\n#\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0csr0\u662f\u6302\u8f7d\u5230\u4e86\/misc\/cd\u4e0b\u7684\n\n#\u5982\u679c\u5f53\u6211\u4eec\u6267\u884ccd \/misc\/cd \u6216\u8005 ls \/misc\/cd \u63d0\u793a&quot;not found&quot;\u672a\u627e\u5230\u7684\u65f6\u5019\uff0c\u8fd9\u4e2a\u65f6\u5019\u4e0d\u8981\u7740\u6025\uff0c\u5173\u673a\u91cd\u542f\u5c31\u4f1a\u6709\u4e86\uff0c\u5982\u679c\u8fd8\u662f\u6ca1\u6709\u591a\u91cd\u542f\u51e0\u6b21\n<\/code><\/pre>\n<h2>2.\u4f7f\u7528autofs\u6302\u8f7dCentOS7\u5149\u9a71<\/h2>\n<blockquote>\n<p>\u56e0\u4e3a\u642d\u5efa\u672c\u5730yum\u670d\u52a1\u5668\u7684\u8bdd\uff0c\u9700\u8981\u642d\u5efarpm\u5305(Packages)\u548c\u539f\u6570\u636e(repodata)\uff0c\u540c\u65f6\u9700\u8981CentOS8\u548cCentOS7\u4e24\u4e2a\u5404\u81ea\u7684\u4ed3\u5e93\uff0cBaseOS\uff0cAPPSteam<\/p>\n<p>\u6b65\u9aa4\uff1a<\/p>\n<p>\u5728VMware Workstation pro 17\u4e2d\uff0c\u5bf9yum\u670d\u52a1\u5668\u53f3\u952e\u70b9\u51fb\u3010\u8bbe\u7f6e\u3011-\u3010\u6dfb\u52a0\u3011-\u3010CD\/DVD\u9a71\u52a8\u5668\u3011-\u3010\u5b8c\u6210\u3011-\u9009\u62e9\u5bf9\u5e94\u7684ISO\u955c\u50cf\u6587\u4ef6\uff0c\u5982\u679c\u4f60\u8fd9\u53f0\u662fCentOS8\u7684\uff0c\u90a3\u4e48\u6dfb\u52a0\u7684\u8fd9\u4e2a\u5c31\u9009\u62e9CentOS7\uff0c\u53cd\u4e4b<\/p>\n<p>\u9009\u62e9\u5b8c\u6210\u540e\u4e00\u5b9a\u8981\u70b9\u51fb\u3010\u786e\u5b9a\u3011<\/p>\n<\/blockquote>\n<pre><code class=\"language-bash\">#\u6b64\u65f6\uff0c\u6dfb\u52a0\u9a71\u52a8\u4ee5\u540e\uff0c\u7cfb\u7edf\u5e76\u4e0d\u4f1a\u8bc6\u522b\n[root@centos8 ~]#lsblk\nNAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT\nsda      8:0    0  200G  0 disk\n\u251c\u2500sda1   8:1    0  100G  0 part \/\n\u251c\u2500sda2   8:2    0   50G  0 part \/data\n\u251c\u2500sda3   8:3    0    2G  0 part [SWAP]\n\u251c\u2500sda4   8:4    0    1K  0 part\n\u2514\u2500sda5   8:5    0    1G  0 part \/boot\nsdb      8:16   0   20G  0 disk\nsdc      8:32   0   10G  0 disk\nsr0     11:0    1 10.1G  0 rom\n\n#\u7b2c\u4e00\u5757\u5149\u9a71\u5c31\u662fsr0\uff0c\u7b2c\u4e8c\u5757\u5c31\u662fsr1\uff0c\u4ee5\u6b64\u7c7b\u63a8\u3002\u53ef\u4ee5\u770b\u5230\u53ea\u6709\u4e00\u5757\u5149\u9a71\n\n#\u626b\u63cf\u5e76\u8bc6\u522b\u5149\u9a71(\u4ee5\u4e0b\u4e09\u6761\u547d\u4ee4\u53ea\u9002\u7528\u4e8escsi\u786c\u76d8\uff0c\u4e0d\u9002\u7528\u4e0eNvme\u786c\u76d8)\n[root@CentOS8 ~]# echo &#039;- - -&#039; \/sys\/class\/scsi_host\/host0\n[root@CentOS8 ~]# echo &#039;- - -&#039; \/sys\/class\/scsi_host\/host1\n[root@CentOS8 ~]# echo &#039;- - -&#039; \/sys\/class\/scsi_host\/host1\n\n#\u518d\u6b21\u67e5\u770b\u5149\u9a71\u662f\u5426\u8bc6\u522b\n[root@centos8 ~]#lsblk\nNAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT\nsda      8:0    0  200G  0 disk\n\u251c\u2500sda1   8:1    0  100G  0 part \/\n\u251c\u2500sda2   8:2    0   50G  0 part \/data\n\u251c\u2500sda3   8:3    0    2G  0 part [SWAP]\n\u251c\u2500sda4   8:4    0    1K  0 part\n\u2514\u2500sda5   8:5    0    1G  0 part \/boot\nsdb      8:16   0   20G  0 disk\nsdc      8:32   0   10G  0 disk\nsr0     11:0    1 10.1G  0 rom\nsr1     11:1    1  9.5G  0 rom #sr1\u5149\u9a71\u5c31\u662f\u6211\u4eec\u65b0\u6dfb\u52a0\n<\/code><\/pre>\n<h2>3.\u901a\u8fc7http\u5171\u4eab\u4ed3\u5e93<\/h2>\n<pre><code class=\"language-bash\">#\u5b89\u88c5httpd\n[root@CentOS8 ~]# yum -y install httpd\n\n#\u81ea\u542f\u52a8http\n[root@CentOS8 ~]# systemctl enable --now httpd\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/httpd.service \u2192 \/usr\/lib\/systemd\/system\/httpd.service.\n[root@CentOS8 ~]# systemctl status httpd\n\u25cf httpd.service - The Apache HTTP Server\n   Loaded: loaded (\/usr\/lib\/systemd\/system\/httpd.service; enabled; vendor preset: disabled)\n   Active: active (running) since Sat 2023-02-11 22:21:52 CST; 2s ago #\u72b6\u6001\u662f\u6b63\u5e38\u7684 active\n     Docs: man:httpd.service(8)\n Main PID: 2416 (httpd)\n   Status: &quot;Started, listening on: port 80&quot;\n    Tasks: 213 (limit: 5802)\n   Memory: 25.0M\n   CGroup: \/system.slice\/httpd.service\n           \u251c\u25002416 \/usr\/sbin\/httpd -DFOREGROUND\n           \u251c\u25002417 \/usr\/sbin\/httpd -DFOREGROUND\n           \u251c\u25002418 \/usr\/sbin\/httpd -DFOREGROUND\n           \u251c\u25002419 \/usr\/sbin\/httpd -DFOREGROUND\n           \u2514\u25002420 \/usr\/sbin\/httpd -DFOREGROUND\n\n2\u6708 11 22:21:48 CentOS8.5 systemd[1]: Starting The Apache HTTP Server...\n2\u6708 11 22:21:52 CentOS8.5 systemd[1]: Started The Apache HTTP Server.\n2\u6708 11 22:21:55 CentOS8.5 httpd[2416]: Server configured, listening on: port 80\n[root@CentOS8 ~]#\n\n#\u521d\u59cb\u5316\u5de5\u4f5c(\u5982\u679c\u4e0d\u505a\u7684\u8bdd\uff0chttp\u670d\u52a1\u65e0\u6cd5\u4f7f\u7528)\n#\u5173\u95ed\u9632\u706b\u5899\n[root@CentOS8 ~]# systemctl disable --now firewalld\n#\u5173\u95edSElinux\n[root@CentOS8 ~]# sed -ri &#039;s\/(SELINUX=)disabled\/\\1disabled\/&#039; \/etc\/selinux\/config\n\n#\u8fdb\u5165\u5b58\u653e\u7f51\u9875\u7684\u6587\u4ef6\u5939\n[root@CentOS8 ~]# cd \/var\/www\/html\/\n#\u521b\u5efaCentos7\u548c8\u7684\u7f51\u9875\u6587\u4ef6\u5939\n[root@CentOS8 html]# mkdir -pv centos\/{7,8}\n#\u6211\u4eec\u4eff\u7167\u955c\u50cf\u7f51\u7ad9\u7684\u8def\u5f84\uff0c\u4f8b\u5982\uff1a\n#centos7\uff1ahttps:\/\/mirrors.cloud.tencent.com\/centos\/7\/os\/x86_64\/ \u8fd9\u4e2a\u8def\u5f84\u4e0b\u9762\u76f4\u63a5\u662fPackages\u548crepodata\uff0c\u56e0\u4e3acentos7\u53ea\u8981\u4e00\u4e2a\u4ed3\u5e93\n#centos8\uff1ahttps:\/\/mirrors.cloud.tencent.com\/centos\/8\/ \u8fd9\u4e24\u4e2a\u8def\u5f84\u7684\u4e0b\u9762\u5c31\u662f\u955c\u50cf\u4ed3\u5e93\u7684\u7684\u5730\u5740 centos8\u4e0b\u9762\u6709BaseOS\u548cAPPStream\u4e24\u4e2a\u4ed3\u5e93\uff0c\u4ed3\u5e93\u4e0b\u9762\u624d\u662fPackages\u548crepodata\n\n#\u4f9d\u6b21\u521b\u5efa\u6240\u9700\u6587\u4ef6\u5939\n[root@CentOS8 html]# mkdir -pv centos\/7\/os\/x86_64\n\n#sr0\u5c31\u662f\u672c\u7cfb\u7edf\u6240\u4f7f\u7528\u7684\u7684\u5149\u9a71\uff0csr1\u662f\u540e\u6765\u6dfb\u52a0\u7684\uff0c\u4f8b\u5982\uff1b\u5982\u679c\u7cfb\u7edf\u662fCentos8\u7684\u8bdd\uff0c\u90a3\u4e48sr0\u5c31\u662fcentos8\u5bf9\u5e94\u7684\u5149\u9a71\uff1b\u90a3\u4e48\u540e\u6765\u6dfb\u52a0centos7\u7684\u5149\u9a71\uff0c\u5c31\u662fsr1\n#\u5c06sr0\u6302\u8f7d\u5230\/var\/www\/html\/centos\/8 \u4e0b\u9762\n[root@CentOS8 html]# mount \/dev\/sr0 \/var\/www\/html\/centos\/8\nmount: \/var\/www\/html\/centos\/8: WARNING: device write-protected, mounted read-only.\n#\u5c06sr1\u6302\u8f7d\u5230\/var\/www\/html\/centos\/7\/os\/x86_64 \u4e0b\u9762\n[root@CentOS8 html]# mount \/dev\/sr1 \/var\/www\/html\/centos\/7\/os\/x86_64\/\n\n#\u8fd9\u79cd\u6302\u8f7d\u7684\u65b9\u5f0f\u53ea\u662f\u4e34\u65f6\u751f\u6548\uff0c\u5f53\u6211\u4eec\u91cd\u542f\u4ee5\u540e\u8fd9\u4e2a\u914d\u7f6e\u5c31\u5931\u6548\u4e86\n#\u6c38\u4e45\u6302\u8f7d\n\n[root@CentOS8 ~]# blkid\n\/dev\/sda1: UUID=&quot;faa1dbe8-f9e3-4eb0-a6f9-b01cd799353f&quot; BLOCK_SIZE=&quot;4096&quot; TYPE=&quot;ext4&quot; PARTUUID=&quot;04271186-01&quot;\n\/dev\/sda2: UUID=&quot;af876911-3be3-4add-95f7-44515a40d6cf&quot; BLOCK_SIZE=&quot;512&quot; TYPE=&quot;xfs&quot; PARTUUID=&quot;04271186-02&quot;\n\/dev\/sda3: UUID=&quot;1f4848ac-39e5-4eb7-b286-ea566518c104&quot; TYPE=&quot;swap&quot; PARTUUID=&quot;04271186-03&quot;\n\/dev\/sda5: UUID=&quot;2e4557b2-c49a-4a4f-ab97-117ae58c29b7&quot; BLOCK_SIZE=&quot;512&quot; TYPE=&quot;xfs&quot; PARTUUID=&quot;04271186-05&quot;\n\/dev\/sr0: BLOCK_SIZE=&quot;2048&quot; UUID=&quot;2021-11-13-01-04-26-00&quot; LABEL=&quot;CentOS-8-5-2111-x86_64-dvd&quot; TYPE=&quot;iso9660&quot; PTUUID=&quot;5fb10f71&quot; PTTYPE=&quot;dos&quot;\n\/dev\/sr1: BLOCK_SIZE=&quot;2048&quot; UUID=&quot;2020-11-02-15-15-23-00&quot; LABEL=&quot;CentOS 7 x86_64&quot; TYPE=&quot;iso9660&quot; PTUUID=&quot;6b8b4567&quot; PTTYPE=&quot;dos&quot;\n#\u4e0a\u9762\u662f\u6bcf\u4e2a\u78c1\u76d8\u4ee5\u53ca\u5206\u533a\u7684UUID\u548c\u7c7b\u578b\n\n#\u5728\u914d\u7f6e\u6587\u4ef6\u7684\u672b\u5c3e\u6dfb\u52a0\u8fd9\u4e24\u884c,UUID\u5bf9\u5e94\u7684\u5c31\u662f\u8981\u6dfb\u52a0\u7684\u9a71\u52a8\uff0c\u8fd9\u91cc\u5199\/dev\/sr0\u8fd9\u79cd\u65b9\u5f0f\u4e5f\u662f\u53ef\u4ee5\u7684\uff0c\u540e\u9762\u7684\/var\/www\/html\u5bf9\u5e94\u7684\u662f\u6302\u8f7d\u7684\u76ee\u5f55\uff0ciso9660\u5c31\u662f\u4e0a\u9762\u7684type\uff0c\u540e\u9762\u9ed8\u8ba4\u662fdefaults 0 0\n[root@CentOS8 ~]# vi \/etc\/fstab\nUUID=2021-11-13-01-04-26-00 \/var\/www\/html\/centos\/8                iso9660       defaults 0 0\nUUID=2020-11-02-15-15-23-00 \/var\/www\/html\/centos\/7\/os\/x86_64\/     iso9660       defaults 0 0\n\n#\u6302\u8f7d\n[root@CentOS8 ~]# mount -a\nmount: \/var\/www\/html\/centos\/8: WARNING: device write-protected, mounted read-only.\nmount: \/var\/www\/html\/centos\/7\/os\/x86_64: WARNING: device write-protected, mounted read-only.\n[root@CentOS8 ~]# lsblk\nNAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT\nsda      8:0    0  200G  0 disk\n\u251c\u2500sda1   8:1    0    1G  0 part \/boot\n\u251c\u2500sda2   8:2    0  100G  0 part \/\n\u251c\u2500sda3   8:3    0    2G  0 part [SWAP]\n\u251c\u2500sda4   8:4    0    1K  0 part\n\u2514\u2500sda5   8:5    0   50G  0 part \/data\nsr0     11:0    1 10.1G  0 rom  \/var\/www\/html\/centos\/8\nsr1     11:1    1  9.5G  0 rom  \/var\/www\/html\/centos\/7\/os\/x86_64\n\n#\u67e5\u770b\u662f\u5426\u6302\u8f7d\u6210\u529f\n[root@CentOS8 html]# tree -d\n.\n\u2514\u2500\u2500 centos\n    \u251c\u2500\u2500 7\n    \u2502\u00a0\u00a0 \u2514\u2500\u2500 os\n    \u2502\u00a0\u00a0     \u2514\u2500\u2500 x86_64\n    \u2502\u00a0\u00a0         \u251c\u2500\u2500 EFI\n    \u2502\u00a0\u00a0         \u2502\u00a0\u00a0 \u2514\u2500\u2500 BOOT\n    \u2502\u00a0\u00a0         \u2502\u00a0\u00a0     \u2514\u2500\u2500 fonts\n    \u2502\u00a0\u00a0         \u251c\u2500\u2500 images\n    \u2502\u00a0\u00a0         \u2502\u00a0\u00a0 \u2514\u2500\u2500 pxeboot\n    \u2502\u00a0\u00a0         \u251c\u2500\u2500 isolinux\n    \u2502\u00a0\u00a0         \u251c\u2500\u2500 LiveOS\n    \u2502\u00a0\u00a0         \u251c\u2500\u2500 Packages\n    \u2502\u00a0\u00a0         \u2514\u2500\u2500 repodata\n    \u2514\u2500\u2500 8\n        \u251c\u2500\u2500 AppStream\n        \u2502\u00a0\u00a0 \u251c\u2500\u2500 Packages\n        \u2502\u00a0\u00a0 \u2514\u2500\u2500 repodata\n        \u251c\u2500\u2500 BaseOS\n        \u2502\u00a0\u00a0 \u251c\u2500\u2500 Packages\n        \u2502\u00a0\u00a0 \u2514\u2500\u2500 repodata\n        \u251c\u2500\u2500 EFI\n        \u2502\u00a0\u00a0 \u2514\u2500\u2500 BOOT\n        \u2502\u00a0\u00a0     \u2514\u2500\u2500 fonts\n        \u251c\u2500\u2500 images\n        \u2502\u00a0\u00a0 \u2514\u2500\u2500 pxeboot\n        \u2514\u2500\u2500 isolinux\n\n26 directories\n[root@CentOS8 html]#\n[root@CentOS8 html]# lsblk\nNAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT\nsr0          11:0    1 10.1G  0 rom  \/var\/www\/html\/centos\/8     #centos8\u6302\u8f7d\nsr1          11:1    1  9.5G  0 rom  \/var\/www\/html\/centos\/7\/os\/x86_64   #centos7\u6302\u8f7d\nnvme0n1     259:0    0  200G  0 disk\n\u251c\u2500nvme0n1p1 259:1    0    1G  0 part \/boot\n\u251c\u2500nvme0n1p2 259:2    0  100G  0 part \/\n\u251c\u2500nvme0n1p3 259:3    0    2G  0 part [SWAP]\n\u251c\u2500nvme0n1p4 259:4    0    1K  0 part\n\u251c\u2500nvme0n1p5 259:5    0    1G  0 part \/home\n\u2514\u2500nvme0n1p6 259:6    0   50G  0 part \/data\n[root@CentOS8 html]#\n<\/code><\/pre>\n<h2>4.\u8bbf\u95ee<\/h2>\n<p>web\u5730\u5740\uff1a<a href=\"http:\/\/10.0.0.109\/centos\">http:\/\/10.0.0.109\/centos<\/a><\/p>\n<h2>5.\u7ed9\u5176\u4ed6\u670d\u52a1\u5668\u914d\u7f6e\u642d\u5efa\u597d\u7684yum\u4ed3\u5e93<\/h2>\n<pre><code class=\"language-bash\">#\u7ed9\u5176\u4ed6centos8\u670d\u52a1\u5668\u914d\u7f6eyum\u4ed3\u5e93\n[root@centos8 html]#vim \/etc\/yum.repos.d\/base.repo\n[BaseOs]\nname=BaseOS\nbaseurl=http:\/\/10.0.0.109\/centos\/8\/BaseOS\/\n#baseurl=http:\/\/10.0.0.109\/centos\/$releasever\/BaseOS\/\ngpgcheck=0\n\n[AppStream]\nname=AppStream\nbaseurl=http:\/\/10.0.0.109\/centos\/8\/AppStream\/\n#\u6216\u8005baseurl=http:\/\/10.0.0.109\/centos\/$releasever\/AppStream\/\ngpgcheck=0\n\n[extras]\nname=extras\nbaseurl=https:\/\/mirrors.aliyun.com\/centos\/$releasever\/extras\/$basearch\/os\n        https:\/\/mirrors.cloud.tencent.com\/centos\/$releasever\/extras\/$basearch\/os\/\n        https:\/\/mirrors.tuna.tsinghua.edu.cn\/centos\/$releasever\/extras\/$basearch\/os\/\ngpgcheck=0\nenabled=1\n\n[epel]\nname=epel\nbaseurl=https:\/\/mirrors.aliyun.com\/epel\/$releasever\/Everything\/$basearch\/\n        https:\/\/mirrors.cloud.tencent.com\/epel\/$releasever\/Everything\/$basearch\/\n        https:\/\/mirrors.tuna.tsinghua.edu.cn\/epel\/$releasever\/Everything\/$basearch\/\ngpgcheck=0\nenabled=1\n\n#\u67e5\u770b\u662f\u5426\u6210\u529f\n[root@centos8 html]#yum repolist\nrepo id                                                                                                  repo name\nAppStream                                                                                                AppStream\nBaseOs                                                                                                   BaseOS\nepel                                                                                                     epel\nextras                                                                                                   extras\n\n#\u6d4b\u8bd5<\/code><\/pre>\n<h2>6.\u53ea\u6709RPM\u5305\uff0c\u6ca1\u6709\u5143\u6570\u636e\u7684\u60c5\u51b5<\/h2>\n<blockquote>\n<p>\u610f\u601d\u5c31\u662f\u6ca1\u6709repodata\u7684\u65f6\u5019\u8be5\u5982\u4f55\u505a\uff1f<\/p>\n<\/blockquote>\n<pre><code class=\"language-bash\">#\u6a21\u62df\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u81ea\u5df1\u5236\u4f5c\u7684rpm\u5305\n[root@CentOS8 testrepo]# cp \/misc\/cd\/BaseOS\/Packages\/adcli-0.8.2-12.el8.x86_64.rpm \/data\/testrepo\/\n[root@CentOS8 testrepo]# cp \/misc\/cd\/BaseOS\/Packages\/at-3.1.20-11.el8.x86_64.rpm \/data\/testrepo\/\n[root@CentOS8 testrepo]# pwd\n\/data\/testrepo\n[root@CentOS8 testrepo]# pwd\n\/data\/testrepo\n[root@CentOS8 testrepo]# ls\nadcli-0.8.2-12.el8.x86_64.rpm  at-3.1.20-11.el8.x86_64.rpm\n[root@CentOS8 testrepo]#\n\n#\u73b0\u5728\u6a21\u62df\u53ea\u6709rpm\uff0c\u5374\u6ca1\u6709\u5143\u6570\u636e(repodata)\n#\u8fd9\u79cd\u60c5\u51b5\u53ea\u9700\u8981\u521b\u5efa\u5143\u6570\u636e\u5373\u53ef\n[root@CentOS8 testrepo]# yum -y install createrepo\n[root@CentOS8 testrepo]# createrepo .\nDirectory walk started\nDirectory walk done - 2 packages\nTemporary output repo path: .\/.repodata\/\nPreparing sqlite DBs\nPool started (with 5 workers)\nPool finished\n[root@CentOS8 testrepo]#\n\n[root@CentOS8 testrepo]# ls\nadcli-0.8.2-12.el8.x86_64.rpm  at-3.1.20-11.el8.x86_64.rpm  repodata #\u591a\u51fa\u6765\u7684\u6587\u4ef6\u5939\u5c31\u662f\u5143\u6570\u636e\n[root@CentOS8 testrepo]#<\/code><\/pre>\n<h2>7.\u914d\u7f6e\u672c\u5730epel\u6e90<\/h2>\n<blockquote>\n<p>\u5c06\u955c\u50cf\u7f51\u7ad9\u4e0a\u7684epel\u5305\u4e0b\u8f7d\u5230\u6211\u4eec\u5b58\u653e\u7f51\u5740\u7684\u6587\u4ef6\u5939\u91cc(\/var\/www\/html)<\/p>\n<\/blockquote>\n<pre><code class=\"language-sh\">#yum\u6240\u5728\u670d\u52a1\u5668\u7684\u914d\u7f6e\n[root@CentOS8 yum.repos.d]# vim \/etc\/yum.repos.d\/BaseOS.repo\n[BaseOs]\nname=BaseOS\nbaseurl=http:\/\/10.0.0.109\/centos\/$releasever\/BaseOS\/\ngpgcheck=0\n\n[AppStream]\nname=AppStream\nbaseurl=http:\/\/10.0.0.109\/centos\/$releasever\/AppStream\/\ngpgcheck=0\n\n[extras]\nname=extras\nbaseurl=https:\/\/mirrors.tuna.tsinghua.edu.cn\/centos\/$releasever\/extras\/$basearch\/os\/\n        https:\/\/mirrors.aliyun.com\/centos\/$releasever\/extras\/$basearch\/os\n        https:\/\/mirrors.cloud.tencent.com\/centos\/$releasever\/extras\/$basearch\/os\/\ngpgcheck=0\nenabled=1\n\n[epel]\nname=epel\nbaseurl=https:\/\/mirrors.tuna.tsinghua.edu.cn\/centos\/$releasever\/extras\/$basearch\/os\/\n        https:\/\/mirrors.aliyun.com\/epel\/$releasever\/Everything\/$basearch\/\n        https:\/\/mirrors.cloud.tencent.com\/epel\/$releasever\/Everything\/$basearch\/\ngpgcheck=0\nenabled=1\n\n[root@CentOS8 yum.repos.d]# yum repolist\n\u4ed3\u5e93 id                                                                                                                       \u4ed3\u5e93\u540d\u79f0\nAppStream                                                                                                                     AppStream\nBaseOs                                                                                                                        BaseOS\nepel                                                                                                                          epel\nextras                                                                                                                        extras\n\n#CentOS8\u4e0b\u8f7d\u76f8\u5173\u4ed3\u5e93\u5305\u548c\u5143\u6570\u636e\n[root@CentOS8 ~]# dnf reposync --repoid=epel --download-metadata -p \/var\/www\/html\n#--download-metadata \u52a0\u6b64\u9009\u9879\u53ef\u4ee5\u4e0b\u8f7d\u5143\u6570\u636e\n[root@CentOS8 ~]# cd \/var\/www\/html\/\n[root@CentOS8 html]# ls\ncentos  epel\n[root@CentOS8 html]\n\n#\u7528\u540c\u6837\u7684\u65b9\u6cd5\uff0c\u5c06CentOS7\u7684epel\u4e5f\u4e0b\u8f7d\u5230epel\u4e0b\u9762\uff0c\u56e0\u4e3a\u4e0a\u9762\u4f7f\u7528\u7684epel\u6e90\u4e2d\u7684$releasever\u4f1a\u81ea\u52a8\u83b7\u53d6\u4e3a8\uff0c$basearch\u4f1a\u81ea\u52a8\u83b7\u53d6\u4e3ax86_64,\u6240\u4ee5\u53ea\u9700\u8981\u4fee\u6539\u91cc\u9762$releasever\u6539\u62107\u4f1a\u518d\u4e0b\u8f7d\u4e00\u6b21\u5373\u53ef\n[root@CentOS8 html]# dnf reposync --repoid=epel --download-metadata -p \/var\/www\/html\/epel\/7\/x86_64\n\n\u4e4b\u540e\u5c06\u8fd9\u4e9b\u5305mv\u5230\u5176\u4ed6\u5730\u65b9\uff0c\u505a\u6210\u81ea\u5df1\u9700\u8981\u7684\u8def\u5f84\uff0c\u4e0b\u9762\u662f\u6211\u81ea\u5df1\u7684\u8def\u5f84\uff1a\nCentOS 8 epel:http:\/\/10.0.0.109\/epel\/8\/Everything\/x86_64\/\nCentOS 7 epel:http:\/\/10.0.0.109\/epel\/7\/x86_64\/\nCentOS 8 BaseOS:http:\/\/10.0.0.109\/centos\/8\/BaseOS\/\nCentOS 8 AppStream:http:\/\/10.0.0.109\/centos\/8\/AppStream\/\nCentOS 7:http:\/\/10.0.0.109\/centos\/7\/os\/x86_64\/\n\n#\u8bbf\u95ee\u7f51\u5740\nhttp:\/\/10.0.0.109\/epel\/\nhttp:\/\/10.0.0.109\/centos\/\n#\u76f4\u63a5\u8bbf\u95eehttp:\/\/10.0.0.109\u662f\u6ca1\u6709\u7684<\/code><\/pre>\n<h2>8.\u7ed9\u5176\u4ed6\u670d\u52a1\u5668\u914d\u7f6eyum\u6e90<\/h2>\n<h3>CentOS 7<\/h3>\n<pre><code class=\"language-sh\">[base]\nname=BaseOS\nbaseurl=http:\/\/10.0.0.109\/centos\/$releasever\/os\/$basearch\/\ngpgcheck=0\n\n[extras]\nname=extras\nbaseurl=https:\/\/mirrors.tuna.tsinghua.edu.cn\/centos\/$releasever\/extras\/$basearch\/\n        https:\/\/mirrors.aliyun.com\/centos\/$releasever\/extras\/$basearch\/\n        https:\/\/mirrors.cloud.tencent.com\/centos\/$releasever\/extras\/$basearch\/\ngpgcheck=0\nenabled=1\n\n[epel]\nname=epel\nbaseurl=http:\/\/10.0.0.109\/epel\/$releasever\/$basearch\/\ngpgcheck=1\ngpgkey=https:\/\/mirrors.tuna.tsinghua.edu.cn\/epel\/RPM-GPG-KEY-EPEL-7\n<\/code><\/pre>\n<h3>CenOS 8<\/h3>\n<pre><code class=\"language-sh\">[BaseOs]\nname=BaseOS\nbaseurl=http:\/\/10.0.0.109\/centos\/$releasever\/BaseOS\/\ngpgcheck=0\n\n[AppStream]\nname=AppStream\nbaseurl=http:\/\/10.0.0.109\/centos\/$releasever\/AppStream\/\ngpgcheck=0\n\n[extras]\nname=extras\nbaseurl=https:\/\/mirrors.tuna.tsinghua.edu.cn\/centos\/$releasever\/extras\/$basearch\/os\/\n        https:\/\/mirrors.aliyun.com\/centos\/$releasever\/extras\/$basearch\/os\n        https:\/\/mirrors.cloud.tencent.com\/centos\/$releasever\/extras\/$basearch\/os\/\ngpgcheck=0\nenabled=1\n\n[epel]\nname=epel\nbaseurl=http:\/\/10.0.0.109\/epel\/$releasever\/Everything\/$basearch\/\ngpgcheck=0\nenabled=1<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728CentOS\u4e0a\u6784\u5efa\u4f01\u4e1a\u7ea7\u5185\u90e8YUM\u4ed3\u5e93\u670d\u52a1\u5668 \u642d\u5efa\u539f\u7406\uff1a\u672c\u6b21\u642d\u5efa\u516c\u53f8\u5185\u90e8yum\u6e90\u670d\u52a1\u5668\u9700\u8981\u4f7f\u7528\u6302\u8f7d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[19],"views":201,"_links":{"self":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts\/194"}],"collection":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=194"}],"version-history":[{"count":1,"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts\/194\/revisions"}],"predecessor-version":[{"id":195,"href":"http:\/\/8.141.4.74\/index.php?rest_route=\/wp\/v2\/posts\/194\/revisions\/195"}],"wp:attachment":[{"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=194"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/8.141.4.74\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}