redhat 設定本地ISO為yum源,redhatisoyum源

來源:互聯網
上載者:User

redhat 設定本地ISO為yum源,redhatisoyum源

redhat 系統想要直接線上通過yum的條件時需要註冊,一般使用者都是非註冊的,這個時候如果要想通過yum安裝新軟體,我們可以通過將安裝盤鏡像ISO檔案設定為yum源的方式來進行。一般經過下面幾步

第一步:上傳安裝進項檔案到伺服器上。例如我將rhel-server-6.4-x86_64-dvd.iso上傳到/home目錄下

第二步:mount  iso檔案。到本地目錄mount -o loop -t iso9660 /mnt/cdrom /home/rhel-server-6.4-x86_64-dvd.iso 。其中/mnt/cdrom目錄需提前建立好。

第三步:建立一個/etc/yum.repos.d/cdrom.repo檔案。其中檔案內容如下

[CDROM]name=isofilebaseurl=file:///mnt/cdromenabled=1gpgcheck=0gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release

其中

CDROM是yum源名稱。

baseurl設定為iso鏡像檔案mount的目錄/mnt/cdrom

enable的值必須是1

gpgcheck的值隨便

gpgkey檔案設定為/mnt/cdrom目錄下的RPM-GPG-KEY-redhat-release即可

儲存退出後,執行下面的命令驗證yum源是否設定好了

yum list gcc


Loaded plugins: product-id, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.Available Packagesgcc.x86_64                                 4.4.7-3.el6                                  CDROM

如上所示,提示在CDROM這個yum源中找到gcc.x86_64的包。說明本地ISO的yum源設定好了。後面可以通過yum install命令安裝ISO中有的軟體包了。

實際上,不建立/etc/yum.repos.d/cdrom.repo也是可以的。直接編輯系統內建的/etc/yum.repos.d/ rhel-source.repo.repo檔案也可以。將內容添加到檔案後面,如下所示也可以

[rhel-source]name=Red Hat Enterprise Linux $releasever - $basearch - Sourcebaseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPMS/enabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release[rhel-source-beta]name=Red Hat Enterprise Linux $releasever Beta - $basearch - Sourcebaseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/enabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release[CDROM]name=isofilebaseurl=file:///mnt/cdromenabled=1gpgcheck=0gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release

效果一樣。


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.