centos設定使用本地源

來源:互聯網
上載者:User

標籤:

1、安裝vm-tools

2、設定共用資料夾,我設定的共用資料夾是E:\ProgramData   名稱:ProgramData

3、建立檔案夾   mkdir /media/CentOS/

4、掛載iso檔案

在CentOS中,設定檔案分享權限設定後,我們可以在/mnt/hgfs/目錄下發現一個ProgramData /子目錄,CentOS的iso檔案也就在該目錄下,本人共用以後,iso檔案在CentOS的路徑為

/mnt/hgfs/ProgramData/CentOS-6.3-x86_64-bin-DVD2.iso

將該鏡像檔案掛載到/media/CentOS/

[[email protected] yum.repos.d]# mount -o loop  /mnt/hgfs/ProgramData/CentOS-6.3-x86_64-bin-DVD2.iso /media/CentOS/

5、修改設定檔

cd /etc/yum.repos.d/

[[email protected] yum.repos.d]# more CentOS-Media.repo
# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
#  CentOS-6.  You can use this repo and yum to install items directly off the
#  DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
#  yum --enablerepo=c6-media [command]

# or for ONLY the media repo, do this:
#
#  yum --disablerepo=\* --enablerepo=c6-media [command]
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
        file:///media/cdrom/
        file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

其中 baseurl即是我們需要修改的參數,因為我們已經將iso鏡像掛載在/media/CentOS/目錄下了,所以不需要修改。yum本地源可以使用了。

6、使用本地yum源安裝軟體

使用本地yum源的方法在CentOS-Media.repo中已經描述了:

(4.1)除了使用本地yum源,也會是使用其他的yum源

yum --enablerepo=c6-media [command]

(4.2)只是用本地yum源

yum --disablerepo=/* --enablerepo=c6-media [command]

下面是用本地yum源安裝mysql

[[email protected] yum.repos.d]# yum --disablerepo=/* --enablerepo=c6-media install mysql-server

centos設定使用本地源

相關文章

聯繫我們

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