日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

redhat红帽官方软件仓库同步方案

發(fā)布時間:2023/12/16 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 redhat红帽官方软件仓库同步方案 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

說明:本方案為紅帽官方鏡像源同步方案,方案中以紅帽7版本為案例(附帶6跟8版本的方法以及腳本),每個rpms大概需要60G左右空間。其中同步的賬號為紅帽開發(fā)者賬號,不涉及商業(yè)利益。

一:同步環(huán)境準(zhǔn)備

1:redhat操作系統(tǒng)安裝(6,7,8)

?????? 本文不具體贅述redhat系統(tǒng)安裝方式,安裝前規(guī)劃好各級目錄,同步所需空間以及帶寬需求即可。

2:注冊到紅帽訂閱系統(tǒng)(subscription-manager)

1):subscription-manager具體用法

2):注冊綁定紅帽賬號:subscription-manager register

?????? 執(zhí)行subscription-manager register會提示輸入賬號密碼(賬號密碼不在此處提供),輸入賬號密碼后系統(tǒng)提示綁定成功。

3)列出系統(tǒng)所有可用的訂閱,并記錄你在系統(tǒng)激活的訂閱池Id

執(zhí)行subscription-manager list --available –all,列出系統(tǒng)所有可用的訂閱,并記錄訂閱池ID。

4):使用訂閱池id激活訂閱。

???? 執(zhí)行subscription-manager attach --pool=Pool ID

5):關(guān)閉當(dāng)前系統(tǒng)所有倉庫

?????? 執(zhí)行:subscription-manager repos --disable="*"

6):僅打開rhel-7-server-rpms倉庫

???????? 執(zhí)行subscription-manager repos --enable=rhel-7-server-rpms

7):列出當(dāng)前系統(tǒng)開啟的倉庫。

???????????? 執(zhí)行:yum repolist,如果需要列出所有倉庫包括被關(guān)閉的則執(zhí)行yum repolist all。

8):測試下載軟件包

?????? 執(zhí)行yum install XXX

到這里同步環(huán)境已經(jīng)準(zhǔn)備好, 以上對repo倉庫的操作為示例,只針對當(dāng)前服務(wù)器有影響,后續(xù)同步軟件包的過程,不會檢查repo倉庫是否關(guān)閉/開啟,只要對應(yīng)的配置(/etc/yum.repos.d/)存在,即可同步。

二:軟件倉庫同步

1:安裝reporsync命令

?????? 執(zhí)行:yum install yum-utils

RHEL 6/7 版本需要的reposync命令需要單獨(dú)安裝rpm包:?yum-utils?RHEL 8 版本則是集成在dnf命令中

2:確認(rèn)需要同步的各個rpms

本文以以下常見的幾個倉庫為例。

rhel-7-server-rpms

rhel-7-server-optional-rpms

rhel-7-server-extras-rpms

rhel-7-server-supplementary-rpms

rhel-ha-for-rhel-7-server-rpms

rhel-rs-for-rhel-7-server-rpms

rhel-7-server-debug-rpms

rhel-7-server-optional-debug-rpms

rhel-7-server-extras-debug-rpms

rhel-7-server-supplementary-debug-rpms

rhel-7-server-ansible-2-rpms

rhel-7-server-ansible-2-debug-rpms

rhel-ha-for-rhel-7-server-debug-rpms

rhel-rs-for-rhel-7-server-debug-rpms

3:編寫同步所需腳本

此處提供6,7,8三個系統(tǒng)版本的同步腳本

#!/bin/bashdownload_path="/repos"reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-optional-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-extras-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-supplementary-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-ha-for-rhel-6-server-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-rs-for-rhel-6-server-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-debug-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-optional-debug-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-extras-debuginfo reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-supplementary-debuginfo reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-ha-for-rhel-6-server-debug-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-rs-for-rhel-6-server-debug-rpms #!/bin/bash#定義下載回來的包存放的目錄 download_path="/repos"cat << EOF > /etc/yum.repos.d/epel.repo [epel] name=Extra Packages for Enterprise Linux 7 - \$basearch baseurl=http://mirrors.aliyun.com/epel/7/\$basearch failovermethod=priority enabled=1 gpgcheck=0 EOFreposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-optional-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-extras-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-supplementary-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-ha-for-rhel-7-server-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-rs-for-rhel-7-server-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=epel reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-debug-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-optional-debug-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-extras-debug-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-supplementary-debug-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-ansible-2-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-ansible-2-debug-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-ha-for-rhel-7-server-debug-rpms reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-rs-for-rhel-7-server-debug-rpms#--plugins 啟用yum插件支持 #--newest-only 每次回購僅下載最新的軟件包。 #--download_path 軟件包存放地址 #--repoid 需要下載的倉庫ID #!/bin/bashdownload_path="/repos"cat << EOF > /etc/yum.repos.d/epel.repo [epel] name=Extra Packages for Enterprise Linux \$releasever - \$basearch baseurl=https://mirrors.aliyun.com/epel/\$releasever/Everything/\$basearch enabled=1 gpgcheck=0 [epel-modular] name=Extra Packages for Enterprise Linux Modular \$releasever - \$basearch baseurl=https://mirrors.aliyun.com/epel/\$releasever/Modular/\$basearch enabled=1 gpgcheck=0 EOFdnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=rhel-8-for-x86_64-appstream-rpms dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=rhel-8-for-x86_64-baseos-rpms dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=rhel-8-for-x86_64-highavailability-rpms dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=rhel-8-for-x86_64-resilientstorage-rpms dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=rhel-8-for-x86_64-appstream-debug-rpms dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=rhel-8-for-x86_64-baseos-debug-rpms dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=epel dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=epel-modular dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=codeready-builder-for-rhel-8-x86_64-rpms dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=ansible-2-for-rhel-8-x86_64-rpms dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=ansible-2-for-rhel-8-x86_64-debug-rpms

4:執(zhí)行腳本同步

?????? 1):執(zhí)行sh 7_repo_update.sh

轉(zhuǎn)存失敗重新上傳取消

2)查看發(fā)現(xiàn)包正在陸續(xù)下載回來

轉(zhuǎn)存失敗重新上傳取消

至此紅帽倉庫開始同步,等待同步完成即可。以上提供的腳本可加入定時任務(wù)定時增量同步。

總結(jié)

以上是生活随笔為你收集整理的redhat红帽官方软件仓库同步方案的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。