序文:
同社のビジネスのほとんどはイントラネット環境で実行されているため、イントラネット環境ではソフトウェアのインストール、アップグレード、更新に yum を直接使用することができないため、現在の日常業務のニーズを満たすために自己構築の Yum ソースを構築する必要があります。
Yum ソース全体のすべてのインストール パッケージをローカルの指定されたディレクトリにダウンロードします。
1. ローカル Yum ソース (Alibaba ソース、清華ソース) にダウンロードする準備をします。
2. Yum ソースのステータスを確認する
[root@centos ~]# yum repolist
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
仓库标识 仓库名称 状态
extras Qcloud centos extras - x86_64 47
os Qcloud centos os - x86_64 6,713
updates Qcloud centos updates - x86_64 1,169
repolist: 7,929
私たちが準備した Yum ソースには 3 つのウェアハウスがあり、合計 7929 のインストール パッケージがあることがわかります。
3. Yum ソース全体のすべてのインストール パッケージをローカル サーバーにダウンロードします。
reposync:
このコマンドは非常に強力で、リモート Yum ウェアハウス内のすべてのインストール パッケージをローカル ディレクトリにダウンロードできます。该命令是来自于 yum-utils 软件包里面的。
共通パラメータの説明:
-r: ローカルに設定された yum ウェアハウスのリポジトリ ソースの名前を指定します。
-p: ダウンロード パスを指定します。
[root@centos ~]# yum -y install yum-utils #执行安装软件包
[root@centos ~]# mkdir centos6 #创建本地Yum包存放目录
[root@centos ~]# yum repolist #查看Yum源的仓库标识名称
Loading mirror speeds from cached hostfile
仓库标识 仓库名称 状态
extras Qcloud centos extras - x86_64 47
os Qcloud centos os - x86_64 6,713
updates Qcloud centos updates - x86_64 1,169
repolist: 7,929
[root@centos ~]# reposync -r extras -p /root/centos6/ #根据每个据仓库标识下载安装包到本地目录
[extras: 1 of 47 ] Downloading Packages/bakefile-0.2.8-3.el6.centos.x86_64.rpm
bakefile-0.2.8-3.el6.centos.x86_64.rpm | 250 kB 00:00
[extras: 2 of 47 ] Downloading Packages/centos-release-azure-1.0-2.el6.centos.noarch.rpm
centos-release-azure-1.0-2.el6.centos.noarch.rpm | 4.0 kB 00:00
[extras: 3 of 47 ] Downloading Packages/centos-release-cr-6-0.el6.centos.x86_64.rpm
centos-release-cr-6-0.el6.centos.x86_64.rpm
...
...
[root@centos ~]# reposync -r os -p /root/centos6/
[os: 1 of 6713 ] Downloading Packages/389-ds-base-1.2.11.15-95.el6_9.x86_64.rpm
389-ds-base-1.2.11.15-95.el6_9.x86_64.rpm | 1.5 MB 00:00
[os: 2 of 6713 ] Downloading Packages/389-ds-base-devel-1.2.11.15-95.el6_9.i686.rpm
389-ds-base-devel-1.2.11.15-95.el6_9.i686.rpm | 149 kB 00:00
[os: 3 of 6713 ] Downloading Packages/389-ds-base-devel-1.2.11.15-95.el6_9.x86_64.rpm
389-ds-base-devel-1.2.11.15-95.el6_9.x86_64.rpm
...
...
[root@centos ~]# reposync -r updates -p /root/centos6/
4. ローカルにダウンロードされた Yum ソース全体のインストール パッケージを表示します。
[root@centos ~]# ll centos6/
drwxr-xr-x 3 root root 4096 10月 31 14:28 extras
drwxr-xr-x 3 root root 4096 10月 31 14:28 os
drwxr-xr-x 3 root root 4096 10月 31 13:14 updates
[root@centos ~]# ll centos6/extras/
drwxr-xr-x 2 root root 4096 10月 31 14:28 Packages
[root@centos ~]# ll centos6/extras/Packages/
-rw-r--r-- 1 root root 256356 10月 31 14:28 bakefile-0.2.8-3.el6.centos.x86_64.rpm
-rw-r--r-- 1 root root 4096 10月 31 14:28 centos-release-azure-1.0-2.el6.centos.noarch.rpm
-rw-r--r-- 1 root root 3996 10月 31 14:28 centos-release-cr-6-0.el6.centos.x86_64.rpm
-rw-r--r-- 1 root root 4316 10月 31 14:28 centos-release-gluster312-1.0-1.el6.centos.noarch.rpm
-rw-r--r-- 1 root root 5116 10月 31 14:28 centos-release-gluster41-1.0-1.el6.centos.x86_64.rpm
-rw-r--r-- 1 root root 4316 10月 31 14:28 centos-release-gluster5-1.0-1.el6.centos.noarch.rpm
-rw-r--r-- 1 root root 4268 10月 31 14:28 centos-release-gluster6-1.0-1.el6.centos.noarch.rpm
-rw-r--r-- 1 root root 4160 10月 31 14:28 centos-release-gluster7-1.0-1.el6.centos.noarch.rpm
-rw-r--r-- 1 root root 4728 10月 31 14:28 centos-release-gluster-legacy-3.10-1.el6.centos.noarch.rpm
...
...
[root@centos ~]# ll centos6/extras/Packages/ | wc -l
48
[root@centos ~]# ll centos6/os/Packages/ | wc -l
6714
[root@centos ~]# ll centos6/updates/Packages/ | wc -l
1170
ローカルの centos6 ディレクトリに 3 つのフォルダーがあることがわかります。これら 3 つのフォルダーは、ダウンロードした Yum ソース内の 3 つのウェアハウスを表しています。各ウェアハウスには異なるインストール パッケージがあります。Yum ソース全体のすべてのインストール パッケージを使用して、次の手順に従います。それらを使用して独自の Yum ソースを構築できます。
【個人公開アカウント】
【微信公众号】搜索: 非著名运维 --》 公众号回复 “资料” 送运维自学资料大礼包哦!
運用・保守の知識も併せてご紹介しますので、ぜひご注目ください。