redhat 系統和centos系統配置yum 源的幾種方法

來源:互聯網
上載者:User

標籤:

          紅帽或centos系統配置yum源

本地配置yum 源:光碟機倉庫,ISO倉庫(一般適用於紅帽linux,(因為它沒有配不然怎麼收錢)或者沒有連網的centos系統,

(都是配好的網源,只要可以連網就可以進行yum操作))

 文檔帶圖片連結    http://pan.baidu.com/s/1c2G6Xyg    (https://yunpan.cn/Oc6mzj4mLwgDzC  訪問密碼 d35c )

一、虛擬機器中有光碟機(虛擬機器中光碟片的位置)掛載的情況:       

(1)找到光碟機的位置(雙擊光碟機,滑鼠放在光碟機上面會顯示光線驅的位置,一般是在/run/media/使用者名稱(root等)下面)

 

如果沒有在虛擬機器設定一下

 

因為光碟機已經掛載,只需寫在/etc/repos.d目錄下一個設定檔(尾碼.repo)

#查看檔案

#或vi編輯.repo 是固定的檔案尾碼

#因為是本地源所以是file://+光碟機絕對路徑

#是否啟用源 1 啟用 0 非啟用

#值1 進行gpg檢查  0 不進行

 

[[email protected] /]# cd /etc/yum.repos.d

[[email protected] yum.repos.d]#ll   [[email protected] yum.repos.d]#vim dvd.repo   

[dvd]                                       

name=dvd

baseurl=file://"/run/media/root/RHEL-7.1 Server.x86_64/"  

enabled=1                                       

gpgcheck=0                    

 退出儲存

[[email protected] yum.repos.d]# yum clean all   # 清空一下緩衝

[[email protected] yum.repos.d]# yum repolist    #重新載入庫

[[email protected] yum.repos.d]# yum repolist all   #查看您擁有的倉庫

 

Status 是enable: 4,371  表示配置成功然後就可以進行yum 安裝了

二、用.iso 系統鏡像作文源

(如果開始並沒有.iso檔案,可以先自己製作一個如下)

[[email protected] /]# dd if=/dev/cdrom of=/mnt/RHEL.iso

/dev/cdrom (是/dev/sr0的一個軟串連) 系統光碟機

建立掛載點,寫檔案(此處baseurl中為掛載點)並本地掛載(-o loop).iso(格式: -t iso9660)檔案

[[email protected] /]# mkdir /media/dvd2

[[email protected] yum.repos.d]# vim dvd2.repo

[dvd2]

name=dvd2

baseurl=file:///media/dvd2

enabled=1

gpgcheck=0

[[email protected] yum.repos.d]# mount -t iso9660 -o loop /mnt/RHEL.iso /media/dvd2

設定開機自啟動在/etc/fstab(存放檔案系統的靜態資訊)下

[[email protected] yum.repos.d]# vim /etc/fstab

在最後一行添加

/mnt/RHEL.iso      /media/dvd2          iso9660   loop          0 0

退出儲存一下,

[[email protected] yum.repos.d]# mount -a     #自動掛載/etc/fstab中的檔案系統

 

添加yum網源(mirrors.aliyun.com)(前提是你能夠連上網)

直接配置 .repo 檔案

[[email protected] yum.repos.d]# vim epel.repo

[epel]

name=epel

baseurl=http://mirrors.aliyun.com/epel/7Server/x86_64/

enabled=1

gpgcheck=0

當然你也可以選擇其他網源。

退出儲存,yum repolist all 查看一下, yum update 更新一下

配置完成。

 

redhat 系統和centos系統配置yum 源的幾種方法

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.